Jump to content
Mr. Green Gaming

Human Spawn Protection


Recommended Posts

cl_init ----

function HUDPaint()

(...)

if MySelf:Alive() then
local Timp = GetGlobalInt("ProtTime") - CurTime()
if (ProtBool == true ) and ( math.Round(Timp) > 0 ) then
for i=1,2 do
draw.SimpleText("Protection: "..math.ceil(Timp).."", "FontHUD", w*0.4950+math.random(-1,1), h*0.8+math.random(-1,1), Color (0, 255, 0),TEXT_ALIGN_CENTER)
end
end


if (ProtBool == true ) and ( math.Round(Timp) <= 0 ) then
for i=1,2 do
draw.SimpleText("Protection has faded!", "FontHUD", w*0.4950+math.random(-1,1), h*0.8+math.random(-1,1), Color (0, 255, 0),TEXT_ALIGN_CENTER)
end
end
end

(...)

end


function RecProtTime(um)
ProtBool = um:ReadBool()
end

usermessage.Hook("RecProtTime", RecProtTime)

obj_ply_extended.lua ------

function meta:Redeem()

(..) -- after self:Spawn()

if math.Round(INFLICTION*10) > 0 and math.Round(INFLICTION*10) ~= 20 then

ProtBool = true

SetGlobalInt("ProtTime", math.Round((INFLICTION*20))+CurTime())
self:GodEnable()

umsg.Start ("RecProtTime",self)
umsg.Bool (ProtBool)
umsg.End()

timer.Create(self:UserID().."HumanSpawnProtection", math.Round((INFLICTION*20))+1, 1, function()
if self:IsValid() and self:IsPlayer() then
self:GodDisable()
end
ProtBool = false

umsg.Start ("RecProtTime",self)
umsg.Bool (ProtBool)
umsg.End()

end)

end

end

Edited by -N7-BloodGuard Deluvas
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...