Hi,
this problem is partially mentioned by Silvers in his
Cvar Configs Updater (see item 3.3) and still actual.
I did tons of server reboots to find out the possible cause and solution.
Here is what I have.
1) Two identical plugins with different names and cfg/cvar names:
a.
Code:
#define PLUGIN_VERSION "1.0"
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#define CVAR_FLAGS FCVAR_NOTIFY
ConVar g_hCvarNotify;
bool g_bNotify;
public Plugin myinfo =
{
name = "[L4D] CVar update test",
author = "Dragokas",
description = "",
version = PLUGIN_VERSION,
url = ""
}
public Action CmdMessage(int client, int args)
{
PrintToChat(client, "[TEST] %b", g_bNotify);
return Plugin_Handled;
}
public Action CmdUpdate(int client, int args)
{
GetCvars();
PrintToChat(client, "[CVAR_TEST] Variables are updated.");
return Plugin_Handled;
}
public void OnPluginStart()
{
RegAdminCmd("sm_cvar_notify", CmdMessage, ADMFLAG_ROOT);
RegAdminCmd("sm_cvar_update", CmdUpdate, ADMFLAG_ROOT);
g_hCvarNotify = CreateConVar( "l4d_cvar_test_notify", "1", "0=Off, 1=On", CVAR_FLAGS);
AutoExecConfig(true, "l4d_cvar_test");
g_hCvarNotify.AddChangeHook(ConVarChanged_Cvars);
GetCvars();
}
public void OnConfigsExecuted()
{
GetCvars();
}
public void ConVarChanged_Cvars(Handle convar, const char[] oldValue, const char[] newValue)
{
GetCvars();
}
void GetCvars()
{
g_bNotify = g_hCvarNotify.BoolValue;
}
b.
Code:
#define PLUGIN_VERSION "1.0"
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#define CVAR_FLAGS FCVAR_NOTIFY
ConVar g_hCvarNotify;
bool g_bNotify;
public Plugin myinfo =
{
name = "[L4D] CVar update test2",
author = "Dragokas",
description = "",
version = PLUGIN_VERSION,
url = ""
}
public Action CmdMessage(int client, int args)
{
PrintToChat(client, "[GEAR] %b", g_bNotify);
return Plugin_Handled;
}
public Action CmdUpdate(int client, int args)
{
GetCvars();
PrintToChat(client, "[GEAR] Variables are updated.");
return Plugin_Handled;
}
public void OnPluginStart()
{
RegAdminCmd("sm_gear_notify", CmdMessage, ADMFLAG_ROOT);
RegAdminCmd("sm_gear_update", CmdUpdate, ADMFLAG_ROOT);
g_hCvarNotify = CreateConVar( "l4d_cvar_gear_notify", "1", "0=Off, 1=On", CVAR_FLAGS);
AutoExecConfig(true, "l4d_gear_transfer");
g_hCvarNotify.AddChangeHook(ConVarChanged_Cvars);
GetCvars();
}
public void OnConfigsExecuted()
{
GetCvars();
}
public void ConVarChanged_Cvars(Handle convar, const char[] oldValue, const char[] newValue)
{
GetCvars();
}
void GetCvars()
{
g_bNotify = g_hCvarNotify.BoolValue;
}
Contents of cfgs:
Quote:
// This file was auto-generated by SourceMod (v1.10.0.6276)
// ConVars for plugin "l4d_cvar_test.smx"
// 0=Off, 1=On
// -
// Default: "1"
l4d_cvar_test_notify "0"
|
Quote:
// This file was auto-generated by SourceMod (v1.10.0.6276)
// ConVars for plugin "l4d_gear_transfer.smx"
// 0=Off, 1=On
// -
// Default: "1"
l4d_cvar_gear_notify "0"
|
Command:
Code:
sm_cvar_notify; sm_gear_notify
returns:
But should be identical values.
Used sm: 1.8 official and 1.10.0.6276 self-built.
Temporarily fix:
1. Bug is disappering after I comment/delete (almost) any line from server.cfg.
2. It also disappearing if I move several lines from server.cfg to separate file and execute it from server.cfg by:
3. In some cases Silver's plugin with sm_configs_comment "1" can help (not in my case) (it comment default values of ./cfg/sourcemod/*.cfg).
4. For some plugins map reload can help.
Can you fix it in sm core?
__________________