Raised This Month: $32 Target: $400
 8% 

Execute Configs 1.0 (Updated 08/12/09)


Post New Thread Reply   
 
Thread Tools Display Modes
Arthedains
Junior Member
Join Date: Nov 2016
Location: Europe
Old 06-07-2018 , 13:25   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #171

hi, thank you. Is it possible to get this to work with dead players team rather than spectators? I would love to have this for my l4d1 server. thank you for your effort or any ideas how to add this.
Arthedains is offline
ownage13
AlliedModders Donor
Join Date: Apr 2015
Old 07-24-2018 , 20:06   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #172

Quote:
Originally Posted by Ahava View Post
Hello,

I'm trying to use executeconfig so that it executes a new mode for "Deathmatch Goes Advanced" after a few minutes pass. Unfortunately it doesn't really work for me, the configs just don't get executed. I can execute them fine manually though.

Here's my config:
Code:
"Configs"
{
	"*"
	{
		"timeleft:1560"			"1:dm_pistol_normal.cfg"
		"timeleft:1260"			"1:dm_forcebuy.cfg"
		"timeleft:1080"			"1:dm_rifles.cfg"
		"timeleft:240"			"1:dm_rifles_hs.cfg"
	}
}
Thanks in advance for any help!

EDIT: Ejziponken helped me solve it. Timeleft is given in minutes, not seconds.
I'm trying to do the same thing with my setup but I am lost on how to set this up correctly. Is there anyone here who can help me setup my cfg's properly?
ownage13 is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 11-05-2018 , 09:54   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #173

Quote:
Originally Posted by ownage13 View Post
I'm trying to do the same thing with my setup but I am lost on how to set this up correctly. Is there anyone here who can help me setup my cfg's properly?
Example:
Code:
"Configs"
{
	"de_dust2"
	{
		"timeleft:15"	"1:dm_akcolt.cfg"
		"timeleft:10"	"1:dm_pistol.cfg"
		"timeleft:5"	"1:dm_akcolt_hs.cfg"
	}
	
	"de_mirage"
	{
		"timeleft:15"	"1:dm_akcolt.cfg"
		"timeleft:10"	"1:dm_pistol.cfg"
		"timeleft:5"	"1:dm_akcolt_hs.cfg"
	}
	
	"de_cache"
	{
		"timeleft:15"	"1:dm_akcolt.cfg"
		"timeleft:10"	"1:dm_pistol.cfg"
		"timeleft:5"	"1:dm_akcolt_hs.cfg"
	}
}
And then you have to create the CFGs and put them in same folder as server.cfg (csgo/cfg)

dm_akcolt.cfg:
Code:
dm_load "Game Modes" "Ak Colt" equip
The "Game Modes" are from deathmatch.ini (NOT the simple one) (https://forums.alliedmods.net/showpo...postcount=2427)

EDIT:
A better way to do this is:
https://forums.alliedmods.net/showthread.php?t=317289

Last edited by Ejziponken; 07-06-2019 at 08:48.
Ejziponken is offline
Le1T
Member
Join Date: Oct 2018
Old 02-23-2019 , 12:20   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #174

not creating a .cfg file auto.

where can i find this commands?

Quote:
sm_executeconfigs_enabled (0/1, def 1)
Enable/disable executing configs. The plugin will keep counting the rounds and timeleft when it's disabled, but it will only actually execute the configs when it's enabled.

sm_executeconfigs_include_bots (0/1, def. 1)
Enable/disable including bots when counting number of clients. This will allow you to disable counting fake clients as normal clients.

sm_executeconfigs_include_spec (0/1, def. 1)
Enable/disable including spectators when counting number of clients. This will allow you to disable counting spectators as normal clients.

sm_executeconfigs_reload
Server command to reload the configs from executeconfigs.txt.
Le1T is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-23-2019 , 13:45   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #175

Quote:
Originally Posted by Le1T View Post
not creating a .cfg file auto.

where can i find this commands?
Attached Files
File Type: sp Get Plugin or Get Source (executeconfigs.sp - 627 views - 6.8 KB)
__________________
Taking paid private requests! Contact me
Cruze is offline
Le1T
Member
Join Date: Oct 2018
Old 02-25-2019 , 10:23   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #176


thx, it works
Le1T is offline
gildevanaraujo
Senior Member
Join Date: Oct 2018
Location: Brazil
Old 03-09-2019 , 10:53   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #177

Mine still does not work. I noticed in the console that the following message appears.

Code:
exec //*/cfg/sourcemod\plugin.executeconfigs.cfg: invalid file type.
What can this be? And I have this normal file.
gildevanaraujo is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 04-12-2019 , 17:19   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #178

The plugin could not determine the number of rounds correctly. I fixed it. Can you update the codes according to the new syntax?

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define CLIENTS        0
#define EVENT            1
#define ROUND            2
#define TIMELEFT    3
#define TOTAL            4

#define PL_VERSION "1.0.1"

public Plugin:myinfo =
{
  
name        "Execute Configs",
  
author      "Tsunami",
  
description "Execute configs on certain events.",
  
version     PL_VERSION,
  
url         "http://www.tsunami-productions.nl"
};


/**
 * Globals
 */
new g_iRound;
new 
bool:g_bSection;
new 
Handle:g_hConfigParser;
new 
Handle:g_hEnabled;
new 
Handle:g_hIncludeBots;
new 
Handle:g_hIncludeSpec;
new 
Handle:g_hTimer;
new 
Handle:g_hTimers[TOTAL];
new 
Handle:g_hTries[TOTAL];
new 
Handle:g_hTypes;
new 
String:g_sConfigFile[PLATFORM_MAX_PATH 1];
new 
String:g_sMap[32];
Handle g_hCvRestart;

/**
 * Forwards
 */
public OnPluginStart()
{
    
CreateConVar("sm_executeconfigs_version"PL_VERSION"Execute configs on certain events."FCVAR_NOTIFY);
    
g_hEnabled      CreateConVar("sm_executeconfigs_enabled",      "1""Enable/disable executing configs");
    
g_hIncludeBots  CreateConVar("sm_executeconfigs_include_bots""1""Enable/disable including bots when counting number of clients");
    
g_hIncludeSpec  CreateConVar("sm_executeconfigs_include_spec""1""Enable/disable including spectators when counting number of clients");
    
    
g_hCvRestart FindConVar("mp_restartgame");
    
HookConVarChange(g_hCvRestartlazCvarChange);
    
    
BuildPath(Path_SMg_sConfigFilesizeof(g_sConfigFile), "configs/executeconfigs.txt");
    
RegServerCmd("sm_executeconfigs_reload"Command_Reload"Reload the configs");
    
    
g_hConfigParser SMC_CreateParser();
    
SMC_SetReaders(g_hConfigParserReadConfig_NewSectionReadConfig_KeyValueReadConfig_EndSection);
    
    
g_hTypes        CreateTrie();
    
SetTrieValue(g_hTypes"clients",  CLIENTS);
    
SetTrieValue(g_hTypes"event",    EVENT);
    
SetTrieValue(g_hTypes"round",    ROUND);
    
SetTrieValue(g_hTypes"timeleft"TIMELEFT);
    
    for(new 
0TOTALi++)
        
g_hTries[i] = CreateTrie();
    
    
decl String:sGameDir[64];
    
GetGameFolderName(sGameDirsizeof(sGameDir));
    
    if(
StrEqual(sGameDir"insurgency"))
        
HookEvent("game_newmap",            Event_GameStart,  EventHookMode_PostNoCopy);
    else
        
HookEvent("game_start",             Event_GameStart,  EventHookMode_PostNoCopy);
    
    if(
StrEqual(sGameDir"dod"))
        
HookEvent("dod_round_start",        Event_RoundStartEventHookMode_PostNoCopy);
    else if(
StrEqual(sGameDir"tf"))
    {
        
HookEvent("teamplay_restart_round"Event_GameStart,  EventHookMode_PostNoCopy);
        
HookEvent("teamplay_round_start",   Event_RoundStartEventHookMode_PostNoCopy);
    }
    else
        
HookEvent("round_start",            Event_RoundStartEventHookMode_PostNoCopy);
}

public 
OnMapStart()
{
    
g_iRound 0;
    
g_hTimer INVALID_HANDLE;
    
    for(new 
0TOTALi++)
        
g_hTimers[i] = INVALID_HANDLE;
    
    
GetCurrentMap(g_sMapsizeof(g_sMap));
    
ParseConfig();
}

public 
void OnMapEnd()
{
    
g_iRound 0;
}

public 
OnMapTimeLeftChanged()
{
    if(
g_hTimer)
    {
        
CloseHandle(g_hTimer);
        
g_hTimer INVALID_HANDLE;
    }
    
    new 
iTimeleft;
    if(
GetMapTimeLeft(iTimeleft) && iTimeleft 0)
        
g_hTimer CreateTimer(60.0Timer_ExecTimeleftConfig_TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
}

public 
OnClientPutInServer(client)
{
  
ExecClientsConfig(0);
}

public 
OnClientDisconnect(client)
{
  
ExecClientsConfig(-1);
}


/**
 * Commands
 */
public Action:Command_Reload(args)
{
    
ParseConfig();
}


/**
 * Events
 */
public Event_GameStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
g_iRound 0;
}

public 
Event_Hook(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(
GetConVarBool(g_hEnabled))
        
ExecConfig(EVENTname);
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") == 0)
    {
        
g_iRound++;
        if(!
GetConVarBool(g_hEnabled))
        return;
        
decl String:sRound[4];
        
IntToString(g_iRoundsRoundsizeof(sRound));
        
ExecConfig(ROUNDsRound);
    }
}

public 
void lazCvarChangeHandle hCvar, const char[] sOldValue, const char[] sNewValue )
{
    if( 
StringToInt(sNewValue) > g_iRound 0;
}

/**
 * Timers
 */
public Action:Timer_ExecConfig(Handle:timerany:pack)
{
    
ResetPack(pack);
    
    
decl String:sConfig[32];
    new 
iType ReadPackCell(pack);
    
ReadPackString(packsConfigsizeof(sConfig));
    
    
ServerCommand("exec %s"sConfig);
    
g_hTimers[iType] = INVALID_HANDLE;
}

public 
Action:Timer_ExecTimeleftConfig(Handle:timer)
{
    if(!
GetConVarBool(g_hEnabled))
        return 
Plugin_Handled;
    
    new 
iTimeleft;
    if(!
GetMapTimeLeft(iTimeleft) || iTimeleft 0)
        return 
Plugin_Handled;
    
    
decl String:sTimeleft[4];
    
IntToString(iTimeleft 60sTimeleftsizeof(sTimeleft));
    
ExecConfig(TIMELEFTsTimeleft);
    
    return 
Plugin_Handled;
}


/**
 * Config Parser
 */
public SMCResult:ReadConfig_EndSection(Handle:smc) {}

public 
SMCResult:ReadConfig_KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotesbool:value_quotes)
{
    if(!
g_bSection || !key[0])
        return 
SMCParse_Continue;
    
    
decl iTypeString:sKeys[2][32];
    
ExplodeString(key":"sKeyssizeof(sKeys), sizeof(sKeys[]));
    if(!
GetTrieValue(g_hTypessKeys[0], iType))
        return 
SMCParse_Continue;
    
    
SetTrieString(g_hTries[iType], sKeys[1], value);
    if(
iType == EVENT)
        
HookEvent(sKeys[1], Event_Hook);
    
    return 
SMCParse_Continue;
}

public 
SMCResult:ReadConfig_NewSection(Handle:smc, const String:name[], bool:opt_quotes)
{
    
g_bSection StrEqual(name"*") || strncmp(g_sMapnamestrlen(name), false) == 0;
}


/**
 * Stocks
 */
ExecClientsConfig(iClients)
{
    if(!
GetConVarBool(g_hEnabled))
        return;
    
    new 
bool:bIncludeBots GetConVarBool(g_hIncludeBots);
    new 
bool:bIncludeSpec GetConVarBool(g_hIncludeSpec);
    if(
bIncludeBots && bIncludeSpec)
        
iClients += GetClientCount();
    else
    {
        for(new 
1<= MaxClientsi++)
        {
            if(!
IsClientInGame(i))
                continue;
            
            new 
bool:bBot  IsFakeClient(i);
            new 
bool:bSpec IsClientObserver(i);
            if((!
bBot && !bSpec) ||
                (
bIncludeBots && bBot) ||
                (
bIncludeSpec && bSpec))
                
iClients++;
        }
    }
    
    
decl String:sClients[4];
    
IntToString(iClientssClientssizeof(sClients));
    
ExecConfig(CLIENTSsClients);
}

ExecConfig(iType, const String:sKey[])
{
    
decl String:sValue[64];
    if(!
GetTrieString(g_hTries[iType], sKeysValuesizeof(sValue)))
        return;
    
    
decl String:sValues[2][32];
    
ExplodeString(sValue":"sValuessizeof(sValues), sizeof(sValues[]));
    
    new 
Handle:hPack CreateDataPack();
    
WritePackCell(hPack,   iType);
    
WritePackString(hPacksValues[1]);
    
g_hTimers[iType] = CreateTimer(StringToFloat(sValues[0]), Timer_ExecConfighPackTIMER_DATA_HNDL_CLOSE|TIMER_FLAG_NO_MAPCHANGE);
}

ParseConfig()
{
    if(!
FileExists(g_sConfigFile))
        
SetFailState("File Not Found: %s"g_sConfigFile);
    
    for(new 
0TOTALi++)
        
ClearTrie(g_hTries[i]);
    
    new 
SMCError:iError SMC_ParseFile(g_hConfigParserg_sConfigFile);
    if(
iError)
    {
        
decl String:sError[64];
        if(
SMC_GetErrorString(iErrorsErrorsizeof(sError)))
            
LogError(sError);
        else
            
LogError("Fatal parse error");
        return;
    }

__________________
alphaearth is offline
Le1T
Member
Join Date: Oct 2018
Old 06-27-2019 , 14:28   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #179

L 06/27/2019 - 20:595: SourceMod error session started
L 06/27/2019 - 20:595: Info (map "awp_lego_2d") (file "errors_20190627.log")
L 06/27/2019 - 20:595: [SM] Exception reported: Handle 9db80490 is invalid (error 3)
L 06/27/2019 - 20:595: [SM] Blaming: executeconfigs.smx
L 06/27/2019 - 20:595: [SM] Call stack trace:
L 06/27/2019 - 20:595: [SM] [0] CloseHandle
L 06/27/2019 - 20:595: [SM] [1] Line 100, /home/forums/content/files/3/4/6/6/8/24085.attach::OnMapTimeLeftChanged
L 06/27/2019 - 20:596: [SM] Exception reported: Handle 9db80490 is invalid (error 3)
L 06/27/2019 - 20:596: [SM] Blaming: executeconfigs.smx
L 06/27/2019 - 20:596: [SM] Call stack trace:
L 06/27/2019 - 20:596: [SM] [0] CloseHandle
L 06/27/2019 - 20:596: [SM] [1] Line 100, /home/forums/content/files/3/4/6/6/8/24085.attach::OnMapTimeLeftChanged
L 06/27/2019 - 21:20:10: Error log file session closed.
L 06/27/2019 - 21:20:10: SourceMod error session started
L 06/27/2019 - 21:20:10: Info (map "$2018$_final") (file "errors_20190627.log")
L 06/27/2019 - 21:20:10: [SM] Exception reported: Handle a9e80490 is invalid (error 3)
L 06/27/2019 - 21:20:10: [SM] Blaming: executeconfigs.smx
L 06/27/2019 - 21:20:10: [SM] Call stack trace:
L 06/27/2019 - 21:20:10: [SM] [0] CloseHandle
L 06/27/2019 - 21:20:10: [SM] [1] Line 100, /home/forums/content/files/3/4/6/6/8/24085.attach::OnMapTimeLeftChanged
L 06/27/2019 - 21:20:10: [SM] Exception reported: Handle a9e80490 is invalid (error 3)
L 06/27/2019 - 21:20:10: [SM] Blaming: executeconfigs.smx
L 06/27/2019 - 21:20:10: [SM] Call stack trace:
L 06/27/2019 - 21:20:10: [SM] [0] CloseHandle
L 06/27/2019 - 21:20:10: [SM] [1] Line 100, /home/forums/content/files/3/4/6/6/8/24085.attach::OnMapTimeLeftChanged
Le1T is offline
gildevanaraujo
Senior Member
Join Date: Oct 2018
Location: Brazil
Old 07-12-2019 , 10:50   Re: Execute Configs 1.0 (Updated 08/12/09)
Reply With Quote #180

I have a question about this plugin ...
When I use the command manually "dm_load" "Game Modes""AWP" respawn (for exemple) in the console via rcon it works perfectly and the plugin does not seem to work? What am I doing wrong? Can anyone help me?

Here is my list of executeconfigs.txt

Code:
"Configs"
{
	"*"
	{
		"timeleft:59"		"1:kgs_rifles.cfg"
		"timeleft:56"		"30:kgs_30seg.cfg"
		"timeleft:56"		"45:kgs_15seg.cfg"
		"timeleft:55"		"1:kgs_normal.cfg"
		"timeleft:51"		"30:kgs_30seg.cfg"
		"timeleft:51"		"45:kgs_15seg.cfg"
		"timeleft:50"		"1:kgs_awp.cfg"
		"timeleft:46"		"30:kgs_30seg.cfg"
		"timeleft:46"		"45:kgs_15seg.cfg"
		"timeleft:45"		"1:kgs_pistol.cfg"
		"timeleft:41"		"30:kgs_30seg.cfg"
		"timeleft:41"		"45:kgs_15seg.cfg"
		"timeleft:40"		"1:kgs_rifles_hs.cfg"
		"timeleft:36"		"30:kgs_30seg.cfg"
		"timeleft:36"		"45:kgs_15seg.cfg"
		"timeleft:35"		"1:kgs_pistol_hs.cfg"
		"timeleft:31"		"30:kgs_30seg.cfg"
		"timeleft:31"		"45:kgs_15seg.cfg"
		"timeleft:30"		"1:kgs_rifles.cfg"
		"timeleft:26"		"30:kgs_30seg.cfg"
		"timeleft:26"		"45:kgs_15seg.cfg"
		"timeleft:25"		"1:kgs_normal.cfg"
		"timeleft:21"		"30:kgs_30seg.cfg"
		"timeleft:21"		"45:kgs_15seg.cfg"
		"timeleft:20"		"1:kgs_awp.cfg"
		"timeleft:16"		"30:kgs_30seg.cfg"
		"timeleft:16"		"45:kgs_15seg.cfg"
		"timeleft:15"		"1:kgs_pistol.cfg"
		"timeleft:11"		"30:kgs_30seg.cfg"
		"timeleft:11"		"45:kgs_15seg.cfg"
		"timeleft:10"		"1:kgs_rifles_hs.cfg"
		"timeleft:6"		"30:kgs_30seg.cfg"
		"timeleft:6"		"45:kgs_15seg.cfg"
		"timeleft:5"		"1:kgs_rifles.cfg"
		"timeleft:2"		"30:kgs_30seg.cfg"
		"timeleft:2"		"45:kgs_15seg.cfg"
		"timeleft:1"		"1:kgs_awp.cfg"
	}
}

Last edited by gildevanaraujo; 07-12-2019 at 10:56.
gildevanaraujo is offline
Reply



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 12:47.


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