Advertisement
Guest User

Untitled

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