13.07.2011, 05:44
The way I did this, like if you had to pick a random player id, was to store all of the possible choices in an array and then pick randomly from the array size. Maybe like this.
Something like that I think.
Edit : Too slow...
pawn Код:
new playerlist[MAX_PLAYERS],
size; // Maybe this is uneccessary and you could use sizeof
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
playerlist[size] = i;
size++;
}
}
new rand = playerlist[random(size) + 1];
Edit : Too slow...