how works random?
#1

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 ?
Reply
#2

See this wiki article.
Reply
#3

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
I read it more time and anyway I not understood
Reply
#4

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.
Reply
#5

thx, I'll try
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)