Fixed bug where disabling weapons disabling all knockback. Also fixed potential error when disabling hitgroups.

This commit is contained in:
Greyscale 2009-06-08 16:04:11 -07:00
parent d0c25862d8
commit 9e8120cc98
1 changed files with 15 additions and 13 deletions

View File

@ -71,23 +71,25 @@ KnockbackOnClientHurt(client, attacker, const String:weapon[], hitgroup, dmg_hea
} }
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]); new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
if (!weapons) if (weapons)
{ {
return; new weaponindex = WeaponsNameToIndex(weapon);
if (weaponindex != -1)
{
// Apply weapon knockback multiplier.
knockback *= WeaponsGetKnockback(weaponindex);
}
} }
new weaponindex = WeaponsNameToIndex(weapon); new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
if (weaponindex != -1) if (hitgroups)
{ {
// Apply weapon knockback multiplier. new hitgroupindex = HitgroupToIndex(hitgroup);
knockback *= WeaponsGetKnockback(weaponindex); if (hitgroupindex != -1)
} {
// Apply hitgroup knockback multiplier.
new hitgroupindex = HitgroupToIndex(hitgroup); knockback *= HitgroupsGetKnockback(hitgroupindex);
if (hitgroupindex != -1) }
{
// Apply hitgroup knockback multiplier.
knockback *= HitgroupsGetKnockback(hitgroupindex);
} }
// Apply damage knockback multiplier. // Apply damage knockback multiplier.