Raised This Month: $ Target: $400
 0% 

[HELP] How i can stop the Roundtime clock?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-10-2010 , 07:29   Re: [HELP] How i can stop the Roundtime clock?
Reply With Quote #2

Yes and no.

Use set_task() or something to constantly set the roundtimer to your desired value... that won't block round-end stuff... like "target saved", or "hostages have not been saved".

You can't actually detect the timer's actual time... you can detect it's start time (by hooking the event) and calculate.

Something like this:

PHP Code:
#include <amxmodx>

new bool:g_bPaused false

new Float:g_fTimerStart

new gMsg_RoundTime

public plugin_init()
{
      
register_event("RoundTime""event_roundTime""a")
      
register_clcmd("test""cmd_test")
      
register_clcmd("pausetimer""cmd_pausetimer")

      
gMsg_RoundTime get_user_msgid("RoundTime")
}

public 
event_roundTime()
{
      
g_fTimerStart = (read_data(1) ? get_gametime() : 0.0)
}

public 
cmd_test(id)
{
      if(
g_fTimerStart)
             
client_print(0print_chat"[debug] timer at: %.1f"get_gametime() - g_fTimerStart)
      else
             
client_print(0print_chat"[debug] timer not started")
}

public 
cmd_pausetimer(id)
{
      if(
g_bPaused)
            
event_pauseTimer(00)
      else
            
event_pauseTimer(1floatround(get_gametime() - g_fTimerStart))

      
client_print(idprint_chat"timer %s"g_bPaused "unpaused" "paused")

      
g_bPaused = !g_bPaused
}

public 
event_pauseTimer(iPauseiAt)
{
      if(!
iPause)
      {
            
remove_task(1)
            return
      }

      static 
iPauseAt

      
if(iAt)
           
iPauseAt iAt

      message_begin
(MSG_ALLgMsg_RoundTime)
      
write_short(iPauseAt)
      
message_end()

      
set_task(0.8"event_pauseTimer"1/* don't set task to 0, you can set it to anything but 0.. even negative values */

Code NOT tested in-game, but compiles.
__________________

Last edited by Hunter-Digital; 07-10-2010 at 07:47.
Hunter-Digital is offline
 



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 07:11.


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