ammo clip on kill

This commit is contained in:
edshot99 2024-12-19 00:38:14 -06:00
parent 0094b4eec4
commit 0d432dcbed

View File

@ -0,0 +1,24 @@
hook.Add("PlayerDeath", "edshot_AmmoRestoredOnPlayerKill", function(victim, inflictor, attacker)
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
local weps = attacker:GetWeapons()
for _, wep in ipairs(weps) do
if IsValid(wep) then
wep:SetClip1( wep:GetMaxClip1() )
end
end
end
end)
hook.Add("OnNPCKilled", "edshot_AmmoRestoredOnNPCKill", function(npc, attacker, inflictor)
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
local weps = attacker:GetWeapons()
for _, wep in ipairs(weps) do
if IsValid(wep) then
wep:SetClip1( wep:GetMaxClip1() )
end
end
end
end)