Raised This Month: $12 Target: $400
 3% 

Send commands to console in 10 rounds 1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 02-16-2019 , 08:04   Send commands to console in 10 rounds 1
Reply With Quote #1

In 10 rounds 1
How to send a command at the beginning of a round?
Can you share a sample plugin?
__________________
alphaearth is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-16-2019 , 08:36   Re: Send commands to console in 10 rounds 1
Reply With Quote #2

PHP Code:

public void OnPluginStart
{
    
HookEvent("round_start"Event_RoundStart);
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
ServerCommand("sv_cheats 1");

Nexd is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 02-16-2019 , 11:50   Re: Send commands to console in 10 rounds 1
Reply With Quote #3

can you do plugin that make a timer every 10 round?
__________________
alphaearth is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 02-16-2019 , 13:21   Re: Send commands to console in 10 rounds 1
Reply With Quote #4

Quote:
Originally Posted by alphaearth View Post
can you do plugin that make a timer every 10 round?
A timer every 10 rounds? Like this?

Spoiler
__________________
Rohanlogs is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-16-2019 , 13:40   Re: Send commands to console in 10 rounds 1
Reply With Quote #5

PHP Code:
#include <sourcemod> 

int RoundCount 0;

native GameRules_GetProp(const String:prop[], size=4element=0);

public 
void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart);
}

public 
void OnMapStart()
{
    
RoundCount=0;
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") == 0
    {
        
RoundCount++;
        if(
RoundCount == 10 || RoundCount == 20 || RoundCount == 30) {
            
ServerCommand("sv_cheats 1");
        }
    }
    else
    {
        
RoundCount=0;
    }

if its not working, edit this line:
PHP Code:
if(RoundCount == 10 || RoundCount == 20 || RoundCount == 30
to 11 21 31 etc..
Nexd is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 02-16-2019 , 14:20   Re: Send commands to console in 10 rounds 1
Reply With Quote #6

Spoiler



PHP Code:
#include <sourcemod>
#include <sdktools>
int RoundCount 0;
ConVar RestartGame;
/// native GameRules_GetProp(const String:prop[], size=4, element=0);

public void OnPluginStart()
{
    
RegAdminCmd("sm_rr"RRADMFLAG_GENERIC)
    
HookEvent("round_start"Event_RoundStart);
    
RestartGame CreateConVar("mp_restartgame""1");
    
HookConVarChange(RestartGameDetected);
    
AutoExecConfig(true"botbenson_strip""sourcemod");
}

public 
void OnMapStart()
{
    
RoundCount 0;
}

public 
Detected(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
RoundCount 0;    
}

public 
Action RR(clientargs)
{
    
ServerCommand("mp_restartgame 1");
    
RoundCount 0;    
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") == 0
    {
        
RoundCount++;
        if(
RoundCount != 10 && RoundCount != 20 && RoundCount != 30 && RoundCount != 40 && RoundCount != 50 && RoundCount != 60) {
            
ServerCommand("sm_strip @all 2");
        }
    }
    else
    {
        
RoundCount=0;
    }


I think it will work this way
__________________

Last edited by alphaearth; 02-16-2019 at 14:21.
alphaearth is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 02-16-2019 , 14:21   Re: Send commands to console in 10 rounds 1
Reply With Quote #7

Quote:
Originally Posted by Rohanlogs View Post
A timer every 10 rounds? Like this?

Spoiler
thanks
__________________
alphaearth is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 02-16-2019 , 17:59   Re: Send commands to console in 10 rounds 1
Reply With Quote #8

Quote:
Originally Posted by alphaearth View Post


PHP Code:
#include <sourcemod>
#include <sdktools>
int RoundCount 0;
ConVar RestartGame;
/// native GameRules_GetProp(const String:prop[], size=4, element=0);

public void OnPluginStart()
{
    
RegAdminCmd("sm_rr"RRADMFLAG_GENERIC)
    
HookEvent("round_start"Event_RoundStart);
    
RestartGame CreateConVar("mp_restartgame""1");
    
HookConVarChange(RestartGameDetected);
    
AutoExecConfig(true"botbenson_strip""sourcemod");
}

public 
void OnMapStart()
{
    
RoundCount 0;
}

public 
Detected(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
RoundCount 0;    
}

public 
Action RR(clientargs)
{
    
ServerCommand("mp_restartgame 1");
    
RoundCount 0;    
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") == 0
    {
        
RoundCount++;
        if(
RoundCount != 10 && RoundCount != 20 && RoundCount != 30 && RoundCount != 40 && RoundCount != 50 && RoundCount != 60) {
            
ServerCommand("sm_strip @all 2");
        }
    }
    else
    {
        
RoundCount=0;
    }


I think it will work this way
Get rid of the sm_rr, the mp_restartgame does it already and it is a bad idea to create an existing command.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 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 07:04.


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