how works 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)
+--- Thread: how works random? (
/showthread.php?tid=326390)
how works random? -
mineralo - 17.03.2012
how works random? I need it, I tried once but not work random
pawn Код:
if(ShitInfo[playerid][pJump] == 1)
{
DisablePlayerCheckpoint(playerid);
scm(playerid,COLOR_GREEN,"( ! ) Go to next check point !");
new rand = random(1);
if(rand == 0)
{
ShitInfo[playerid][pJump]++;
SetPlayerCheckpoint(playerid,719.6017,-1421.3615,21.6963,2);
}
else if(rand == 1)
{
SetPlayerCheckpoint(playerid,815.9489,-1381.9213,23.5823,2);
ShitInfo[playerid][pJump]=12;
}
return 1;
}
could somebody show or explain how works random ?
Re: how works random? - T0pAz - 17.03.2012
See this wiki article.
Re: how works random? -
mineralo - 17.03.2012
Quote:
Originally Posted by T0pAz
|
I read it more time and anyway I not understood
Re: how works random? -
Vince - 17.03.2012
As stated there, the random function returns a number between 0 and
max-1. Random(1) will therefor always produce 0. If you need two values to choose from, you need random(2) which will produce either 0 or 1.
Re: how works random? -
mineralo - 17.03.2012
thx, I'll try