AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud msg & timeleft help (https://forums.alliedmods.net/showthread.php?t=88162)

BeasT 03-21-2009 08:22

Hud msg & timeleft help
 
How can I make the hud msg only appear when there are 2 minutes left on the map? And the hud msg counting should stay on the screen till map change.

PHP Code:

public show_timer()

    new 
nextmap[32
    
get_cvar_string("amx_nextmap",nextmap,31
    new 
timeleft get_timeleft()
    
set_hudmessage(255,255,255,0.75,0.05,01.01.00.10.213
    
show_hudmessage(0,"Time remaining: %d:%02d^nNext map: %s",timeleft 60timeleft 60,nextmap
    return 
PLUGIN_CONTINUE 


public 
plugin_init() 

    
register_plugin("TimeProjector","0.1","ST4life"
    
set_task(0.1"show_timer",0,"",0,"b")
    return 
PLUGIN_CONTINUE 



TheRadiance 03-21-2009 08:24

Re: Hud msg & timeleft help
 
PHP Code:

public show_timer()

    if ( 
get_timeleft( ) <= 120 )
    {
        new 
nextmap[32
        
get_cvar_string("amx_nextmap",nextmap,31
        new 
timeleft get_timeleft()
        
set_hudmessage(255,255,255,0.75,0.05,01.01.00.10.213
        
show_hudmessage(0,"Time remaining: %d:%02d^nNext map: %s",timeleft 60timeleft 60,nextmap
    }
    
set_task(1.0"show_timer"0)


public 
plugin_init() 

    
register_plugin("TimeProjector","0.1","ST4life"
    
set_task(0.1"show_timer",0,"",0,"b")
    return 
PLUGIN_CONTINUE 



BeasT 03-22-2009 14:33

Re: Hud msg & timeleft help
 
I think your edit makes cpu usage go up to 100%.
Note: I'm using soccerjam mod where mp_timelimit gets reseted after every goal. When the games is finished mp_timelimit is set to 2min~ to change the map.

Bugsy 03-22-2009 15:00

Re: Hud msg & timeleft help
 
I wrote a similar plugin for a member that will start the countdown when there are 10 seconds left and make any alive players explode at round end. You can modify it for what you need.

http://forums.alliedmods.net/showthread.php?t=85354

BeasT 03-23-2009 10:57

Re: Hud msg & timeleft help
 
I'm not that good at coding. I just need a simple plugin as I wrote above. Someone? :)

Bugsy 03-23-2009 11:29

Re: Hud msg & timeleft help
 
It seems as if there is a 12 second offset from the start of map to when the actual map-time countdown begins. This is probably caused by the restarting of map when all players connect after a map change and "game commencing" appears. There is probably a calculation method used to determine this number but it is consistently 12 seconds on my server.

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 

    
register_plugin"Map Time Left" "0.1" "bugsy" );
    
set_task( ( get_cvar_float("mp_timelimit") * 60.0 ) - 108.0 "set_timer" );
}

public 
show_timer()

    new 
szNextMap[32];
    
    
get_cvar_string"amx_nextmap" szNextMap 31 );
    new 
iTimeLeft get_timeleft();
    
    
set_hudmessage255 255 255 0.75 0.05 1.0 1.0 0.1 0.2 13 ); 
    
show_hudmessage"Time remaining: %d:%02d^nNext map: %s" iTimeLeft 60 iTimeLeft 60 szNextMap );
    
    return 
PLUGIN_CONTINUE 


public 
set_timer()
{
    
set_task1.0 "show_timer" ___"b" );




All times are GMT -4. The time now is 08:58.

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