Hi everyone!
I searched a lot before doing this Thread.
The problem is forward
hook_cvar_change() not working.
I used
RH_Cvar_DirectSet from
ReAPI, It doesn't work either.
hook_cvar_change(): I changed the value in cvar, I don't see any message:
This message appears when a server is activated:
PHP Code:
L 06/13/2022 - 19:50:55: client_disconnected and client_remove forwards have been disabled - check your gamedata files.
L 06/13/2022 - 19:50:55: Binding/Hooking cvars have been disabled - check your gamedata file
RH_Cvar_DirectSet:
PHP Code:
L 06/13/2022 - 19:50:57: [ReAPI] RegisterHookChain: function (Cvar_DirectSet) is not available, ReHLDS required.
L 06/13/2022 - 19:50:57: [AMXX] Run time error 10 (plugin "cstrike.amxx") (native "RegisterHookChain") - debug not enabled!
L 06/13/2022 - 19:50:57: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quote
Plugin:
PHP Code:
#include <amxmodx>
#include <reapi>
// Global Variables.
new g_pCvar_iValue
// Forward called after server activation.
public plugin_init()
{
// Load plugin.
register_plugin("[ZE] Set Rendering", "1.0", "z0h1r-LK")
// Hook Chains.
RegisterHookChain(RH_Cvar_DirectSet, "fw_Cvar_DirectSet_Post", 1)
// Cvars.
g_pCvar_iValue = register_cvar("amx_value", "1")
hook_cvar_change(g_pCvar_iValue, "fw_CvarChange_Post")
}
// Forward called when change value from cvar "amx_value".
public fw_CvarChange_Post(pCvar, const szOldVal[], const szNewVal[])
{
// Print message on server console.
server_print("[AMXX] cvar: %d | old value: %s | new value: %s", pCvar, szOldVal, szNewVal)
}
// Hook called when change value in any cvar.
public fw_Cvar_DirectSet_Post(pCvar, const szVal[])
{
// Print message on server console.
server_print("[ReAPI] cvar: %d | value: %d", pCvar, szVal)
}
I use:
OS: Windows
AMX Mod X v1.10.0.5461
ReAPI v5.21.0.252-dev
MetaMod-R v1.3.0.86
ReHLDS v3.10.0.759
Please help!!
Thanks in advance
__________________