Raised This Month: $ Target: $400
 0% 

Solved hook_cvar_change and RH_Cvar_DirectSet not working


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LiZou Mapper
Member
Join Date: Oct 2018
Location: The Red City !
Old 06-13-2022 , 15:07   hook_cvar_change and RH_Cvar_DirectSet not working
Reply With Quote #1

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:55client_disconnected and client_remove forwards have been disabled check your gamedata files.
L 06/13/2022 19:50:55Binding/Hooking cvars have been disabled check your gamedata file 
RH_Cvar_DirectSet:
PHP Code:
L 06/13/2022 19:50:57: [ReAPIRegisterHookChain: function (Cvar_DirectSetis not availableReHLDS required.
L 06/13/2022 19:50:57: [AMXXRun time error 10 (plugin "cstrike.amxx") (native "RegisterHookChain") - debug not enabled!
L 06/13/2022 19:50:57: [AMXXTo enable debug modeadd "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"pCvarszOldValszNewVal)
}

// 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"pCvarszVal)

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
__________________

-------------
My Maps !
Zombie Escape Mod !
-------------


Last edited by LiZou Mapper; 06-19-2022 at 15:38. Reason: Update title
LiZou Mapper is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode