23.07.2011, 06:00
i don't understand how to get 1 random player using foreach i made one but it gets like 3 or 6 players.
im also using gTeam.
im also using gTeam.
forward RandomPlayer(playerid);
public RandomPlayer(playerid) {
new count = 0;
new Random = Iter_Random(Player);
foreach(Player, i){
if(gTeam[i] == TeamName) count++;
if(count == Iter_Count(Player)) {
// Your stuff for that 1 player
// Example GivePlayerCash(Random,5000);
}
}
return 1;
}