function DamageHook( key, ent, dmginfo )
if ( key == IN_ATTACK ) then
if not ent:IsNPC() and not ent:IsPlayer() then return end
local attacker = dmginfo:GetAttacker()
if attacker:IsPlayer() and attacker:GetActiveWeapon():GetClass() == "weapon_shotgun" then
dmginfo:SetDamage( 1 )
else return
end
end
end
hook.Add( "EntityTakeDamage", "ShotgunDamage", DamageHook )
function DamageHook2( key, ent, dmginfo )
if ( key == IN_ATTACK2 ) then
if not ent:IsNPC() and not ent:IsPlayer() then return end
local attacker = dmginfo:GetAttacker()
if attacker:IsPlayer() and attacker:GetActiveWeapon():GetClass() == "weapon_shotgun" then
dmginfo:SetDamage( 1 )
else return
end
end
end
hook.Add( "EntityTakeDamage", "ShotgunDamage2", DamageHook2 )
I've tried both ways, the one I found and the SWEP.SecondaryAttack, but something is strange, the shotgun damage isn't being modified at all now.
It is killing in 1-2 hits regardless of what the setdamage value is at.