Raised This Month: $ Target: $400
 0% 

Zombi Class problem(index out of bounds)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 11-26-2014 , 15:01   Zombi Class problem(index out of bounds)
Reply With Quote #1

I use this class but give me this error:

Run time error 4: index out of bounds
Event_Damage (line 66)

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < biohazard >
#include < engine >
#include < hamsandwich >

#define D_ZOMBIE_NAME "Paralyzer class"
#define D_ZOMBIE_DESC "auto-paralyze and 2x jumps"
#define D_PLAYER_MODEL "paralizer_bio"
#define D_CLAWS "models/v_paralizer_bio.mdl"
#define PMODEL "models/player/paralizer_bio/paralizer_bio.mdl"

new zClassIdDisarmTimeDisarmChanceScreenFadeEffectsSpR_Paralyzed
new boolCantFire33 ] = false;

new 
_gJumpCount[33]
new 
cvar_multi_jump_amount

public plugin_init() 
{
    
register_plugin("ZP CLASS : Paralizer Zombie""1.1""BboY GruN")
    
    
register_event("Damage""Event_Damage""b""2!0""3=0""4!0")

        
RegisterHam(Ham_Player_Jump"player""fw_PlayerJump"0)
    
    
DisarmChance register_cvar("chance_to_disarm""4" )
    
    
DisarmTime register_cvar("disarm_Time""3.0" // How much time the Human will stay disarm

        
cvar_multi_jump_amount register_cvar("zp_multi_jump_amount""1")
    
    
ScreenFadeEffects =     get_user_msgid"ScreenFade" )

        
zClassId register_class(D_ZOMBIE_NAMED_ZOMBIE_DESC)
 
        if(
zClassId != -1)
        {
                
set_class_data(zClassIdDATA_HEALTH370.0)
                
set_class_data(zClassIdDATA_SPEED266.0)
                
set_class_data(zClassIdDATA_GRAVITY0.75)
                
set_class_data(zClassIdDATA_HITSPEED0.69)
                
set_class_pmodel(zClassIdD_PLAYER_MODEL)
                
set_class_wmodel(zClassIdD_CLAWS)
                }
}

public 
plugin_precache( )
{
    
SpR_Paralyzed precache_model"sprites/paralyzed.spr" )
        
precache_model(PMODEL)
    
precache_model(D_CLAWS)
}

public 
Event_Damagevictim )
{
    new 
id
    id 
get_user_attackervictim )
    if( 
get_user_classvictim ) != zClassId 
    
|| !is_user_zombievictim ) )
        return 
PLUGIN_CONTINUE;
    
    new 
Rand random_num1100 )
    if( 
Rand && Rand <= get_pcvar_numDisarmChance ) ) 
    {
        
CantFireid ] = true
        Effects
id )
        
set_taskget_pcvar_floatDisarmTime ), "StopDisarmCc"id )
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
client_PreThinkPlayer )
{    
    if( !
CantFirePlayer ] )
        return 
PLUGIN_CONTINUE;
    
entity_set_intPlayerEV_INT_buttonentity_get_intPlayerEV_INT_button ) & ~IN_ATTACK // Player will scared :D
    
return PLUGIN_CONTINUE;
}

public 
Effectsid )
{
    
message_beginMSG_ONE_UNRELIABLEScreenFadeEffects,.player id )
    
write_short( ( 1<<10 ) )
    
write_short)
    
write_short0x0000 )
    
write_byte255 // Red color 
    
write_byte// G
    
write_byte// B
    
write_byte255 )
    
message_end( )
    
    new 
FloatHumanOrigin]
    
entity_get_vectoridEV_VEC_originHumanOrigin )
    
engfuncEngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYHumanOrigin0)
    
write_byteTE_SPRITETRAIL )    
    
engfuncEngFunc_WriteCoordHumanOrigin] )
    
engfuncEngFunc_WriteCoordHumanOrigin] )
    
engfuncEngFunc_WriteCoordHumanOrigin] )
    
engfuncEngFunc_WriteCoordHumanOrigin] )
    
engfuncEngFunc_WriteCoordHumanOrigin] )
    
engfuncEngFunc_WriteCoordHumanOrigin] + 30 )
    
write_shortSpR_Paralyzed 
    
write_byte
    
write_byte30 )
    
write_byte10 
    
write_byte45 )
    
write_byte40 )
    
message_end( )
}

public 
StopDisarmCcid )
{
    
CantFireid ] = false
}

public 
fw_PlayerJump(id
{
        if(!
is_user_alive(id) || !is_user_zombie(id))
    {
        return 
HAM_SUPERCEDE
    
}

    if(
is_user_alive(id) && get_user_class(id) == zClassId
    {
        new 
Flags pev(idpev_flags)
        
        if( 
Flags FL_WATERJUMP || pev(idpev_waterlevel) >= || !(get_pdata_int(id246) & IN_JUMP) )
        {
            return 
HAM_IGNORED
        
}
        if(
Flags FL_ONGROUND
        {
            
_gJumpCount[id] = 0
            
            
return HAM_IGNORED
        
}
        if(
get_pcvar_num(cvar_multi_jump_amount)) 
        {
            if( 
get_pdata_float(id251) < 500 && ++_gJumpCount[id] <= get_pcvar_num(cvar_multi_jump_amount)) 
            {
                new 
Float:fVelocity[3]
                
pev(idpev_velocityfVelocity)
                
fVelocity[2] = 268.328157
                set_pev
(idpev_velocityfVelocity)
                
                return 
HAM_HANDLED
            
}
        }
    }
    return 
HAM_IGNORED

Problem is there:
PHP Code:
public Event_Damagevictim )
{
    new 
id
    id 
get_user_attackervictim )
    if( 
get_user_classvictim ) != zClassId 
    
|| !is_user_zombievictim ) )
        return 
PLUGIN_CONTINUE;
    
    new 
Rand random_num1100 )
    if( 
Rand && Rand <= get_pcvar_numDisarmChance ) ) 
    {
        
CantFireid ] = true
        Effects
id )
        
set_taskget_pcvar_floatDisarmTime ), "StopDisarmCc"id )
    }
    
    return 
PLUGIN_CONTINUE;

and line 66 is
PHP Code:
CantFireid ] = true 
Can someone help me to solve this?
Krtola is offline
Send a message via Skype™ to Krtola
 


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 17:32.


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