23.06.2013, 05:09
Like this maybe.
pawn Код:
stock RandomPlayer()
{
new ConnectedPlayers[MAX_PLAYERS];
new count;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ConnectedPlayers[count] = i;
count++;
SendClientMessage(i,0xF80000,"You've been chosen as a bonus player.");
}
}
if(count > 0) return ConnectedPlayers[random(count)];
return INVALID_PLAYER_ID;
}