Getting 1 Random Player
#1

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.
Reply
#2

pawn Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)