move custom code from fesiug utilities into their own folders
This commit is contained in:
parent
9243870286
commit
683a435234
52
ammo_reserves/lua/autorun/server/ammo_reserves.lua
Normal file
52
ammo_reserves/lua/autorun/server/ammo_reserves.lua
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
hook.Add("PlayerDeath", "edshot_AmmoReservesOnPlayerKill", function(victim, inflictor, attacker)
|
||||
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
|
||||
local wep = attacker:GetActiveWeapon()
|
||||
|
||||
if IsValid(wep) then
|
||||
local wepAmmoType1 = wep:GetPrimaryAmmoType()
|
||||
local wepAmmoType2 = wep:GetSecondaryAmmoType()
|
||||
|
||||
if wepAmmoType1 ~= -1 then
|
||||
attacker:SetAmmo( 999, wepAmmoType1 )
|
||||
end
|
||||
if wepAmmoType2 ~= -1 then
|
||||
attacker:SetAmmo( 99, wepAmmoType2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("OnNPCKilled", "edshot_AmmoReservesOnNPCKill", function(npc, attacker, inflictor)
|
||||
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
|
||||
local wep = attacker:GetActiveWeapon()
|
||||
|
||||
if IsValid(wep) then
|
||||
local wepAmmoType1 = wep:GetPrimaryAmmoType()
|
||||
local wepAmmoType2 = wep:GetSecondaryAmmoType()
|
||||
|
||||
if wepAmmoType1 ~= -1 then
|
||||
attacker:SetAmmo( 999, wepAmmoType1 )
|
||||
end
|
||||
if wepAmmoType2 ~= -1 then
|
||||
attacker:SetAmmo( 99, wepAmmoType2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("WeaponEquip", "edshot_AmmoReservesOnEquip", function(weapon, owner)
|
||||
if owner:IsValid() and !owner:IsNextBot() and !owner:IsNPC() and owner:IsPlayer() then
|
||||
if IsValid(weapon) then
|
||||
local wepAmmoType1 = weapon:GetPrimaryAmmoType()
|
||||
local wepAmmoType2 = weapon:GetSecondaryAmmoType()
|
||||
|
||||
if wepAmmoType1 ~= -1 then
|
||||
owner:SetAmmo( 999, wepAmmoType1 )
|
||||
end
|
||||
if wepAmmoType2 ~= -1 then
|
||||
owner:SetAmmo( 99, wepAmmoType2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
16
health_and_armor/lua/autorun/server/health_and_armor.lua
Normal file
16
health_and_armor/lua/autorun/server/health_and_armor.lua
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
hook.Add("PlayerDeath", "edshot_HealthAndArmorFromPlayer", function(victim, inflictor, attacker)
|
||||
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
|
||||
if attacker ~= victim then
|
||||
attacker:SetHealth( attacker:GetMaxHealth() )
|
||||
attacker:SetArmor( attacker:GetMaxArmor() )
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("OnNPCKilled", "edshot_HealthAndArmorFromNPC", function(npc, attacker, inflictor)
|
||||
if attacker:IsValid() and !attacker:IsNextBot() and !attacker:IsNPC() and attacker:IsPlayer() then
|
||||
attacker:SetHealth( attacker:GetMaxHealth() )
|
||||
attacker:SetArmor( attacker:GetMaxArmor() )
|
||||
end
|
||||
end)
|
Loading…
Reference in New Issue
Block a user