Random Chances [Help]
#1

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?
Reply
#2

Maybe this function might be helpful:

https://sampwiki.blast.hk/wiki/Random
Reply
#3

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

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.
Reply
#5

Thanks Vince.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)