Raised This Month: $ Target: $400
 0% 

Cvar Utilities


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 06-20-2014 , 13:15   Re: Cvar Utilities
Reply With Quote #3

OK thanks for answer, i do it :
Code:
public OnChangeCvarValue( handleCvar, const oldValue[], const newValue[], const cvarName[], const defaultValue[] )
{
    if(handleCvar != _:gCvarInfo[CVAR_SEND_MONSTER_TIME]) {
        for(new i; i < _:e_Cvar; i++) {
            if(gCvarInfo[e_Cvar:i] == handleCvar) {
                gCvarValue[e_Cvar:i] = str_to_num(newValue)
                client_print(0,3,"%d %s %d", i, cvarName, str_to_num(newValue))
                client_print(0,3,"%d", gCvarValue[e_Cvar:i] )
                break
            }
        }
        
    }
}
And it works propely, but if i type under all cvars
Code:
CvarHookChangeAll("OnChangeCvarValue");
I'll give error:
Code:
L 06/20/2014 - 19:19:30: [CVAR_UTIL] Invalid hook callback "100"
L 06/20/2014 - 19:19:30: [AMXX] Displaying debug trace (plugin "td_new.amxx", version "0.4")
L 06/20/2014 - 19:19:30: [AMXX] Run time error 19: function not found 
L 06/20/2014 - 19:19:30: [AMXX]    [0] td_new.sma::LoadCvars (line 465)
L 06/20/2014 - 19:19:30: [AMXX]    [1] td_new.sma::plugin_init (line 417)
If i type
Code:
CvarHookChangeAll("OnChangeCvarValue", true);
It will work, but first value is 0, and 0 errors it'll given
How to do this with out ignoring first call, with out any errors ... ?


edit;

i missed the problem using this under all CvarRegister
Code:
    for(new i; i < _:e_Cvar;i++)
        if(i != _:CVAR_SEND_MONSTER_TIME)
            gCvarValue[e_Cvar:i] = get_pcvar_num(gCvarInfo[e_Cvar:i])
I do it with "true", and values are properly loaded, and it works fine, but i want to do without this "true" in hook,how to ?

Last edited by grs4; 06-20-2014 at 13:20.
grs4 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 21:10.


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