whenever my plugin is on (amx_pugin 1), it will transfer all players to CT and then pick a random player and transfer him to T. (one vs all CT)
here is the method:
PHP Code:
public PickARandomPlayer()
{
new playersT[32], playersCT[32], numT, numCT
get_players(playersT,numT,"e","TERRORIST")
for(new i=0;i<numT;i++)
cs_set_user_team(playersT[i],CS_TEAM_CT)
get_players(playersCT,numCT,"e","CT")
newTerror = playersCT[random_num(0,numCT-1)]
cs_set_user_team(newTerror ,CS_TEAM_T)
}
sometimes, when there are only two players on the map and both are T, if I turn on the plugin, it will give this error:
Run time error 10: native error (native "cs_set_user_team")
then I will transfer myself to CT and will re-turn on the plugin again and it will work.
where is the problem and how to avoid such issue?
__________________