How to random some player in server
#1

I want to random 5 players to be Zombie when Payday, How i do ? Thanks
Reply
#2

lots of work
but try this
or this
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)