Raised This Month: $ Target: $400
 0% 

native error @ plugin_precache


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-10-2009 , 11:00   native error @ plugin_precache
Reply With Quote #1

Quote:
Originally Posted by Server
L 01/10/2009 - 17:47:03: Invalid CVAR pointer
L 01/10/2009 - 17:47:03: [AMXX] Displaying debug trace (plugin "EgdeBugStats.amxx")
L 01/10/2009 - 17:47:03: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 01/10/2009 - 17:47:03: [AMXX] [0] EgdeBugStats.sma::plugin_precache (line 134)
PHP Code:
// [..]
new gCvar_Sounds;

public 
plugin_precache()
    
gCvar_Sounds        register_cvar("kz_eb_sounds",        "1");

public 
plugin_precache() {
    
gBeamSprite precache_model("sprites/dot.spr");
    
    if( 
get_pcvar_num(gCvar_Sounds) ) {    // line 134.
        
precache_sound("misc/mod_godlike.wav");
        
precache_sound("misc/mod_wickedsick.wav");
        
precache_sound("misc/mod_perfect.wav");
        
precache_sound("misc/mod_impressive.wav");
        
precache_sound("misc/double.wav");
        
precache_sound("misc/triple.wav");
    }

howto fix?
__________________
xPaw is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 01-10-2009 , 11:05   Re: native error @ plugin_precache
Reply With Quote #2

plugin_precache happens before plugin_init, so the cvars may not exist yet. And you can't have plugin_precache twice, merge it in a single block. (I don't even know if you can register cvars in precache. If not, you should use a text file instead)
__________________

Community / No support through PM
danielkza is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-10-2009 , 11:07   Re: native error @ plugin_precache
Reply With Quote #3

To avoid to miss with pointer in such function, you should try to declare your cvar in plugin_init () and precaching all sounds using EngFunc_PrecacheSound, in plugin_init() or plugin_cfg().
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-10-2009 , 11:19   Re: native error @ plugin_precache
Reply With Quote #4

ok ty fixed.
__________________
xPaw is offline
Reply


Thread Tools
Display Modes

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 01:55.


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