Starfall-chips/auto-heal.txt
[MEF] мехроб 776c592e05
Update auto-heal.txt
fixed bug
2024-11-26 07:15:55 +03:00

30 lines
727 B
Text

--@name heal
--@author cool-bro
--@server
--[[
automaticly heals player
--]]
local canHeal = 1
hook.add("PlayerHurt","",function(ply)
if ply == owner() then
timer.remove("on")
canHeal = 0
timer.create("on",5.2,0,function()
canHeal = 1
end)
end
end)
hook.add("think","",function()
if owner():isValid() and owner():isAlive() then
if prop.canSpawn() then
if canHeal == 1 and owner():getHealth() < 100 then
prop.createSent(owner():getPos(),Angle(0),"item_healthkit")
end
end
if prop.canSpawn() then
if canHeal == 1 and owner():getArmor() < 100 then
prop.createSent(owner():getPos(),Angle(0),"item_battery")
end
end
end
end)