SA-MP Forums Archive
Breaking Cuffs [with a 10 % chance] - 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: Breaking Cuffs [with a 10 % chance] (/showthread.php?tid=643022)



Breaking Cuffs [with a 10 % chance] - ImTobi - 11.10.2017

Hey everyone, i have a command, to break cuffs, if a player is cuffed, and i want that the player only has a 10 % chance of breaking it


Re: Breaking Cuffs [with a 10 % chance] - Dignity - 11.10.2017

pawn Код:
if ( random ( 100 ) <= 10 ) {
   
    // success
}

else {

    // fail
}



Re: Breaking Cuffs [with a 10 % chance] - ImTobi - 11.10.2017

Thanks! That worked. Rep


Re: Breaking Cuffs [with a 10 % chance] - Freaksken - 11.10.2017

random(100) goes from 0 to 99.
So the correct thing would be the following:
Код:
if ( random ( 100 ) < 10 )
...