Untested
PHP Code:
#include < amxmodx >
#include < zombieplague >
#define MAX_PLAYERS 32
new const VERSION[] = "1.0";
new bool:g_bHasExtra[ MAX_PLAYERS + 1 ];
new cvar_give_extras_delay;
public plugin_init()
{
register_plugin("[ZP] Bot Addon: Give Random Extras", VERSION, "CrazY");
cvar_give_extras_delay = register_cvar("zp_give_extras_delay", "20.0");
}
public zp_round_started()
set_task(get_pcvar_float(cvar_give_extras_delay), "GiveRandomExtraBot", 053, .flags="b");
public zp_round_ended()
{
remove_task( 053 );
arrayset( g_bHasExtra , false , sizeof( g_bHasExtra ) );
//g_has_extra[0] = false;
}
public GiveRandomExtraBot()
{
static iBotName[33];
new BotID = fnGetBot();
if ( BotID > 0 )
{
get_user_name(BotID, iBotName, 32);
set_hudmessage(random(255), random(255), random(255), -1.0, 0.7, 1, 6.0, 1.1, 0.5, 0.5);
show_hudmessage(0, "O bot %s ganhou uma M249 Para Machinegun", iBotName);
zp_force_buy_extra_item(BotID, zp_get_extra_item_id("M249 Para Machinegun"), 1);
g_bHasExtra[ BotID ] = true;
}
}
stock fnGetBot()
{
new iPlayers[ 32 ] , iNum , id , iBot;
get_players( iPlayers , iNum , "dh" );
for ( new i = 0 ; i < iNum ; i++ )
{
id = iPlayers[ i ];
if ( !g_bHasExtra[ id ] )
{
iBot = id;
break;
}
}
return iBot;
}
get_players() flags
Code:
Optional list of filtering flags:
"a" - do not include dead clients
"b" - do not include alive clients
"c" - do not include bots
"d" - do not include human clients
"e" - match with team
"f" - match with part of name
"g" - match case insensitive
"h" - do not include HLTV proxies
"i" - include connecting clients
__________________