Hi, I’m using a script to get the player out if this AFK is.
But I just want you to take out the users, not the administrators
Here is the server.lua:
RegisterServerEvent("kickForBeingAnAFKDouchebag")
AddEventHandler("kickForBeingAnAFKDouchebag", function()
DropPlayer(source, "You were AFK for too long.")
end)
Here is the client.lua:
-- CONFIG --
-- AFK Kick Time Limit (in seconds)
secondsUntilKick = 180
-- Warn players if 3/4 of the Time Limit ran up
kickWarning = true
-- CODE --
Citizen.CreateThread(function()
while true do
Wait(1000)
playerPed = GetPlayerPed(-1)
if playerPed then
currentPos = GetEntityCoords(playerPed, true)
if currentPos == prevPos then
if time > 0 then
if kickWarning and time == math.ceil(secondsUntilKick / 4) then
TriggerEvent("chatMessage", "WARNING", {255, 0, 0}, "^1You'll be kicked in " .. time .. " seconds for being AFK!")
end
time = time - 1
else
TriggerServerEvent("kickForBeingAnAFKDouchebag")
end
else
time = secondsUntilKick
end
prevPos = currentPos
end
end
end)
Thank you and I’m sorry for my english