note Help Needed
This wiki is the result of an ongoing community effort — thank you all for helping!
If you want to provide changes to this page then please click here.
GetSVarType
Description
Gets the type (integer, float or string) of a server variable.
Name | Description |
---|---|
const svar[] | The name of the server variable to get the type of. |
Returns
Returns the type of the SVar.
Examples
stock PrintSVar(varname[])
{
switch(GetSVarType(varname))
{
case SERVER_VARTYPE_NONE:
{
return 0;
}
case SERVER_VARTYPE_INT:
{
printf("Integer SVar '%s': %i", varname, GetSVarInt(varname));
}
case SERVER_VARTYPE_FLOAT:
{
printf("Float SVar '%s': %f", varname, GetSVarFloat(varname));
}
case SERVER_VARTYPE_STRING:
{
new varstring[256];
GetSVarString(varname, varstring);
printf("String SVar '%s': %s", varname, varstring);
}
}
return 1;
}
public OnGameModeInit()
{
SetSVarInt("Version", 37);
PrintSVar("Version"); // Output: "Integer SVar 'Version': 37"
return 1;
}
Related Functions
- SetSVarInt: Set an integer for a server variable.
- GetSVarInt: Get a player server as an integer.
- SetSVarString: Set a string for a server variable.
- GetSVarString: Get the previously set string from a server variable.
- SetSVarFloat: Set a float for a server variable.
- GetSVarFloat: Get the previously set float from a server variable.
- DeleteSVar: Delete a server variable.