Get random player
#5

You could create a function, or use Iter_Random (I think It's that) in ******' foreach, if you're using foreach, that is.

Here is a function that will get you a random, connected, player - though it could be done much better!

pawn Code:
stock RandomPlayer()
{
     new iPlayer = random(GetMaxPlayers());
     while(!IsPlayerConnected(iPlayer)) iPlayer = random(GetMaxPlayers());
     return iPlayer;
}
Reply


Messages In This Thread
Get random player - by tal_peretz - 16.02.2012, 10:44
Re: Get random player - by milanosie - 16.02.2012, 10:49
Re: Get random player - by Chris White - 16.02.2012, 11:17
Re: Get random player - by tal_peretz - 16.02.2012, 11:27
Re: Get random player - by Ash. - 16.02.2012, 11:32

Forum Jump:


Users browsing this thread: 1 Guest(s)