AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   PodBots getting killed (https://forums.alliedmods.net/showthread.php?t=309762)

edon1337 08-06-2018 09:17

PodBots getting killed
 
I'm using this code to automatically choose a team and class for players, it works just fine for me but I see PodBots get killed as soon as they spawn, what is the reason?

PHP Code:

// Old Style Menus
stock const FIRST_JOIN_MSG[ ]       =   "#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[ ]  =    "#Team_Select_Spect";
stock const INGAME_JOIN_MSG[ ]      =    "#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[ ] =    "#IG_Team_Select_Spect";
const 
iMaxLen sizeofINGAME_JOIN_MSG_SPEC );

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =    2;

public 
plugin_init( )
{
    
register_messageget_user_msgid"ShowMenu" ), "MsgShowMenu" );
    
register_messageget_user_msgid"VGUIMenu" ), "MsgVGUIMenu" );
}

public 
MsgVGUIMenuiMsgIdiDestid )
{
    if( 
get_msg_arg_int) != VGUI_JOIN_TEAM_NUM )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
<= get_user_teamid ) <= )
    return 
PLUGIN_HANDLED;
    
    new 
szParameters];
    
szParameters] = id;
    
szParameters] = iMsgId;
    
    
set_task0.1"OnAutoJoin"_szParameterssizeofszParameters ) );
    
    return 
PLUGIN_HANDLED;
}

public 
MsgShowMenuiMsgIdiDestid )
{
    if( 
<= get_user_teamid ) <= )
    return 
PLUGIN_HANDLED;

    static 
szMenuCodeiMaxLen ];
    
get_msg_arg_string4szMenuCodecharsmaxszMenuCode ) );
    
    if( 
equalszMenuCodeFIRST_JOIN_MSG ) || equalszMenuCodeFIRST_JOIN_MSG_SPEC ) )
    {
        new 
szParameters];
        
szParameters] = id;
        
szParameters] = iMsgId;
        
        
set_task0.1"OnAutoJoin"_szParameterssizeofszParameters ) );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
OnAutoJoin( const szParameters[ ] )
{
    new 
id szParameters];
    new 
iMsgId szParameters];
    
    new 
iMsgBlock get_msg_blockiMsgId );
    
set_msg_blockiMsgIdBLOCK_SET );
    
    new 
iTeam random_num1);
    new 
iClass random_num1);
    
    new 
szClass], szTeam];
    
num_to_striTeamszTeamcharsmaxszTeam ) );
    
num_to_striClassszClasscharsmaxszClass ) );
    
    
log_to_file"TeamDebug.txt""%d %d %s %s"iTeamiClassszTeamszClass );
    
    
engclient_cmdid"jointeam"szTeam );
    
engclient_cmdid"joinclass"szClass );
    
    
set_msg_blockiMsgIdiMsgBlock );



D4rkSiD3Rs 08-08-2018 14:24

Re: PodBots getting killed
 
Why exaclty on spawning ? Are you sure this problem occurs only if you use that plugin ?
If yes try to use that plugin works only with humans not bots, because PODbot already sets the bots teams automatically.

PHP Code:

if(is_user_bot(id)) return 



All times are GMT -4. The time now is 12:49.

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