Edit: I believe this answers my question:
https://forums.alliedmods.net/showthread.php?t=92289
Pardon me, should've googled more intensively before making a thread.
I'm trying to toggle whether or not the cvar "fog_enable" is sv_cheats protected or not. Tried following the wiki at
https://wiki.alliedmods.net/ConVars_...pting%29#Flags but I'm getting this error:
Quote:
[SM] Native "GetConVarFlags" reported: Invalid convar handle 0 (error 4)
[SM] Displaying call stack trace for plugin "flagstest.smx":
[SM] [0] Line 21, flagstest.sp::UnsetCheatVar()
[SM] [1] Line 14, flagstest.sp::Command_Fog()
|
Here's my code:
Code:
#include <sourcemod>
new Handle:fogEnable;
public OnPluginStart()
{
fogEnable = FindConVar("fog_enable");
RegConsoleCmd("sm_fog_test", Command_Fog);
}
public Action:Command_Fog(client, args)
{
UnsetCheatVar(fogEnable);
PrintToChat(client, "fog_enable should no longer be sv_cheats protected.");
return Plugin_Handled;
}
UnsetCheatVar(Handle:hndl)
{
new flags = GetConVarFlags(hndl);
flags &= ~FCVAR_CHEAT;
SetConVarFlags(hndl, flags);
}
I'm assuming this is because FindConVar("fog_enable") doesn't find the cvar. Why is that? Am I doing something wrong?