This is done in ZP 5.0:
PHP Code:
// Ham Take Damage Forward
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
// Non-player damage or self damage
if (victim == attacker || !is_user_alive(attacker))
return HAM_IGNORED;
// Zombie attacking human...
if (zp_core_is_zombie(attacker) && !zp_core_is_zombie(victim))
{
// Ignore damage coming from a HE grenade (bugfix)
//if (damage_type & DMG_HEGRENADE)
// return HAM_HANDLED;
// Does human armor need to be reduced before infecting/damaging?
if (!get_pcvar_num(cvar_human_armor_protect))
return HAM_IGNORED;
// Should armor protect against nemesis attacks?
if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && !get_pcvar_num(cvar_armor_protect_nemesis) && zp_class_nemesis_get(attacker))
return HAM_IGNORED;
// Should armor protect survivor too?
if (LibraryExists(LIBRARY_SURVIVOR, LibType_Library) && !get_pcvar_num(cvar_survivor_armor_protect) && zp_class_survivor_get(victim))
return HAM_IGNORED;
// Get victim armor
static Float:armor
pev(victim, pev_armorvalue, armor)
// If he has some, block damage and reduce armor instead
if (armor > 0.0)
{
emit_sound(victim, CHAN_BODY, g_sound_armor_hit, 1.0, ATTN_NORM, 0, PITCH_NORM)
if (armor - damage > 0.0)
set_pev(victim, pev_armorvalue, armor - damage)
else
cs_set_user_armor(victim, 0, CS_ARMOR_NONE)
// Block damage, but still set the pain shock offset
set_pdata_float(victim, OFFSET_PAINSHOCK, 0.5)
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}