ammo clip on kill
This commit is contained in:
parent
0094b4eec4
commit
0d432dcbed
24
ammo_clip_on_kill/lua/autorun/server/ammo_clip_on_kill.lua
Normal file
24
ammo_clip_on_kill/lua/autorun/server/ammo_clip_on_kill.lua
Normal 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)
|
Loading…
Reference in New Issue
Block a user