SA-MP Forums Archive
random money - 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: random money (/showthread.php?tid=296086)



random money - Speed - 09.11.2011

How to give random money to player..


Re: random money - Stigg - 09.11.2011

pawn Код:
new cash = random(2000);
GivePlayerMoney(playerid, cash);
Gives player money between 1 and 2000


Re: random money - Kostas' - 09.11.2011

Can I ask something about the random.
If I want to make a chance command, how I can do it randomly ( cash, kill, random teleport) and add
pawn Код:
new cash = random(2000);
GivePlayerMoney(playerid, cash);
you said ofc


Re: random money - AeroBlast - 09.11.2011

pawn Код:
switch(random(3))
{
    case 0:
    {
        new cash = random(2000);
        GivePlayerMoney(playerid, cash);
        return 1;
    }
    case 1:
    {
        SetPlayerHealth(playerid,0);
        return 1;
    }
    case 2:
    {
        new x = -8000 + random(16000);
        new y = -8000 + random(16000);
        SetPlayerPosFindZ(playerid, x, y, 200.0);
        return 1;
    }
}
Didn't test it.


Re: random money - Kostas' - 09.11.2011

Thank you AeroBlast
it works fine!


Re: random money - sansk - 13.09.2013

You could also do something like:

Код:
new cash = random(40-100);
	  GivePlayerMoney(playerid, cash);