Random. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random. (
/showthread.php?tid=106907)
Random. -
Sal_Kings - 06.11.2009
Lets take a random cmd.
Код:
if(strcmp("/usepills", cmdtext, true, 10) == 0)
How do we change it into there will be a possibility of 10 things happening, when you type this.
It's random, you never know which one will happen.
EX : You die!
EX : You survive and get healed!
EX : You get high, due to a overdose!
You get my point.
Re: Random. -
BMUK - 06.11.2009
pawn Код:
new whathappens = random(10);
pawn Код:
if(whathappens == 10)
{
// code
}
else
if(whathappens == 9)
{
// code
}
...
Re: Random. -
MadeMan - 06.11.2009
pawn Код:
switch(random(3))
{
case 0: SetPlayerHealth(playerid, 0);
case 1: SetPlayerHealth(playerid, 100);
case 2: SetPlayerDrunkLevel(playerid, 5000);
}
Re: Random. -
Jeffry - 06.11.2009
Cool, this might help me too.
Re: Random. -
retart441 - 06.11.2009
You could add some animations to the death chance also, to make it look cooler.