View Single Post
Author Message
SyluxLockjaw100
Senior Member
Join Date: Jul 2010
Location: Novaya Russia
Old 05-03-2013 , 03:30   Zombies not being immune to damage types.
Reply With Quote #1

Zombies with this class are taking ignored damage types even though I have set it to ignore... help?

Code:
#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <cs_ham_bots_api> //--- Not sure if bots are immune to the damage types by default... let's just put it here just incase.
#include <zp50_class_zombie>
#include <zp50_grenade_frost>
#include <zp50_grenade_fire>

new const PLUGIN_VERSION[] = "1.0"

new const zombieclass1_name[] = "Anti-Element Zombie"
new const zombieclass1_info[] = "Immune fire/ice/water"
new const zombieclass1_models[][] = { "zombie_source" }
new const zombieclass1_clawmodels[][] = { "models/zombie_plague/v_knife_zombie.mdl" }
const zombieclass1_health = 1875
const Float:zombieclass1_speed = 1.0
const Float:zombieclass1_gravity = 1.0
const Float:zombieclass1_knockback = 0.85

new g_ZombieClassID

public plugin_init()
{
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
}

public plugin_precache()
{
    register_plugin("[ZP] Class: Zombie: Anti-Element", PLUGIN_VERSION, "SyluxLockjaw/Spectralopteryx")
    
    new index
    
    g_ZombieClassID = zp_class_zombie_register(zombieclass1_name, zombieclass1_info, zombieclass1_health, zombieclass1_speed, zombieclass1_gravity)
    zp_class_zombie_register_kb(g_ZombieClassID, zombieclass1_knockback)
    
    for(index = 0; index < sizeof zombieclass1_models; index++)
        zp_class_zombie_register_model(g_ZombieClassID, zombieclass1_models[index])
        
    for(index = 0; index < sizeof zombieclass1_clawmodels; index++)
        zp_class_zombie_register_claw(g_ZombieClassID, zombieclass1_clawmodels[index])
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
    if (!(damage_type & DMG_BURN & DMG_SLOWBURN & DMG_FREEZE & DMG_SLOWFREEZE & DMG_DROWN & DMG_SHOCK))
        return HAM_IGNORED;
    
    if (!zp_core_is_zombie(victim) || zp_class_zombie_get_current(victim) != g_ZombieClassID)
        return HAM_IGNORED;
    
    return HAM_SUPERCEDE;
}

public zp_fw_grenade_frost_pre(player)
{
    if(is_user_alive(player) && zp_class_zombie_get_current(player) == g_ZombieClassID)
        return PLUGIN_HANDLED
        
    return PLUGIN_CONTINUE
}

public zp_fw_grenade_fire_pre(player)
{
    if(is_user_alive(player) && zp_class_zombie_get_current(player) == g_ZombieClassID)
        return PLUGIN_HANDLED
        
    return PLUGIN_CONTINUE
}
SyluxLockjaw100 is offline