View Single Post
Author Message
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 08-01-2022 , 13:19   Is there a native to pause timer
Reply With Quote #1

Hello Everyone,

I want an easy way to pause and resume timer, lets take this script by "RU_6uK" as an example

PHP Code:
float g_fSeconds;
bool g_bRoundEnd;

public 
void OnPluginStart()
{
    
HookEvent("player_left_safe_area"Event_LeftStartArea);
    
HookEvent("round_end"Event_RoundEnd);

    
RegConsoleCmd("sm_duration"Command_Duration"Display Round Duration To Chat");
}

public 
Action Event_LeftStartArea(Event event, const char[] namebool dontBroadcast)
{
    
g_fSeconds GetEngineTime();
    
g_bRoundEnd false;
    return 
Plugin_Handled;
}

public 
Action Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    if(!
g_bRoundEndg_bRoundEnd true;    
    return 
Plugin_Handled;
}

public 
Action Command_Duration(int clientint args)
{
    
int secDiff RoundToFloor(GetEngineTime() - g_fSeconds);
    
ReplyToCommand(client"\x04Round Duration: \x03%i min %i sec"secDiff 60secDiff 60);
    return 
Plugin_Handled;

Any method to pause it, is acceptable, with a command or event

Thanks

Last edited by alasfourom; 12-26-2022 at 04:18.
alasfourom is offline