Making randoms...
#1

im trying to make somthing give an random amount of money.. but i've failed.. the wiki doesnt help to much for random..... here is timer code...

pawn Код:
public ObjectLoad()
{
    for(new i; i < MAX_PLAYERS; i ++)
    {
        TogglePlayerControllable(i, 1);
        GivePlayerMoney(i, 1337);
    }
    return 1;
}

at
pawn Код:
GivePlayerMoney(i, 1337);
is where i want it to give random amounts.. like 777...444..2323.. bla bla bla...


can som1 explain better then wiki pls :S
Reply
#2

Try

pawn Код:
public ObjectLoad()
{
    for(new i; i < MAX_PLAYERS; i ++)
    {
        TogglePlayerControllable(i, 1);
        new RandomMoney = random(10000); // Edit to the maximum you want to give a player.
        GivePlayerMoney(i, RandomMoney);
    }
    return 1;
}
Reply
#3

Or if you wanted to have a minimum and maximum, for example: any number between 1000 and 5000.

pawn Код:
new RandomMoney = random(4000)+1000;
the 1000 is the minimum, the 4000 is the maximum minus the minimum.
Reply
#4

thanks guys i was playing around with it but never figured it out.. till u 2 came and helped.. o.O
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)