A Console Variable, either defined in CVARINFO
or by the engine.
Not serializable. Do not use as a member unless marked as transient
.
All Get and Set operations will work regardless of the real type of the CVar, as they aren't "strongly" typed.
struct CVar
{
static CVar FindCVar(name n);
static CVar GetCVar(name n, PlayerInfo player = null);
bool GetBool();
double GetFloat();
int GetInt();
string GetString();
void SetBool(bool v);
void SetFloat(double v);
void SetInt(int v);
void SetString(string v);
int GetRealType();
int ResetToDefault();
}
Returns a server CVar by name, or null
if none is found.
Returns a user or server CVar by name, with player
as the user if applicable,
or null
if none is found.
Returns a boolean representing the value of the CVar, or false
if it
cannot be represented.
Returns a float representing the value of the CVar, or 0.0
if it cannot be
represented.
Returns an integer representing the value of the CVar, or 0
if it cannot be
represented.
Returns a string representing the value of the CVar. CVars can always be represented as strings.
Sets the representation of the CVar to v
. May only be used on mod-defined
CVars.
Returns the type of the CVar as it was defined, which may be one of the following:
Name |
---|
CVar.CVAR_BOOL |
CVar.CVAR_COLOR |
CVar.CVAR_FLOAT |
CVar.CVAR_INT |
CVar.CVAR_STRING |
Resets the CVar to its default value and returns 0. The purpose of the return is unknown. May only be used on mod-defined CVars.