ADD_CONVAR_CHANGE_LISTENER
Adds a listener for Console Variable changes. The function called expects to match the following signature: ```ts function ConVarChangeListener(conVarName: string, reserved: any); ``` * **conVarName**: The ConVar that changed. * **reserved**: Currently unused.
CFX
Signature
lua
AddConvarChangeListener(conVarFilter, handler)
-- returns intParameters
| Name | Type | Description |
|---|---|---|
| char* | The Console Variable to listen for, this can be a pattern like "test:\*", or null for any | |
| func | The handler function. |
Usage
Named call
AddConvarChangeListener(conVarFilter, handler)InvokeNative
Citizen.InvokeNative(0xAB7F7241, conVarFilter, handler)js 1
// listen for all convar changes
AddConvarChangeListener(null, (conVarName, reserved) => {
print(GetConvarInt(conVarName))
})
// listen to convars that start with "script:"
AddConvarChangeListener("script:*", (conVarName, reserved) => {
print(GetConvarInt(conVarName))
})Details
- Hash
- API set
- Source
- cfx
Source: cfx
