Quote:
Originally Posted by Crasher_3637
To add more to this, we hook a cvar handle to a changehook if we want something to happen as soon as the value of that cvar is changed.
|
Or to block that change to happen.
PHP Code:
public void OnPluginStart()
{
g_cvMPGameMode = FindConVar("mp_gamemode");
if (g_cvMPGameMode != null)
{
g_cvMPGameMode.AddChangeHook(vMPGameModeHook);
}
}
public void vMPGameModeHook(ConVar convar, const char[] oldVal, const char[] newVal)
{
if (!StrEqual(newVal, "versus"))
{
g_cvMPGameMode.SetString("versus"));
}
}
__________________