AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ZP countdown error (https://forums.alliedmods.net/showthread.php?t=205570)

airidas338 01-12-2013 04:13

ZP countdown error
 
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 )+


micapat 01-12-2013 05:24

Re: ZP countdown error
 
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.

airidas338 01-12-2013 06:11

Re: ZP countdown error
 
I fixed it. Thanks.


All times are GMT -4. The time now is 13:40.

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