health siphon

This commit is contained in:
edshot99 2024-12-18 23:30:57 -06:00
parent 683a435234
commit 0094b4eec4

View File

@ -0,0 +1,11 @@
hook.Add("EntityTakeDamage", "edshot_health_siphon", function(target, dmg)
if dmg:IsBulletDamage() then
local attacker = dmg:GetAttacker()
if IsValid(attacker) and attacker:Alive() then
local health = (attacker:Health() + (dmg:GetDamage() / 4))
attacker:SetHealth( math.Clamp(health, 0, attacker:GetMaxHealth()) )
end
end
end)