public HC_CBasePlayer_TraceAttack_Pre(const iVictim, const iAttacker, Float: fDamage, Float: fDirection[3]) {
log_amx("HC_CBasePlayer_TraceAttack_Pre 1: %f", fDamage);
if(!(g_bInfectionBegan))
{
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_SUPERCEDE;
}
log_amx("HC_CBasePlayer_TraceAttack_Pre 2: %f", fDamage);
if(IsSetBit(gp_iBit[BIT_ZOMBIE], iAttacker) && IsSetBit(gp_iBit[BIT_HUMAN], iVictim))
{
static Float: fArmor; fArmor = get_entvar(iVictim, var_armorvalue);
if(fArmor > 0.0)
{
if(g_infoZombieClass[gp_iClass[iAttacker]][CLASS_FACTOR_DAMAGE])
{
fDamage *= g_infoZombieClass[gp_iClass[iAttacker]][CLASS_FACTOR_DAMAGE];
}
fArmor -= fDamage;
set_entvar(iVictim, var_armorvalue, fArmor);
}
else
{ log_amx("HC_CBasePlayer_TraceAttack_Pre 3: %f", fDamage);
if(g_iAliveHumans == 1)
{
SetHookChainArg(3, ATYPE_FLOAT, fDamage);
return HC_CONTINUE;
}
else
{ log_amx("HC_CBasePlayer_TraceAttack_Pre 4: %f", fDamage);
setPlayerInfect(iVictim);
set_entvar(iAttacker, var_frags, get_entvar(iAttacker, var_frags) + 1);
if(g_iCvar_GiveHealthIntected > 0)
{
new Float: fHealth = get_entvar(iAttacker, var_health);
log_amx("HC_CBasePlayer_TraceAttack_Pre 5: %f", fDamage);
if(fHealth + g_iCvar_GiveHealthIntected > g_infoZombieClass[gp_iClass[iAttacker]][CLASS_HEALTH])
{
set_entvar(iAttacker, var_health, g_infoZombieClass[gp_iClass[iAttacker]][CLASS_HEALTH]);
}
else
{ log_amx("HC_CBasePlayer_TraceAttack_Pre 6: %f", fDamage);
set_entvar(iAttacker, var_health, fHealth + g_infoZombieClass[gp_iClass[iAttacker]][CLASS_HEALTH]);
}
}
}
}
log_amx("HC_CBasePlayer_TraceAttack_Pre 7: %f", fDamage);
SetHookChainArg(3, ATYPE_FLOAT, 0.0);
return HC_CONTINUE;
}
if(IsSetBit(gp_iBit[BIT_HUMAN], iAttacker) && IsSetBit(gp_iBit[BIT_ZOMBIE], iVictim))
{ log_amx("HC_CBasePlayer_TraceAttack_Pre 8: %f", fDamage);
if(g_bCvar_StateKnockbackSitZombie)
{
static iFlags; iFlags = get_entvar(iVictim, var_flags);
if(iFlags & FL_ONGROUND && iFlags & FL_DUCKING)
{
return HC_CONTINUE;
}
}
static Float: fOriginHuman[3], Float: fOriginZombie[3];
get_entvar(iVictim, var_origin, fOriginZombie);
get_entvar(iAttacker, var_origin, fOriginHuman);
log_amx("HC_CBasePlayer_TraceAttack_Pre 9: %f", fDamage);
if(get_distance_f(fOriginHuman, fOriginZombie) > g_fCvar_MaxDistanceKnockback)
{
return HC_CONTINUE;
}
static Float: fVelocity[3], Float: fVelocityZ;
get_entvar(iVictim, var_velocity, fVelocity);
fVelocityZ = fVelocity[2];
static Float: fFactorDirection = 0.0;
fFactorDirection = getPlayerActiveWeaponKnockback(iAttacker);
log_amx("HC_CBasePlayer_TraceAttack_Pre 10: %f", fDamage);
if(fFactorDirection)
{
UTIL_VecMulScalar(fDirection, fDamage, fDirection);
UTIL_VecMulScalar(fDirection, fFactorDirection, fDirection);
if(g_infoZombieClass[gp_iClass[iVictim]][CLASS_KNOCKBACK])
{
UTIL_VecMulScalar(fDirection, g_infoZombieClass[gp_iClass[iVictim]][CLASS_KNOCKBACK], fDirection);
}
UTIL_VecAdd(fDirection, fVelocity, fVelocity);
fDirection[2] = fVelocityZ;
set_entvar(iVictim, var_velocity, fVelocity);
}
} log_amx("HC_CBasePlayer_TraceAttack_Pre 11: %f", fDamage);
return HC_CONTINUE;
}