Best way (most efficient in my mind) to add weapons is to make a bitsum :
PHP Code:
const WEAPONS_BITSUM = (1<<CSW_M3)|(1<<CSW_XM1014)
Then in the function make this check :
instead of
PHP Code:
if iWeapon == CSW_M3
PHP Code:
if( WEAPONS_BITSUM & (1<<iWeapon) )
->
PHP Code:
public Player_TraceAttack(id, iAttacker, Float:flDamage, Float:vecDir[3], ptr, iDamageType)
{
if( IsPlayer(iAttacker) && WEAPONS_BS & (1<<get_user_weapon(iAttacker)) )
{
new CsArmorType:tArmor, iArmor = cs_get_user_armor(id, tArmor)
if(iArmor > 0 && tArmor == CS_ARMOR_VESTHELM && get_tr2(ptr, TR_iHitgroup) == HIT_HEAD)
{
set_tr2(ptr, TR_iHitgroup, get_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD : HIT_GENERIC)
return HAM_HANDLED
}
}
return HAM_IGNORED
}
This way you have only 1 check in the function instead of multiples ones.
__________________