How to random some player in server
#3

pawn Код:
// In the payday thing;
new count, selected[5];
while(count < 5)
{
   new id = random(MAX_PLAYERS);
   if(IsPlayerConnected(id))
   {
      if(selected[0] != id && selected[1] != id && selected[2] != id && selected[3] != id && selected[4] != id)
      {
         selected[count] = id;
         count++;
      }
   }
}
You may also want to add a check if there are 5 players on the server. If there aren't, that will run forever. Also this is not the most effective way, but it will probably do the trick.
Reply


Messages In This Thread
How to random some player in server - by gunnrcrakr - 03.11.2010, 07:36
Re: How to random some player in server - by dark_clown - 03.11.2010, 07:41
Re: How to random some player in server - by Grim_ - 03.11.2010, 07:44

Forum Jump:


Users browsing this thread: 1 Guest(s)