08.07.2011, 06:24
your not seeing entirely where that code is going.
and the goto is right. but i must say, count is positioned wrong.
your code won't give it a chance to select another player if random equals to you and there are more players online
this code selects a random player, if the player is you and more than 1 players are online, it skips it and checks again to try to get the other player. well basically count should be around what i put it, unless iter_random keeps selecting the same player 4 times? s:
and the goto is right. but i must say, count is positioned wrong.
pawn Код:
public StartInfection(playerid) {
new count = 0;
start:
new Random = Iter_Random(Player);
if(Random == playerid && Iter_Count(Player) > 1) {
count++;
if(count > 3)
{
//failed
return 1;
}
goto start;
}
OnceOnly = 0;
return 1;
}
this code selects a random player, if the player is you and more than 1 players are online, it skips it and checks again to try to get the other player. well basically count should be around what i put it, unless iter_random keeps selecting the same player 4 times? s: