SA-MP Forums Archive
Making randoms... - 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: Making randoms... (/showthread.php?tid=111077)



Making randoms... - DiddyBop - 29.11.2009

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


Re: Making randoms... - Anwix - 29.11.2009

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;
}



Re: Making randoms... - Joe Staff - 29.11.2009

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.


Re: Making randoms... - DiddyBop - 29.11.2009

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