SA-MP Forums Archive
Random ID`s picker - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random ID`s picker (/showthread.php?tid=136618)



Random ID`s picker - DarkPower - 25.03.2010

How to make simple loto system whit random ID`s, example: to evry 30min pick one ID and give him money....I know how to make timer and evrything but i dont know how to make random ID`s example 2,5,8,15,7,3.... and if is that ID not online then its get message: Nobody was won lotery today.....


Re: Random ID`s picker - DarkPower - 26.03.2010

bump


Re: Random ID`s picker - Correlli - 26.03.2010

https://sampwiki.blast.hk/wiki/Random


Re: Random ID`s picker - DarkPower - 26.03.2010

Quote:
Originally Posted by Don Correlli
that is for random spawn, i need for random ID


Re: Random ID`s picker - Correlli - 26.03.2010

That's a random function, you can use it for any random thing you need, not only spawns.


Re: Random ID`s picker - DarkPower - 26.03.2010

Quote:
Originally Posted by Don Correlli
That's a random function, you can use it for any random thing you need, not only spawns.
hmm i will try.... tny correlli


Re: Random ID`s picker - wafffllesss - 26.03.2010

Try this:
pawn Код:
stock GetRandomPlayer(){
  new pls[500], pl;
  for(new i=0; i<500; i++){
    if(IsPlayerConnected(i)){
      pls[pl] = i;
      pl++;
    }
  }
  return pls[random(pl)];
}

// Usage:
new pid = GetRandomPlayer();
GivePlayerMoney(pid,50000);
SendClientMessage(pid,COLOR,"You won!");