Jump to content

I want to change the time afk.


Recommended Posts

I want to change the time afk. So here '600000' is how many seconds?

local pending = {} 
  
function checkAFK() 
    for thePlayer, isPending in pairs(pending) do 
        if (getPlayerIdleTime(thePlayer) >  600000) then 
            if exports.global:isPlayerFullAdmin(thePlayer) then 
                if getElementData(thePlayer, "adminduty") == 1 then 
                    exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "adminduty", 0, false) 
                    exports.global:sendMessageToAdmins("AdmDuty: " .. getPlayerName(thePlayer):gsub("_", " ") .. " went off duty (AFK).") 
                    exports.global:updateNametagColor(thePlayer) 
                end 
            else 
                triggerClientEvent(thePlayer, "accounts:logout", thePlayer, "You have been put to the character selection for being AFK.") 
            end 
        else 
            pending[thePlayer] = nil 
        end 
    end 

Link to comment
local pending = {} 
local afkTime = 30 -- In seconds 
  
function checkAFK() 
    for thePlayer, isPending in pairs(pending) do 
        if (getPlayerIdleTime(thePlayer) >  afkTime*1000) then 
            if exports.global:isPlayerFullAdmin(thePlayer) then 
                if getElementData(thePlayer, "adminduty") == 1 then 
                    exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "adminduty", 0, false) 
                    exports.global:sendMessageToAdmins("AdmDuty: " .. getPlayerName(thePlayer):gsub("_", " ") .. " went off duty (AFK).") 
                    exports.global:updateNametagColor(thePlayer) 
                end 
            else 
                triggerClientEvent(thePlayer, "accounts:logout", thePlayer, "You have been put to the character selection for being AFK.") 
            end 
        else 
            pending[thePlayer] = nil 
        end 
    end 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...