Create auto-heal.txt
This commit is contained in:
parent
c7cb18e1ce
commit
1abde80771
1 changed files with 28 additions and 0 deletions
28
auto-heal.txt
Normal file
28
auto-heal.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
--@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,0,function()
|
||||
canHeal = 1
|
||||
end)
|
||||
end
|
||||
end)
|
||||
hook.add("think","",function()
|
||||
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)
|
||||
Loading…
Add table
Reference in a new issue