22.03.2018, 19:46
I do this under OnGameModeInit:
So every time server restarts, it does some calculation and set's a timer when the next hour "will happen". And then I do:
The difference might be of 1 minute but that won't hurt.
EDIT: I've defined my variable 'gHour' on the top of the script.
PHP код:
new minutes;
gettime(gHour, minutes);
minutes = 60 - minutes;
SetTimer("ClockTimer", (minutes * 60000) + 5000, false);
SetWorldTime(gHour);
PHP код:
forward ClockTimer();
public ClockTimer()
{
new string[25];
gettime(gHour);
format(string, sizeof string, "The time is now %d:00.", gHour);
SendClientMessageToAll(COLOR_GREY, string);
SetTimer("ClockTimer", 3600000, true); // That interval = 1 hour but in milliseconds.
return 1;
}
EDIT: I've defined my variable 'gHour' on the top of the script.