Problem with world clock
#1

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);
        }
Reply
#2

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.
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)