Hello,
I wanna make the following plugin work so that it remembers how much time is left unless the server is reset.
Currently the timer works, but whenever the map changes it resets and I don't know how to fix this.
Code:
#include <amxmodx>
#include <amxmisc>
new g_counter
new hour, minute, second
public plugin_init()
{
register_plugin("LethaL Gaming Restarter","1.0","Matt/AnuBi")
//1 hour * 6
g_counter = 3600 * 6
set_task(1.0, "CountDown", 0, "", 0, "b")
}
public CountDown()
{
if(!g_counter--)
{
server_cmd("restart")
return
}
hour = g_counter / 3600
minute = g_counter % 3600 / 60
second = g_counter % 3600 % 60
set_hudmessage(0, 100, 0, 1.35, -1.35, 0, 0.01, 1.0, 0.01, 0.01, 4)
//show_hudmessage(0, "%d Seconds Until Server Restart.", g_counter)
show_hudmessage(0,"%02d:%02d:%02d Left",hour,minute,second)
}
Any help appreciated.
Regards,
Matt/AnuBi.