Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------------
- AFK_TIME = 60
- AFK_WARN_TIME = 20
- --------------------------------------------------
- hook.Add("PlayerInitialSpawn", "MakeAFKVar", function(ply)
- ply.NextAFK = CurTime() + AFK_TIME
- end)
- hook.Add("Think", "HandleAFKPlayers", function()
- for _, ply in pairs (player.GetAll()) do
- if ( ply:IsConnected() and ply:IsFullyAuthenticated() ) then
- if ( IsValid(ply) && ply:IsPlayer() ) then
- if ply:Team() == 2 then
- if (!ply.NextAFK) then
- ply.NextAFK = CurTime() + AFK_TIME
- end
- local afktime = ply.NextAFK
- if (CurTime() >= afktime - AFK_WARN_TIME) and (!ply.Warning) then
- ply:ChatPrint("Attention: Ne restez pas immobile vous risquez de prendre feu :) .")
- ply.Warning = true
- elseif (CurTime() >= afktime) and (ply.Warning) then
- ply.Warning = nil
- ply.NextAFK = nil
- ply:ChatPrint("Vous êtes immobile depuis 1 minute.\n")
- ply:Ignite(30)
- on_fire = 1
- end
- end
- end
- end
- end
- end)
- hook.Add("KeyPress", "PlayerMoved", function(ply, key)
- if on_fire == 1 then
- ply:Extinguish()
- on_fire = 0
- end
- ply.NextAFK = CurTime() + AFK_TIME
- ply.Warning = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement