Advertisement
Zzerss

Random player id

Apr 5th, 2023
2,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.40 KB | Gaming | 0 0
  1. //BigSmoke_bb
  2. //Se puede optimizar con GetPlayerPoolSize
  3. stock RandomIDOfPlayer()
  4. {
  5.     new z = 0, w, y = GetMaxPlayers();
  6.     static Conectados[MAX_PLAYERS];
  7.     while(z < y)
  8.     {
  9.         if(IsPlayerConnected(z) && Condiciones[z] == 0) //
  10.         {
  11.             Conectados[w] = z;
  12.             w++;
  13.         }
  14.         z++;
  15.     }
  16.     return !w ? -1 : Conectados[random(w)]; //Id aleatoria
  17. }
  18.  
Tags: samp pawno
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement