{"hash":"0xAB7F7241","ns":"CFX","name":"ADD_CONVAR_CHANGE_LISTENER","slug":"ADD_CONVAR_CHANGE_LISTENER","official":true,"named":true,"luaName":"AddConvarChangeListener","game":"cfx","apiset":"shared","returnType":"int","params":[{"name":"conVarFilter","type":"char*","description":"The Console Variable to listen for, this can be a pattern like \"test:\\*\", or null for any"},{"name":"handler","type":"func","description":"The handler function."}],"returnsDescription":"A cookie to remove the change handler.","summary":"Adds a listener for Console Variable changes.","descriptions":[{"source":"cfx","format":"md","body":"Adds a listener for Console Variable changes.\n\nThe function called expects to match the following signature:\n\n```ts\nfunction ConVarChangeListener(conVarName: string, reserved: any);\n```\n\n*   **conVarName**: The ConVar that changed.\n*   **reserved**: Currently unused."}],"examples":[{"lang":"js","code":"// listen for all convar changes\nAddConvarChangeListener(null, (conVarName, reserved) => {\n    print(GetConvarInt(conVarName))\n})\n\n// listen to convars that start with \"script:\"\nAddConvarChangeListener(\"script:*\", (conVarName, reserved) => {\n    print(GetConvarInt(conVarName))\n})","source":"cfx"}],"aliases":[],"enums":[],"related":["0xEAC49841"],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/ADD_CONVAR_CHANGE_LISTENER","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/ADD_CONVAR_CHANGE_LISTENER.md","snippets":{"lua":"local retval = AddConvarChangeListener(conVarFilter, handler)","luaInvoke":"local retval = Citizen.InvokeNative(0xab7f7241, conVarFilter, handler, Citizen.ResultAsInteger())","js":"const retval = AddConvarChangeListener(conVarFilter, handler);","jsInvoke":"const retval = Citizen.invokeNative('0xab7f7241', conVarFilter, handler, Citizen.returnResultAnyway(), Citizen.resultAsInteger());","csharp":"int retval = Function.Call<int>((Hash)0xab7f7241, conVarFilter, handler);","notes":[]}}