Hello, I've tried looking at the docs and
the wiki, as well as a number of searches, and I still have no idea what I'm doing wrong.
I want to make a custom convar called
myplugin_verbose_logging, that my plugin will be able to read.
I have the following code:
Code:
new g_iVerboseMode = 0;
public OnConfigsExecuted()
{
new Handle:hCreateVerboseConvar = CreateConVar("myplugin_verbose_logging", "0", "Determines whether to use verbose logging");
AutoExecConfig(true, "myplugin");
if(hCreateVerboseConvar != INVALID_HANDLE)
{
g_iVerboseMode = GetConVarInt(FindConVar("myplugin_verbose_logging"));
LogMessage("Verbose mode: %i", g_iVerboseMode);
}
else
{
LogMessage("Error creating verbose mode convar");
}
}
I restarted the server and look in
/orangebox/cstrike/cfg/sourcemod/ and
myplugin.cfg is nowhere to be found, which I believe contradicts the true in the first argument (
bool:autoCreate) of
AutoExecConfig(), according to the docs page
here.
So, I figured that perhaps
AutoExecConfig() failed to create the file for some reason, so I created it myself (
/orangebox/cstrike/cfg/sourcemod/myplugin.cfg) with the following contents:
Code:
myplugin_verbose_logging "1"
I restarted the server and now look in the sourcemod logs in
/orangebox/cstrike/addons/sourcemod/logs/ and read what was outputted using
LogMessage() in the above code. It says:
Verbose mode: 0
There are no errors at all. Its just not reading that file as far as I can tell. It could be because I'm doing it wrong, so if someone could help me make it right, I would appreciate it greatly.
Thank you.