SA-MP Forums Archive
Payday/Paycheck system ? - 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: Payday/Paycheck system ? (/showthread.php?tid=491908)



Payday/Paycheck system ? - anou1 - 01.02.2014

Hi everybody,

I want to do a paycheck system that pay players connected every hour ( exemple 1:00, 2:00).
But I don't know where I should start, and how could I do it.


How should I proceed to do it please ?


Thank you !


Re: Payday/Paycheck system ? - SpaMaster - 01.02.2014

Top of script

Код:
forward Paycheck(); // setting a timer for paycheck
OnGameModeInit:

Код:
SetTimer("Paycheck", 3600000, true); // activating a timer
Now public for it:

Код:
public Paycheck()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
		if(IsPlayerConnected(i))
		{
			new rand = random(1000);
			GivePlayerMoney(i, rand);
        	        SendClientMessage(i, -1, "You get your paycheck");
    	}
	}
	return 1;
}
That's it


Re: Payday/Paycheck system ? - anou1 - 01.02.2014

Thank you, but the timer will start with Gamemode, if I start server at 2:44 It will pay them at (3:44,4:44 etc)

Anyway to do it when it's X:00 ?


Re: Payday/Paycheck system ? - anou1 - 01.02.2014

No ideas ?


Re: Payday/Paycheck system ? - erminpr0 - 01.02.2014

Yep, 1 minute repeating timer, use gettime() each time timer happens, and check if minutes equals to 0.
No any other ideas huh :/