Code:
new g_Rounds;
public plugin_init()
{
register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
return PLUGIN_CONTINUE;
}
public eventNewRound()
{
if( ++g_Rounds < 5 )
{
return PLUGIN_CONTINUE;
}
g_Rounds = 0;
new players[32], pnum;
get_players(players, pnum, "c");
// calculate total players being picked
new count = floatround(float(pnum) * 0.25, floatround_ceil);
new i, j;
new specialppl[8], total; // the special people chosen
while( total < count )
{
i = random(pnum); // choose a random player and save
specialppl[total++] = players[i];
// shift the players down 1 to remove the player just picked
for( j = i; j < pnum; j++ )
{
if( (j + 1) == pnum )
{
players[j] = 0;
}
else
{
players[j] = players[j + 1];
}
}
}
new id;
for( new i = 0; i < total; i++ )
{
id = specialppl[i];
cs_set_user_team(id, CS_TEAM_T);
// you can do other stuff with id as well
}
for( new i = 0; i < pnum; i++ )
{
id = players[i];
cs_set_user_team(id, CS_TEAM_CT);
// you can do other stuff with id as well
}
return PLUGIN_CONTINUE;
}
__________________