Quote:
Originally Posted by Ricop522
pawn Code:
stock RandomID() { next: new playerid; playerid = random(GetMaxPlayers()); if(!IsPlayerConnected(playerid)) goto next; return playerid; }
//or this stock players() { new c; for(new i = 0; i < MAX_PLAYERS; ++i) { if(IsPlayerConnected(i)) { c++ ; } } return c; } //using //random(players())
|
This is not correct:
stock players().
Because if server has 10 players online and the highest id is 12 this one will not be included at random.