[SOLVED] DMG_NERVEGAS no Armor Damage

Hello, i am using something so when a player press left click the Player will not get any Damage “dmginfo:ScaleDamage( 0 )”, the Health stays normal but the Armor is going down is there a way to avoid this?

I had the same problem some time ago and I found a simple way to get around it (if you find something better I’ll take it):

hook.Add("EntityTakeDamage", "test", function(entity, damageInfo)

    if entity:IsPlayer() and damageInfo:IsDamageType(DMG_NERVEGAS) then

        entity._oldArmorValue = entity:Armor()
        entity:SetArmor(0)

    end

end)

hook.Add("PostEntityTakeDamage", "test", function(entity, damageInfo, took)

    if entity._oldArmorValue then

        entity:SetArmor(entity._oldArmorValue)
        entity._oldArmorValue = nil

    end

end)

You can test this with this little command that simulates the damage done by a gas:

concommand.Add("nervegas", function(ply)

    local damageInfo = DamageInfo()
    damageInfo:SetDamage(1)
    damageInfo:SetAttacker(ply)
    damageInfo:SetDamageType(DMG_NERVEGAS)

    ply:TakeDamageInfo(damageInfo)

end)
2 Likes