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 AttakerWeapon, AttakerPartHit
new attacker = get_user_attacker(id, AttakerWeapon, AttakerPartHit)
if( g_zombie[attacker] ) //<--- This line
{
if(AttakerWeapon == CSW_KNIFE && damage >= 55)
{
new Float:Random_Float[3]
for(new i = 0; i < 3; i++) Random_Float[i] = random_float(100.0, 125.0)
Punch_View(id, Random_Float)
}
}
return PLUGIN_CONTINUE
}
stock Punch_View(id, Float:ViewAngle[3])
{
entity_set_vector(id, EV_VEC_punchangle, ViewAngle)
}
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(attacker, max_hp)
else
set_user_health(attacker, current_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?
__________________