Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. ////////////server side
  2.  
  3.  
  4.  
  5. function HG.AFK(ply,cmd,args)
  6.  
  7.     if !ply:Alive() then return end
  8.     if ply.AFK == false or ply.AFK == nil then
  9.         ply:SetNWString( "AFK", 1 )
  10.         ply.AFK = true         
  11.         umsg.Start("hg_startafk",ply)
  12.         umsg.End()
  13.     else
  14.         ply:SetNWString( "AFK", 0 )
  15.         ply.AFK = false        
  16.         umsg.Start("hg_stopafk",ply)
  17.         umsg.End()
  18.  
  19. ply:Freeze(ply.AFK)
  20.  
  21. end
  22.  
  23. concommand.Add("hg_afk",HG.AFK)
  24. AddChatCommand("!afk", HG.AFK)
  25.  
  26. //////////////////client side
  27.  
  28.  
  29. function HG.AFKOverlay()
  30.     if !AFKFadeIn and !AFKFadeOut then return end
  31.     if AFKFadeIn and AFKFade < 250 then
  32.         AFKFade = AFKFade + 5
  33.     elseif AFKFadeIn and AFKFade >= 255 then
  34.         AFKFadeIn = false
  35.     end
  36.  
  37.     if AFKFadeOut and AFKFade > 0 then
  38.         AFKFade = AFKFade - 5
  39.     elseif AFKFadeOut and AFKFade <= 0 then
  40.         AFKFadeOut = false
  41.     end
  42.  
  43.     surface.SetDrawColor(0,0,0,AFKFade)
  44.     surface.DrawRect(0,0,ScrW(),ScrH())
  45.  
  46.     draw.SimpleText("AFK","ScoreboardSub",ScrW() / 2, ScrH() / 2, Color(255,255,255,AFKFade),1,1)
  47. end
  48.  
  49. hook.Add("HUDPaint","hg_afkoverlay",HG.AFKOverlay)
  50.  
  51. function HG.StartAFK(um)
  52.     AFKFadeIn = true
  53.     AFKFade = 0
  54. end
  55.  
  56. usermessage.Hook("hg_startafk",HG.StartAFK)
  57.  
  58. function HG.StopAFK(um)
  59.     AFKFadeOut = true
  60.     AFKFade = 255
  61. end
  62.  
  63. usermessage.Hook("hg_stopafk",HG.StopAFK)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement