GET_CONVAR_INT
Can be used to get a console variable casted back to int (an integer value).
Signature
int GET_CONVAR_INT(char* varName, int default_);Parameters
| Name | Type | Description |
|---|---|---|
varName | char* | The console variable to look up. |
default_ | int | The default value to set if none is found (variable not set using SET_CONVAR, or not accessible). |
Returns int — Returns the convar value if it can be found, otherwise it returns the assigned `default`.
Description
Can be used to get a console variable casted back to int (an integer value).
Usage
local retval = GetConvarInt(varName, default_)
-- always works, by hash
local retval = Citizen.InvokeNative(0x935c0ab2, varName, default_, Citizen.ResultAsInteger())JavaScript and C#
const retval = GetConvarInt(varName, default_);
// by hash
const retval = Citizen.invokeNative('0x935c0ab2', varName, default_, Citizen.returnResultAnyway(), Citizen.resultAsInteger());int retval = Function.Call<int>((Hash)0x935c0ab2, varName, default_);Examples
if GetConvarInt('remainingRounds', 0) < 900 then
Citizen.Trace("Less than 900 rounds remaining...")
endSources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.