public void TestCvarChange_Callback(Cvar cvar, const char[] oldValue, const char[] newValue)
{
printToServer("Cvar changed:%s\n", newValue);
}
public void OnPluginInit()
{
printToServer("Create cvar with value = 5.0\n");
Cvar c = Cvar("test", "5.0", None);
printToServer("Add callback to cvar\n");
c.AddHookOnChange(TestCvarChange_Callback);
printToServer("Print as float\n");
printToServer("%f\n", c.GetFloat());
printToServer("Set value to 2.0\n");
c.SetFloat(2.0);
printToServer("Print as float\n");
printToServer("%f\n", c.GetFloat());
printToServer("Set value to 1337\n");
c.SetInt(1337);
printToServer("Print as int\n");
printToServer("%d\n", c.GetInt());
}
Screenshots (if appropriate):
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
[x] My code follows the code style of this project.
[x] My change requires a change to the documentation.
Description
Implementation of Cvar manager
Motivation and Context
Fix #8 Fix #11
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: