Garry's Mod

Garry's Mod

Hunter SWEP
Hp issue code
your hp problem as well (you can chuck this anywhere) feel free to change the heal amount (it will heal you upto 250 hp)


SWEP.HealthBonus = 150
SWEP.HealAmount = 10
SWEP.HealTimer = 1
SWEP.HealId = ""
function SWEP:Equip(owner)
self:RegeneratingHealth(owner)
timer.Simple(1, function()
if !IsValid(self) then return end
owner:SetActiveWeapon(self)
end)
end
function SWEP:Holster()
local owner = self.Owner
return true
end
function SWEP:RemoveSelf()
local owner = self.Owner
if !SERVER then return end
if timer.Exists(self.HealId) then timer.Remove( self.HealId ) return end
self:Remove()
end
function SWEP:RegeneratingHealth(owner)

local hp, maxhp

self.HealId = math.random(165, 73623)
self.HealId = "EOTI_WEREWOLF_SWEP_"..self.HealId..owner:Name()

timer.Create(self.HealId , self.HealTimer, 0, function()
if !SERVER
or !self:IsValid()
or !timer.Exists( self.HealId )
then return end

hp = owner:Health()
maxhp = (owner:GetMaxHealth() + self.HealthBonus or 100 + self.HealthBonus)
if maxhp < hp then return end
owner:SetHealth(math.Clamp( hp + self.HealAmount , 0, maxhp ))
end)


end
function SWEP:Think()

local owner
owner = self.Owner


end