SA-MP Forums Archive
Command Chance? Making commands randomly work - 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: Command Chance? Making commands randomly work (/showthread.php?tid=526228)



Command Chance? Making commands randomly work - [Cali]ChrOnic_T - 16.07.2014

Can someone explain to me how to give the command a chance like If i type /rob . one moment it will say
'Success you robbed [Cali]ChrOnic_T' and the next moment it says 'Failed to rob [Cali]ChrOnic_T'.

Explain please.



Re: Command Chance? Making commands randomly work - Matess - 16.07.2014

for example:

pawn Код:
if(!random(5)) return SendClientMessage(playerid,-1,"'Success you robbed [Cali]ChrOnic_T");//random(5) means 0 1 2 3 4 so there is 20% chance
else SendClientMessage(playerid,-1,"'Failed to rob [Cali]ChrOnic_T");



Re: Command Chance? Making commands randomly work - xVIP3Rx - 16.07.2014

put
pawn Код:
new rndm = random(2);

switch(rndm)
{
    case 0: //Success you robbed [Cali]ChrOnic_T
    case 1: //Failed to rob [Cali]ChrOnic_T
}
inside the command