CCVar
Revision as of 15:24, 6 March 2025 by Outerbeast (talk | contribs) (Created page with "The <code>CCVar</code> class represents a custom server console variable.  == Constructors == {| class="wikitable" style="vertical-align:middle;" |- style="font-weight:bold; t...")
The CCVar class represents a custom server console variable.
1 Constructors
| Constructor | Description | 
|---|---|
CCVar(const string& in szName, float flValue = 0, const string& in szHelpInfo = "", const ConCommandFlags_t flags = ConCommandFlag::None, CVarCallback@ pCallback = null)
 | 
Creates a cvar with the given name, float value, help info, flags and callback. | 
CCVar(const string& in szName, const string& in szValue, const string& in szHelpInfo = "", const ConCommandFlags_t flags = ConCommandFlag::None, CVarCallback@ pCallback = null)
 | 
Creates a cvar with the given name, string value, help info, flags and callback. | 
2 Methods
| Function | Description | 
|---|---|
const string& GetName() const
 | 
Gets the name of this command. | 
const string& GetFullyQualifiedName() const
 | 
Gets the fully qualified name of this command. This is the name that the command is referred to when called. | 
const string& GetHelpInfo() const
 | 
Gets the help info describing this command. | 
ConCommandKind::Type GetKind() const
 | 
Gets the type of this console command. | 
const string& GetOwningModuleName() const
 | 
Gets the name of the module that owns (created) this command. | 
bool HasBeenAdded() const
 | 
Whether this command was added to the list of commands. Must be added to be usable from the console. | 
const string& GetDefaultValue() const
 | 
Gets the default value for this cvar. | 
const string& GetString() const
 | 
Converts the value to a string. | 
float GetFloat() const
 | 
Converts the value to a float. | 
int GetInt() const
 | 
Converts the value to an integer. | 
bool GetBool() const
 | 
Converts the value to a boolean. | 
void SetString(const string& in szValue)
 | 
Sets the given string as the value. | 
void SetFloat(const float flValue)
 | 
Sets the given float as the value. | 
void SetInt(const int iValue)
 | 
Sets the given integer as the value. | 
void SetBool(const bool bValue)
 | 
Sets the given boolean as the value. | 
3 Funcdefs
void CVarCallback(CCVar@ cvar, const string& in szOldValue, float flOldValue)
Called when the command is executed.