Raised This Month: $ Target: $400
 0% 

Run time error 4: index out of bounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 02-11-2007 , 23:43   Run time error 4: index out of bounds
Reply With Quote #1

Giving me a run time error
Code:
L 02/06/2007 - 02:13:02: [AMXX] Displaying debug trace (plugin "zombie_swarm.amxx")
L 02/06/2007 - 02:13:02: [AMXX] Run time error 4: index out of bounds 
L 02/06/2007 - 02:13:02: [AMXX]    [0] zombie_swarm.sma::event_damage_camera (line 356)
L 02/06/2007 - 02:13:02: [AMXX] Displaying debug trace (plugin "zombie_swarm.amxx")
L 02/06/2007 - 02:13:02: [AMXX] Run time error 4: index out of bounds 
L 02/06/2007 - 02:13:02: [AMXX]    [0] zombie_swarm.sma::event_damage_lifesteal (line 386)
PHP Code:
public event_damage_camera(id)
{
    if (!
is_user_alive(id) || !is_user_connected(id)) 
        return 
PLUGIN_CONTINUE
    
    
new damage read_data(2)
    new 
AttakerWeaponAttakerPartHit
    
new attacker get_user_attacker(idAttakerWeaponAttakerPartHit)
    
    if( 
g_zombie[attacker] ) //<--- This line
    
{
        if(
AttakerWeapon == CSW_KNIFE && damage >= 55)    
        {
            new 
Float:Random_Float[3]
            for(new 
03i++) Random_Float[i] = random_float(100.0125.0)
            
Punch_View(idRandom_Float)
        }
    }    
    return 
PLUGIN_CONTINUE
}

stock Punch_View(idFloat:ViewAngle[3])
{
    
entity_set_vector(idEV_VEC_punchangleViewAngle)
}

public 
event_damage_lifesteal(id) {
    
    new 
damage read_data(2)
    new 
attacker get_user_attacker(id)
    
    if ( ! 
is_user_alive(id) || ! is_user_connected(id) )
        return 
PLUGIN_CONTINUE
    
    
new current_hp get_user_health(attacker)
    new 
max_hp get_pcvar_num(zomb_hp)
    
    
current_hp += damage
    
    
if ( g_zombie[attacker] ) { //<--- This line
        
if ( current_hp >= max_hp )
            
set_user_health(attackermax_hp)
        else
            
set_user_health(attackercurrent_hp)
    }
    return 
PLUGIN_CONTINUE


Also, is it possible to only use one function for the both of these things to make it a bit cleaner?
__________________
It's a mystery.
Mini_Midget 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 00:36.


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