Raised This Month: $ Target: $400
 0% 

ZP countdown error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
airidas338
Member
Join Date: May 2010
Old 01-12-2013 , 04:13   ZP countdown error
Reply With Quote #1

L 01/10/2013 - 20:26:53: Invalid CVAR pointer
L 01/10/2013 - 20:26:53: [AMXX] Displaying debug trace (plugin "countdown.amxx")
L 01/10/2013 - 20:26:53: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 01/10/2013 - 20:26:53: [AMXX] [0] countdown.sma::plugin_precache (line 22)

SMA:
PHP Code:
#include < amxmodx >

#define VERSION     "1.0"

// For exemple, here u have 10 sounds, but u have to add +1, so 10+1 = 11 ^^
#define X_POS        0.2
#define Y_POS        -0.55

new Sounds[ ][ ] =
{
    
"",
    
"CountDown_Voice/one.wav""CountDown_Voice/two.wav""CountDown_Voice/three.wav"
    
"CountDown_Voice/four.wav""CountDown_Voice/five.wav""CountDown_Voice/six.wav"
    
"CountDown_Voice/seven.wav""CountDown_Voice/eight.wav""CountDown_Voice/nine.wav"
    
"CountDown_Voice/ten.wav"
}

new 
CountDownpCvar_ZombiePlague_MaxSoundsMAX_SOUNDS

public plugin_precache( )
{
    
MAX_SOUNDS get_pcvar_numpCvar_ZombiePlague_MaxSounds )+1
    
new iDelayiDelay get_cvar_num"zp_delay" )
    for( new 
0< ( ( iDelay MAX_SOUNDS ) ? iDelay MAX_SOUNDS ); i++ )
    {
        if( 
!= 
        {
            
precache_soundSounds] )
        }
    }
}

public 
plugin_init( )
{
    
register_plugin"Zombie Plague CountDown"VERSION"BboY GruN" )
    
register_cvar"ZombiePlague_Countdown"VERSIONFCVAR_SERVER|FCVAR_SPONLY );
    
pCvar_ZombiePlague_MaxSounds register_cvar"Zp_MAX_SOUNDS""10" )
    
    
register_dictionary"zombiecountdown.txt" )
    
    
register_event"HLTV""Event_RoundStart""a""1=0""2=0" )
}


public 
Event_RoundStart( )
{
    
CountDown get_cvar_num"zp_delay" )
    if( 
task_exists666_666_666 ) )    remove_task666_666_666 )
    
CountDownAndSounds( )
}

public 
CountDownAndSounds( )
{
    if( 
CountDown <= MAX_SOUNDS-)
    {
        
client_cmd0"%s%s"
        ( 
containiSoundsCountDown ], ".wav" ) != -) ? "spk " "mp3 stop;mp3 play sound/"SoundsCountDown ] )
    }
    
set_hudmessage255255255X_POSY_POS20.01.00.00.0, -)
    
show_hudmessage0"%L"LANG_PLAYER"COUNTDOWN"CountDown )
    
    
CountDown--
    if( 
CountDown )
    {
        
set_task1.0"CountDownAndSounds"666_666_666 )
    }

In this line error:
PHP Code:
     MAX_SOUNDS get_pcvar_numpCvar_ZombiePlague_MaxSounds )+
__________________
if you will see in my posts ".." it means deleted.

Last edited by airidas338; 01-12-2013 at 04:20.
airidas338 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-12-2013 , 05:24   Re: ZP countdown error
Reply With Quote #2

plugin_precache( ) is executed before plugin_init( ), so your variable "pCvar_ZombiePlague_MaxSounds" isn't filled when get_pcvar_num( pCvar_ZombiePlague_MaxSounds ) is called.
__________________
micapat is offline
airidas338
Member
Join Date: May 2010
Old 01-12-2013 , 06:11   Re: ZP countdown error
Reply With Quote #3

I fixed it. Thanks.
__________________
if you will see in my posts ".." it means deleted.

Last edited by airidas338; 01-12-2013 at 06:33.
airidas338 is offline
Reply



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 13:40.


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