SA-MP Forums Archive
[HELP] 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: [HELP] Random money? (/showthread.php?tid=305136)



[HELP] Random money? - Fredden1993 - 21.12.2011

IS there a way to create like a PayDay system that give you a random amount between $1000 and $2000 every hour?


Re: [HELP] Random money? - RyDeR` - 21.12.2011

Just add this in a timer:
pawn Code:
GivePlayerMoney(playerid, random(2000 - 1000) + 1000);



Re: [HELP] Random money? - DonWade - 21.12.2011

Should be working with GivePlayerMoney(playerid, random(1000) + 1000); right ?


Re: [HELP] Random money? - Fredden1993 - 21.12.2011

I'll try in a minute.


Re: [HELP] Random money? - Norck - 21.12.2011

Check this out:
pawn Code:
forward RandomMoney();   // at the top of your script
// ...
SetTimer("RandomMoney",3600000,true); // at OnGameModeInit
// ...
public RandomMoney()   // somewhere else
{
    new random_money = 1000+random(1001);  // 1000-2000
    for(new i=GetMaxPlayers()-1; i >=0; i--)
    {
        if(!IsPlayerConnected(i))    continue;
        GivePlayerMoney(i,random_money);
    }
    return 1;
}



Re: [HELP] Random money? - Fredden1993 - 21.12.2011

Now, if I have
pawn Code:
GivePlayerMoney(i, random(1000) + 1000);
under my PayDay system, how can I turn the money that it go into
pawn Code:
PlayerInfo[playerid[pPayCheck]
instead of going into my pocket?


Re: [HELP] Random money? - Norck - 21.12.2011

PlayerInfo[playerid][pPayCheck] +=random(1000)+1001;