Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Client side
- if timer.Exists("isAFK33") then
- timer.Destory("isAFK33")
- end
- local isAFKOnce = 0
- timer.Simple(4,function()
- timer.Create("isAFK33",1800,0,function()
- print("If you got kicked by accident and you are watching the console, please let bob know!")
- print("For Bob, the variable was: ".. isAFKOnce)
- net.Start("Kick_afk_network_bob")
- net.WriteInt(isAFKOnce,2)
- net.SendToServer()
- isAFKOnce = 1
- end)
- end)
- hook.Add("KeyPress","AFK_Main",function(ply)
- timer.Stop("isAFK33")
- timer.Start("isAFK33")
- isAFKOnce = 0
- end)
- Server Side
- util.AddNetworkString("Kick_afk_network_bob")
- net.Receive("Kick_afk_network_bob", function(len,ply)
- local IsDemoted = net.ReadInt(2)
- if IsDemoted == 0 then
- ply:changeTeam(TEAM_CITIZEN,true)
- ply:PrintMessage(HUD_PRINTTALK, "You have been demoted because you were AFK for more than 30 minutes!")
- end
- if IsDemoted == 1 then
- ply:Kick("You have been AFK for over an hour!")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement