AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   remaining second. (https://forums.alliedmods.net/showthread.php?t=98306)

Mr.Noobie 07-24-2009 10:13

remaining second.
 
Does anyone knows how to set hudmessage to get remaining second.

meaning that it will show a hudmessage with second remaining.

ConnorMcLeod 07-24-2009 10:47

Re: remaining second.
 
PHP Code:

/* 
*  AMX X Mod script. 

* (c) Copyright 2003, ST4life 
* Remade by TaL
* This file is provided as is (no warranties). 
*/ 

#include <amxmodx>
#include <engine>

#define VERSION "0.2.0" // Revision : ConnorMcLeod
/* 
* TimeProjector displays the remaining time and the next map on the top right corner of the client 
* display as a hudmessage. 

* History: 

* v0.1: - first release 
*/
#define clamp_byte(%1)        clamp(%1, 0x00, 0xFF)
#define clamp_channel(%1)    clamp(%1, 1, 4)

new g_pCvarNextMapg_pCvarColorg_pCvarChannel

public plugin_init() 

    
register_plugin("TimeProjector"VERSION"ST4life")

    
g_pCvarNextMap get_cvar_pointer("amx_nextmap")
    
g_pCvarColor register_cvar("time_projector_color""255 255 255")
    
g_pCvarChannel register_cvar("time_projector_channel""3")

    new 
iEnt create_entity("info_target")
    
entity_set_string(iEntEV_SZ_classname"time_projector")
    
register_think("time_projector""Show_Timer")
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 1.0)


public 
Show_TimeriEnt )
{
    static 
szMessage[128], szCurTime[9], niTimeLeftszColor[12], szRed[4], szGreen[4], szBlue[4], iRediGreeniBlue

    get_time
("%H:%M:%S"szCurTimecharsmax(szCurTime))
    
iTimeLeft get_timeleft()

    
formatex(szMessagecharsmax(szMessage), "Current Time: %s^nTime remaining: %d:%02d"szCurTimeiTimeLeft 60iTimeLeft 60)
     
    if( 
g_pCvarNextMap )
    {
        static 
szNextMap[32]
        
get_pcvar_string(g_pCvarNextMapszNextMapcharsmax(szNextMap))
        
+= formatex(szMessage[n], charsmax(szMessage)-n"^nNext map: %s"szNextMap)
    }

    
get_pcvar_string(g_pCvarColorszColorcharsmax(szColor))
    
parse(szColorszRedcharsmax(szRed), szGreencharsmax(szGreen), szBluecharsmax(szBlue))
    
iRed clamp_bytestr_to_num(szRed) )
    
iGreen clamp_bytestr_to_num(szGreen) )
    
iBlue clamp_bytestr_to_num(szBlue) )

    
set_hudmessage(iRediGreeniBlue0.750.0500.01.00.00.0clamp_channelget_pcvar_num(g_pCvarColor) )) 
    
show_hudmessage(0szMessage

    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 1.0)



ƒa†es™ 07-24-2009 11:20

Re: remaining second.
 
Mr.Noobie means he want a plugin that can show hudmessage during a duration of event.

Example:

warm up round show hudmessage second remaining before restarting the round.

I think he want the remaining seconds.

Mr.Noobie 07-24-2009 11:30

Re: remaining second.
 
Quote:

Originally Posted by ƒa†es™ (Post 880678)
Mr.Noobie means he want a plugin that can show hudmessage during a duration of event.

Example:

warm up round show hudmessage second remaining before restarting the round.

I think he want the remaining seconds.

Something like that.

I just want the code for the second remaining before an event.

ConnorMcLeod 07-24-2009 11:32

Re: remaining second.
 
Before which event ?
Could you be more descriptive ?

Mr.Noobie 07-24-2009 12:07

Re: remaining second.
 
Quote:

Originally Posted by ConnorMcLeod (Post 880682)
Before which event ?
Could you be more descriptive ?

I means

Example.

Starting Match is a warm up round during the warm up round there will be a hudmessage showing the remaining second before restarting the round.

I want the remaining second in hudmessage codes.


All times are GMT -4. The time now is 18:29.

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