Raised This Month: $51 Target: $400
 12% 

Can't fix it myself


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pillowCloud
Member
Join Date: Aug 2015
Location: AlliedModders
Old 08-03-2015 , 12:49   Can't fix it myself
Reply With Quote #1

I made some edits in xPaw's deathrun free round plugin from here: https://forums.alliedmods.net/showthread.php?p=1406137
, but it has some bugs that i dunno how to fix.

The problem is that i can't make people not to use any other weapons but knife,
and also when i'm trying to restart the round after accepting a free round, the menu is not showing up (only when i restart again).

I made some crazy stuff in order to find the problem - nothing helps.

I'ma kinda new with this, so please guys don't eat me

the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fakemeta>

#define PLUGIN "Deathrun Free Round"
#define VERSION "1.0"
#define AUTHOR "xPaw | Edited by pillowCloud"

#define TASK_VOTE  237439

const m_toggle_state 41;

new 
bool:g_bFreeRound=false;
new 
g_Timer;
//new maxplayers;

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHamHam_Use"func_rot_button""FwdHamUse_Button" );
    
RegisterHamHam_Use"func_button",     "FwdHamUse_Button" );
    
RegisterHamHam_Use"button_target",   "FwdHamUse_Button" );
    
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawn_Post"true);
    
    
register_logevent("logevent_round_end"2"1=Round_End");
    
register_logevent("logevent_round_start"2"1=Round_Start");
    
register_logevent("event_new_round"2"0=World triggered","1=Round_Start");
    
    
register_event"CurWeapon""EventCurWeapon""be""1=1""2!29" );
    
register_event"TextMsg",   "EventRestart",   "a",  "2&#Game_C""2&#Game_w" );
    
    
//maxplayers  = get_maxplayers()
}

public 
FwdPlayerSpawn_Post(id)
{
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        if(
g_bFreeRound==false)
        {
            new 
Menu menu_create("\r[ \yFree \r] \yDo you want to start a \rFree Round\y?""Menu_Handle");
            
            
menu_additem(Menu"\rYes""1");
            
menu_additem(Menu"\rNo""2");
            
            
menu_display(idMenu);
        }
    }
    
    
remove_taskTASK_VOTE );
    
set_task(0.0"PreTask"TASK_VOTE);
    
}

/*
public ShowFreeMenu()
{
    for( new i = 1; i <= get_maxplayers(); i++ )
    {
        if(cs_get_user_team(i) == CS_TEAM_T)
        {
            if(g_bFreeRound==false)
            {
                new Menu = menu_create("\r[ \yFree \r] \yDo you want to start a \rFree Round\y?", "Menu_Handle");
                
                menu_additem(Menu, "\rYes", "1");
                menu_additem(Menu, "\rNo", "2");
                
                menu_display(i, Menu);
            }
        }
    }
    
    remove_task( TASK_VOTE );
    set_task(0.0, "PreTask", TASK_VOTE);    
}
*/

public Menu_Handle(idMenuItem)
{
    if( 
Item == MENU_EXIT )
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }

    new 
AccessCallbackszData[5];
    
menu_item_getinfo(MenuItemAccessszDatacharsmax(szData), __Callback);
    
    switch(
str_to_num(szData))
    {
        case 
1:
        {
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                
StartFreeRound();
            }
        }
        
        case 
2:
        {
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                new 
szName[32];
                
get_user_name(idszNamecharsmax(szName));
                
ColorChat(0"^4%s ^1has chosen not to give a ^4Free Round^1."szName);
            }
        }
    }
        
    return 
PLUGIN_HANDLED;
}

public 
PreTask( )
{
    
remove_taskTASK_VOTE );
    
g_Timer 10;
    
set_task1.0"TaskVoteTimer"TASK_VOTE__"b" );
}

public 
TaskVoteTimer( )
{
    
g_Timer--;
    
    if (
g_Timer==0)
    {
        
show_menu(00"\n"1);
    }
}

public 
EventRestart()
{
    
g_bFreeRound false;
}

public 
logevent_round_end ()
{
    
g_bFreeRound false;
}

public 
logevent_round_start ()
{
    
g_bFreeRound false;
}

public 
EventCurWeaponid )
    if( 
g_bFreeRound )
        
engclient_cmdid"weapon_knife" );

public 
StartFreeRound()
{
    
g_bFreeRound true;
    
PrintMessage();
}

public 
PrintMessage()
{
    
ColorChat(0"It is a^4 Free round^1, no guns, no traps!");
    
    
set_hudmessage0900, -1.00.3513.03.02.01.0, -);
    
show_hudmessage0"FREE ROUND!" );
}

public 
FwdHamUse_ButtoniEntityidiActivatoriUseTypeFloat:flValue ) {
    if( 
g_bFreeRound && iUseType == && flValue == 1.0 && is_user_aliveid )
    &&  
get_user_teamid ) == && get_pdata_intiEntitym_toggle_state) == ) {
        
/* Oh hi this code actually happen! :D */
        
        
set_hudmessage0100255, -1.00.2502.02.00.20.2);
        
show_hudmessageid"It is free round!^nYou can't use buttons!" );
        
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

stock ColorChat(const id, const string[], {FloatSqlResul_}:...) 
{
new 
msg[191], players[32], count 1;

static 
lenlen formatex(msgcharsmax(msg), "^4[^1 Deathrun ^4]^1 ");
vformat(msg[len], charsmax(msg) - lenstring3);

if(
id)  players[0] = id;
else    
get_players(playerscount"ch");
    
for (new 
0counti++)
{
    if(
is_user_connected(players[i]))
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
        
write_byte(players[i]);
        
write_string(msg);
        
message_end();
    }
}

Any reason for being ingnored?

Last edited by pillowCloud; 08-05-2015 at 09:33. Reason: nobody answer
pillowCloud is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode