Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////server side
- function HG.AFK(ply,cmd,args)
- if !ply:Alive() then return end
- if ply.AFK == false or ply.AFK == nil then
- ply:SetNWString( "AFK", 1 )
- ply.AFK = true
- umsg.Start("hg_startafk",ply)
- umsg.End()
- else
- ply:SetNWString( "AFK", 0 )
- ply.AFK = false
- umsg.Start("hg_stopafk",ply)
- umsg.End()
- ply:Freeze(ply.AFK)
- end
- concommand.Add("hg_afk",HG.AFK)
- AddChatCommand("!afk", HG.AFK)
- //////////////////client side
- function HG.AFKOverlay()
- if !AFKFadeIn and !AFKFadeOut then return end
- if AFKFadeIn and AFKFade < 250 then
- AFKFade = AFKFade + 5
- elseif AFKFadeIn and AFKFade >= 255 then
- AFKFadeIn = false
- end
- if AFKFadeOut and AFKFade > 0 then
- AFKFade = AFKFade - 5
- elseif AFKFadeOut and AFKFade <= 0 then
- AFKFadeOut = false
- end
- surface.SetDrawColor(0,0,0,AFKFade)
- surface.DrawRect(0,0,ScrW(),ScrH())
- draw.SimpleText("AFK","ScoreboardSub",ScrW() / 2, ScrH() / 2, Color(255,255,255,AFKFade),1,1)
- end
- hook.Add("HUDPaint","hg_afkoverlay",HG.AFKOverlay)
- function HG.StartAFK(um)
- AFKFadeIn = true
- AFKFade = 0
- end
- usermessage.Hook("hg_startafk",HG.StartAFK)
- function HG.StopAFK(um)
- AFKFadeOut = true
- AFKFade = 255
- end
- usermessage.Hook("hg_stopafk",HG.StopAFK)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement