SA-MP Forums Archive
Problem with world clock - 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: Problem with world clock (/showthread.php?tid=606203)



Problem with world clock - BrooklyN1995 - 01.05.2016

Hello guys. I have problem with world clock in my server. I use /gmx(command for restart), and when server is restarted the clock is back with 5-10 hours. Now is 11:40 in real time, in server is 4:30. I restart the server from console, but nothing.
This is my code:
Код:
new year,month,day,hours,minutes,seconds;
	getdate(year, month, day), gettime(hours, minutes, seconds);
	format(string, sizeof string, "~w~%d.%s%d.%s%d~w~ - ~w~%s%d:%s%d:%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year, (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
	TextDrawSetString(ClockData[i], string);
	format(string, sizeof string, "~w~%d.%s%d.%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year, (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
	TextDrawSetString(Clock[i], string);
	format(string, sizeof string, "~w~%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
	TextDrawSetString(Data[i], string);
        }



Re: Problem with world clock - Sjn - 01.05.2016

Why not simply use gl_realtime filterscript that comes with the server package? It does the same thing, displaying the real time for an in-game clock.


Re: Problem with world clock - Vince - 01.05.2016

Gettime uses server time, not your time. If you're in Europe and your server is in the US then US time will be used, obviously. Also you can use %02d to display numbers with a leading zero.