AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Plugin resets every map change? (https://forums.alliedmods.net/showthread.php?t=92582)

deathmarch06 05-17-2009 04:16

[HELP] Plugin resets every map change?
 
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.

deathmarch06 05-18-2009 04:39

Re: [HELP] Plugin resets every map change?
 
Does anyone know if its even possible to fix this ?

deathmarch06 05-18-2009 06:24

Re: [HELP] Plugin resets every map change?
 
bump


All times are GMT -4. The time now is 01:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.