@CBasePlayer_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_type)
{
if ( !is_user_connected( victim ) )
return;
if (!rg_is_player_can_takedamage(victim, attacker))
return;
if (BIT_VALID(m_bitZombie, victim))
{
new Float: gametime = get_gametime( );
m_flZombieLastDamage[ victim ] = gametime;
m_flZombieRegenTime[ victim ] = gametime + get_pcvar_float( m_pCvar_ZombieRegenInterval );
}
if (victim == attacker || !is_user_connected(attacker))
return;
if (BIT_VALID(m_bitZombie, attacker))
{
new weapon = get_member(attacker, m_pActiveItem);
if (!is_nullent(weapon) && ( get_member(weapon, m_iId) == WEAPON_KNIFE ) && ( inflictor == attacker ) && !( damage_type & ( DMG_GRENADE | DMG_BLAST ) ))
{
if ( get_alive_humans( ) <= 1 )
return;
@ZombieAttributes(victim, attacker);
bio_set_user_money( attacker, bio_get_user_money(attacker) + get_pcvar_num(m_pCvar_MoneyInfection) );
SetHookChainArg(4, ATYPE_FLOAT, 0.0);
return;
}
}
new Float: health = get_entvar( victim, var_health );
new Float: effective_damage = (damage > health) ? health : damage;
new money = floatround( effective_damage * get_pcvar_float(m_pCvar_MoneyDamageRatio), floatround_floor );
bio_set_user_money( attacker, bio_get_user_money(attacker) + money );
}