Code ?
#1

See I wanted to make a Pinfo Variable that saves When Typed a CMD I want that variable to be 3 Random Numbers So how can I do it ? Turn it to 3 Random Numbers ?
Reply
#2

pawn Code:
CMD:random(playerid, params[])
{
    new rand = randomEx(1, 3);
    if(rand == 1)
    {
        SendClientMessage(playerid, -1, "random 1");
    }
    else if(rand == 2)
    {
        endClientMessage(playerid, -1, "random 2");
    }
    else if(rand == 3)
    {
        endClientMessage(playerid, -1, "random 3");
    }
    return 1;
}

stock randomEx(min, max)
{
    new rand = random(max-min) +min;
    return rand;
}
Reply
#3

I will try this But I can change the min and max ? To whatever ? Or only works for 1 2 and 3 ?
Reply
#4

Use
CMD:random(playerid,params[])
{
variable = 100*random(10) + 10*random(10) + random(10); //random 3 digit number will be stored into your variable
}
Reply
#5

Dont you think it should be random(9) Or else if random(10) Then 10 can also be a number right ?
Reply
#6

Quote:
Originally Posted by rockhopper
View Post
Dont you think it should be random(9) Or else if random(10) Then 10 can also be a number right ?
No, random(10) generates a number from 0 to 9
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)