[CODE]function ENT:Use(activator, caller)
if activator:IsPlayer() then
self:EmitSound(Sound("items/smallmedkit1.wav"),70,100)
activator:SetHealth(activator:Health() +20)
activator:PrintMessage(HUD_PRINTTALK, "You stopped bleeding (If you we're), and got 20 hp!")
self:Remove()
end
end[/CODE]
Hello there, again... I need some help, again... This time, i have a little problem. Whenever i pick up the entity, it goes above 100 HP, so, what i need, is some line of code that stops it from going above 100?
Any help would be wonderful, thanks :D
[QUOTE=man with hat;50467239][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/math/Clamp]math.Clamp[/url]
[lua]activator:SetHealth(math.Clamp(activator:Health() + 20, 0, activator:GetMaxHealth()))[/lua][/QUOTE]
Thanks a lot man!
Sorry, you need to Log In to post a reply to this thread.