need help in iter_random :(
#4

pawn Код:
new Iterator:Terrorists<MAX_PLAYERS>;
pawn Код:
Iter_Add(Terrorists, playerid);
// instead of:
gTeam[playerid] = Terrorists;
pawn Код:
Iter_Remove(Terrorists, playerid);
// instead of:
gTeam[playerid] = 0; // (or NO_TEAM)
pawn Код:
foreach(Terrorists, i)
{
    SendClientMessage(i, -1, "You are a terrorist.");
}
pawn Код:
new random_terrorist = Iter_Random(Terrorists);
I'm not sure if foreach guards against duplicate values, but if you're uncomfortable you can check with Iter_Contains before adding the player.
Reply


Messages In This Thread
need help in iter_random :( - by Champ - 17.06.2014, 05:29
Re: need help in iter_random :( - by Vince - 17.06.2014, 06:47
Re: need help in iter_random :( - by Champ - 17.06.2014, 06:53
Re: need help in iter_random :( - by Vince - 17.06.2014, 08:19
Re: need help in iter_random :( - by Champ - 17.06.2014, 09:30
Re: need help in iter_random :( - by Champ - 17.06.2014, 09:50
Re: need help in iter_random :( - by Champ - 17.06.2014, 14:47
Re: need help in iter_random :( - by Champ - 17.06.2014, 15:15
Re: need help in iter_random :( - by Konstantinos - 17.06.2014, 15:18
Re: need help in iter_random :( - by Champ - 17.06.2014, 15:37

Forum Jump:


Users browsing this thread: 2 Guest(s)