From 1abde80771eb675017ecc428475e19476dc76fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5BMEF=5D=20=D0=BC=D0=B5=D1=85=D1=80=D0=BE=D0=B1?= <124378025+happy1063@users.noreply.github.com> Date: Tue, 26 Nov 2024 06:41:04 +0300 Subject: [PATCH] Create auto-heal.txt --- auto-heal.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 auto-heal.txt diff --git a/auto-heal.txt b/auto-heal.txt new file mode 100644 index 0000000..f45968b --- /dev/null +++ b/auto-heal.txt @@ -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)