Hello, I am using this script but I need it not to kick an admin on the server. I am using VRP Framework and added myself in the group “Admin” in the database. I am also using EasyAdmin Admin Menu. I am having trouble finding out how can I change the script so it only acts if the player is not an Admin.
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!