Raised This Month: $51 Target: $400
 12% 

[HELP] TimeLeft Restart (PLZZ !!! i need help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiceGuyx
Senior Member
Join Date: Nov 2011
Old 08-16-2012 , 19:22   [HELP] TimeLeft Restart (PLZZ !!! i need help)
Reply With Quote #1

Can anyone fix the timeleft plugin to not restart to 60minutes if i restart the round by using (amx_cvar sv_restart 1) or if players got Reliable channel overflowed

PHP Code:
#include <amxmodx>

new g_TimeSet[32][2]
new 
g_LastTime
new g_CountDown
new g_Switch

public plugin_init()
{
    
register_plugin("TimeLeft"AMXX_VERSION_STR"AMXX Dev Team")
    
register_dictionary("timeleft.txt")
    
register_srvcmd("amx_time_display""setDisplaying")
    
register_cvar("amx_timeleft""00:00"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
register_clcmd("say timeleft""sayTimeLeft"0"- displays timeleft")
    
    
set_task(0.8"timeRemain"8648458""0"b")
}

public 
sayTimeLeft(id)
{
    if (
get_cvar_float("mp_timelimit"))
    {
        new 
get_timeleft()
        
        
client_print(0print_chat"%L:  %d:%02d"LANG_PLAYER"TIME_LEFT", (60), (60))
    }
    else
        
client_print(0print_chat"%L"LANG_PLAYER"NO_T_LIMIT")
    
    return 
PLUGIN_CONTINUE
}

setTimeText(text[], lentmlfid)
{
    new 
secs tmlf 60
    
new mins tmlf 60
    
    
if (secs == 0)
        
format(textlen"%d %L"minsid, (mins 1) ? "MINUTES" "MINUTE")
    else if (
mins == 0)
        
format(textlen"%d %L"secsid, (secs 1) ? "SECONDS" "SECOND")
    else
        
format(textlen"%d %L %d %L"minsid, (mins 1) ? "MINUTES" "MINUTE"secsid, (secs 1) ? "SECONDS" "SECOND")
}

findDispFormat(time)
{
    for (new 
0g_TimeSet[i][0]; ++i)
    {
        if (
g_TimeSet[i][1] & 16)
        {
            if (
g_TimeSet[i][0] > time)
            {
                if (!
g_Switch)
                {
                    
g_CountDown g_Switch time
                    remove_task
(8648458)
                    
set_task(1.0"timeRemain"34543""0"b")
                }
                
                return 
i
            
}
        }
        else if (
g_TimeSet[i][0] == time)
        {
            return 
i
        
}
    }
    
    return -
1
}

public 
setDisplaying()
{
    new 
arg[32], flags[32], num[32]
    new 
argc read_argc() - 1
    
new 0

    
while (argc && 32)
    {
        
read_argv(1arg31)
        
parse(argflags31num31)
        
        
g_TimeSet[i][0] = str_to_num(num)
        
g_TimeSet[i][1] = read_flags(flags)
        
        
i++
    }
    
g_TimeSet[i][0] = 0
    
    
return PLUGIN_HANDLED
}

public 
timeRemain(param[])
{
    new 
gmtm get_timeleft()
    new 
tmlf g_Switch ? --g_CountDown gmtm
    
new stimel[12]
    
    
format(stimel11"%02d:%02d"gmtm 60gmtm 60)
    
set_cvar_string("amx_timeleft"stimel)
    
    if (
g_Switch && gmtm g_Switch)
    {
        
remove_task(34543)
        
g_Switch 0
        set_task
(0.8"timeRemain"8648458""0"b")
        
        return
    }

    if (
tmlf && g_LastTime != tmlf)
    {
        
g_LastTime tmlf
        
new tm_set findDispFormat(tmlf)
        
        if (
tm_set != -1)
        {
            new 
flags g_TimeSet[tm_set][1]
            new 
arg[128]
            
            if (
flags 1)
            {
                new 
players[32], pnum
                
                get_players
(playerspnum"c")
                
                for (new 
0pnumi++)
                {
                    
setTimeText(arg127tmlfplayers[i])
                    
                    if (
flags 16)
                        
set_hudmessage(255255255, -1.00.8500.01.10.10.5, -1)
                    else
                        
set_hudmessage(255255255, -1.00.8500.03.00.00.5, -1)
                    
                    
show_hudmessage(players[i], "%s"arg)
                }
            }

        }
    }

NiceGuyx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:47.


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