AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Send commands to console in 10 rounds 1 (https://forums.alliedmods.net/showthread.php?t=314378)

alphaearth 02-16-2019 08:04

Send commands to console in 10 rounds 1
 
In 10 rounds 1
How to send a command at the beginning of a round?
Can you share a sample plugin?

Nexd 02-16-2019 08:36

Re: Send commands to console in 10 rounds 1
 
PHP Code:


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

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



alphaearth 02-16-2019 11:50

Re: Send commands to console in 10 rounds 1
 
can you do plugin that make a timer every 10 round?

Rohanlogs 02-16-2019 13:21

Re: Send commands to console in 10 rounds 1
 
Quote:

Originally Posted by alphaearth (Post 2639918)
can you do plugin that make a timer every 10 round?

A timer every 10 rounds? Like this?

Spoiler

Nexd 02-16-2019 13:40

Re: Send commands to console in 10 rounds 1
 
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..

alphaearth 02-16-2019 14:20

Re: Send commands to console in 10 rounds 1
 
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

alphaearth 02-16-2019 14:21

Re: Send commands to console in 10 rounds 1
 
Quote:

Originally Posted by Rohanlogs (Post 2639924)
A timer every 10 rounds? Like this?

Spoiler

thanks

eyal282 02-16-2019 17:59

Re: Send commands to console in 10 rounds 1
 
Quote:

Originally Posted by alphaearth (Post 2639931)


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.


All times are GMT -4. The time now is 07:20.

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