Raised This Month: $ Target: $400
 0% 

[L4D2] Round Duration (Timer)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 05-23-2022 , 12:59   Re: [L4D2] Round Duration (Timer)
Reply With Quote #9

Updating it, and adding "sm_duration" command

PHP Code:
float g_fSeconds;
bool g_bRoundEnd;

public 
Plugin myinfo 
{
    
name "Round Duration",
    
author "RU_6uK, alasfourom",
    
description "Print Current Round Duration",
    
version "1.0",
    
url "https://forums.alliedmods.net/"
};

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);

    
RegConsoleCmd("sm_duration"Duration"Print Round Duration To Chat");
}

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

public 
Action 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;
}

//Printing Round Duration At The End Of The Round
public Action Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    if(!
g_bRoundEnd) {
        
int secDiff RoundToFloor(GetEngineTime() - g_fSeconds);
        
PrintToChatAll("\x04Round Duration: \x03%i min %i sec"secDiff 60secDiff 60);
        
g_bRoundEnd true;
    }
    return 
Plugin_Handled;

Attached Files
File Type: sp Get Plugin or Get Source (Round Duration.sp - 435 views - 1.2 KB)

Last edited by alasfourom; 06-29-2022 at 17:20.
alasfourom 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 04:47.


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