SA-MP Forums Archive
Random player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random player (/showthread.php?tid=601707)



Random player - Mrcroissant - 25.02.2016

Hello,

How could i get a random player id, please i do not want any stock

thanks


Re: Random player - HydraHumza - 25.02.2016

It's easy

Код:
#include <a_samp>
#include <foreach>

foreach(new i: Player)// Efficient loop to get all players
{
   new random(i) // you are now selecting a random person
   // and now it's upon you what u want to do with guy.

}



Re: Random player - SamJust - 25.02.2016

random(MAX_PLAYERS);?


Re: Random player - Mrcroissant - 25.02.2016

thank you


Re: Random player - IstuntmanI - 25.02.2016

If you use foreach (and you should) use
pawn Код:
Iter_Random(Player)