Raised This Month: $120 Target: $400
 30% 

[CS:GO] Extend round time during the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quaver
New Member
Join Date: Sep 2018
Old 09-14-2018 , 20:39   [CS:GO] Extend round time during the round
Reply With Quote #1

Is there any way to extend the round time during the round?
It's ok to just freeze the time like mm's timeout.
Thanks in advance
quaver is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 09-14-2018 , 21:40   Re: [CS:GO] Extend round time during the round
Reply With Quote #2

try this:

PHP Code:
/*
 * Extend Round Time Plugin.
 * by: shanapu
 * https://github.com/shanapu/
 * 
 * Copyright (C) 2016-2018 Thomas Schmidt (shanapu)
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

/******************************************************************************
                   STARTUP
******************************************************************************/

// Includes
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>

// Compiler Options
#pragma semicolon 1
#pragma newdecls required

// Console Variables
ConVar gc_bExtend;
ConVar gc_iExtendLimit;
ConVar gc_sCustomCommandExtend;

// Extern Convars
//ConVar g_iMPRoundTime;

// Integers
int g_iExtendNumber[MAXPLAYERS+1];

public 
Plugin myinfo = {
    
name "Extend round time",
    
author "shanapu",
    
description "Admins can extend round time",
    
version "1.3",
    
url "https://github.com/shanapu"
};

// Start
public void OnPluginStart()
{
    
// Client commands
    
RegConsoleCmd("sm_extend"Command_ExtendRoundTime"Allows the admins to extend the roundtime");

    
// AutoExecConfig
    
gc_bExtend CreateConVar("sm_extend_plugin""1""0 - disabled, 1 - Allows the admin to extend the roundtime"_true0.0true1.0);
    
gc_iExtendLimit CreateConVar("sm_extend_limit""2""How many time a admin can extend the round?"_true1.0);
    
gc_sCustomCommandExtend CreateConVar("sm_cmds_extend""extendtime, moretime""Set your custom chat commands for extend time.(!extend (no 'sm_'/'!')(seperate with comma ', ')(max. 12 commands))");

    
// Hooks
    
HookEvent("round_start"ExtendTime_Event_RoundStart);
}

/******************************************************************************
                   COMMANDS
******************************************************************************/

public Action Command_ExtendRoundTime(int clientint args)
{
    if (
gc_bExtend.BoolValue)
    {
        if (
CheckCommandAccess(client"extend_access"ADMFLAG_BANfalse))
        {
            if (
g_iExtendNumber[client] > 0)
            {
                
Menu menu = new Menu(Handler_ExtendRoundTime);
                
menu.SetTitle("Extend Time");
                
menu.AddItem("120""2 Minutes");
                
menu.AddItem("180""3 Minutes");
                
menu.AddItem("300""5 Minutes");
                
menu.ExitBackButton true;
                
menu.ExitButton true;
                
menu.Display(client20);
            }
            else 
ReplyToCommand(client"You already extended the round %i times"gc_iExtendLimit.IntValue);
        }
        else 
ReplyToCommand(client"No access to this command");
    }

    return 
Plugin_Handled;
}

/******************************************************************************
                   EVENTS
******************************************************************************/

public void ExtendTime_Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i))
            continue;

        
g_iExtendNumber[i] = gc_iExtendLimit.IntValue;
    }

}

/******************************************************************************
                   FUNCTIONS
******************************************************************************/

public Action ExtendTime(int clientint args)
{
    
GameRules_SetProp("m_iRoundTime"GameRules_GetProp("m_iRoundTime"40) + args40true);
    
int extendminute = (args/60);

    
PrintToChatAll("%N extended the round for %i minutes"clientextendminute);

    return 
Plugin_Handled;
}

/******************************************************************************
                   MENUS
******************************************************************************/

public int Handler_ExtendRoundTime(Menu menuMenuAction actionint clientint selection)
{
    if (
action == MenuAction_Select)
    {
        
char info[32];
        
menu.GetItem(selectioninfosizeof(info));

        if (
strcmp(info"120") == 0)
        {
            
ExtendTime(client120);
        }
        else if (
strcmp(info"180") == 0)
        {
            
ExtendTime(client180);
        }
        else if (
strcmp(info"300") == 0)
        {
            
ExtendTime(client300);
        }

        
g_iExtendNumber[client]--;
    }
    else if (
action == MenuAction_Cancel)
    {
        
delete menu;
    }
    else if (
action == MenuAction_End)
    {
        
delete menu;
    }
}

/******************************************************************************
                   FORWARDS LISTENING
******************************************************************************/

public void OnConfigsExecuted()
{
    
// Set custom Commands
    
int iCount 0;
    
char sCommands[128], sCommandsL[12][32], sCommand[32];

    
// extend time
    
gc_sCustomCommandExtend.GetString(sCommandssizeof(sCommands));
    
ReplaceString(sCommandssizeof(sCommands), " """);
    
iCount ExplodeString(sCommands","sCommandsLsizeof(sCommandsL), sizeof(sCommandsL[]));

    for (
int i 0iCounti++)
    {
        
Format(sCommandsizeof(sCommand), "sm_%s"sCommandsL[i]);
        if (
GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS)  // if command not already exist
            
RegConsoleCmd(sCommandCommand_ExtendRoundTime"Allows admin to extend the roundtime");
    }

Attached Files
File Type: sp Get Plugin or Get Source (extend.sp - 66 views - 5.6 KB)
__________________
free software
coding
shanapu is offline
Reply


Thread Tools
Display Modes

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 00:26.


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