Checking the time. - 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: Checking the time. (
/showthread.php?tid=512480)
Checking the time. -
Jacksta21 - 10.05.2014
How can I check the time, I want a Paycheck system that is called every hour on the hour (My server uses a real-time system that uses the time of the server)
Sorry for a very blunt explanation, but it's just as simple as that and I don't know how to do it!
Any help is much appreciated and will +rep.
AW: Checking the time. -
Macronix - 11.05.2014
Can you show me your real-time system?
Re: AW: Checking the time. -
Jacksta21 - 11.05.2014
Quote:
Originally Posted by Macronix
Can you show me your real-time system?
|
http://pastebin.com/dH6hpqw9
Thats the FS I'm using, although I've incorporated it into my gamemode, nothings changed.
AW: Checking the time. -
Macronix - 11.05.2014
You could check with a one second timer and GetTickCount:
pawn Код:
//above main()
new tick, NextCheck;
//In OnGameModeInit:
SetTimer(....); // with 1 sec interval
//In your one second function being called by SetTimer:
tick = GetTickCount();
if(tick - NextCheck > 3600000) //3600000 = 1 hour
{
//your code... so calling a function (PayCheck) or something
NextCheck = tick;
}
Re: Checking the time. -
Jacksta21 - 11.05.2014
So, basically just make a timer, that is called every hour, I sorta wanted it to be on the hour, like 09, 10, 11, etc.. But I guess thats better than nothing! Would I be able to do something like if(minutes == 00) or something to represent the new hour? I'm really not sure >.>