27.10.2012, 21:05
example
random(2) - %50 percent chance of succeeding
random(3) - %33 percent chance of succeeding
random(4) - %25 percent chance of succeeding
random(5) - %20 percent chance of succeeding
etc.
Heres a page on switch statements in case you don't know how to use them.
http://wiki.amxmodx.org/Pawn_Tutorial#Switch_Statements
pawn Code:
CMD:command(playerid, params[])
{
switch(random(2))
{
case 1:
SendClientMessage(playerid, -1, "Success!");
default:
SendClientMessage(playerid, -1, "Failed!");
}
return 1;
}
random(3) - %33 percent chance of succeeding
random(4) - %25 percent chance of succeeding
random(5) - %20 percent chance of succeeding
etc.
Heres a page on switch statements in case you don't know how to use them.
http://wiki.amxmodx.org/Pawn_Tutorial#Switch_Statements