SA-MP Forums Archive
[Help] Random - 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: [Help] Random (/showthread.php?tid=77752)



[Help] Random - borisblat - 14.05.2009

I have already opened a topic but i open a new one coz it is hard to understand something in the last one

If i do to something random how can i know what selected?
..

Old topic : http://forum.sa-mp.com/index.php?topic=102517.0


Re: [Help] Random - OmeRinG - 14.05.2009

"how can i know what selected?"
what do you mean?


Re: [Help] Random - MX_Master - 14.05.2009

you can store last random number into any global variable or array cell and every time you need you can see what number it was


Re: [Help] Random - borisblat - 14.05.2009

I mean like this:

example
random of 1 and 2

if it will choose 1
then : Do something

if it will choose 2
then : Do something else...





Re: [Help] Random - pspleo - 14.05.2009

pawn Код:
new rand;
rand = random(100); //0 - 100
if(rand <= 49) //50% chance there will be under 49
{
  //do something
}
else if(rand >= 50) //50 and up - 50% chance there will be higher
{
  //do something else
}
That will basically random a number from 0 to 100.

Leopard