How to do make it so there is a certain percentage for something to succeed? - 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: How to do make it so there is a certain percentage for something to succeed? (
/showthread.php?tid=447594)
How to do make it so there is a certain percentage for something to succeed? -
101 - 30.06.2013
I'm trying to make a system to plant bombs, however I'm stuck.
How do I make it, so that one bomb site, has the chance of 30% to be planted successfully, and an another 85%?
Re: How to do make it so there is a certain percentage for something to succeed? -
MP2 - 30.06.2013
pawn Код:
new percent = random(100);
if(percent < 85) // 85 percent of the time this will be true.
Not sure if its meant to be < or <= (I'm fairly certain it's correct).
Re: How to do make it so there is a certain percentage for something to succeed? -
101 - 30.06.2013
Thanks MP2, that'll do I think.