diff --git a/ammo_clip_on_kill/lua/autorun/server/ammo_clip_on_kill.lua b/ammo_clip_on_kill/lua/autorun/server/ammo_clip_on_kill.lua new file mode 100644 index 0000000..25c56b7 --- /dev/null +++ b/ammo_clip_on_kill/lua/autorun/server/ammo_clip_on_kill.lua @@ -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)