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



Random Chances [Help] - Ciarannn - 31.12.2014

Hi,

I've been having a problem whilst scripting lately with my /hotwire command. I want to make it so when you do /hotwire it gives you a 1/5 chance of success.

Anyone know how I would go about it?


Re: Random Chances [Help] - Boot - 31.12.2014

Maybe this function might be helpful:

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


Re: Random Chances [Help] - Ciarannn - 31.12.2014

I've used that function, and all that link shows you is how to create random points or so - anyone else have any idea?


Re: Random Chances [Help] - Vince - 31.12.2014

pawn Код:
if(random(5) == 0)
It can hardly be simpler. Random(5) returns 0, 1, 2, 3 or 4 and the underlying code is only executed when it returns 0, so that's 1 in 5.


Re: Random Chances [Help] - Ciarannn - 01.01.2015

Thanks Vince.