nk0zkh0z Posted May 18, 2015 Share Posted May 18, 2015 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
Mann56 Posted May 18, 2015 Share Posted May 18, 2015 I want to change the time afk. So here '600000' is how many seconds? 600000 milliseconds = 600 seconds = 10 minutes Link to comment
Walid Posted May 18, 2015 Share Posted May 18, 2015 I want to change the time afk. So here '600000' is how many seconds? 1 millisecond = 0.001 seconds next time before you start posting questions like that use google I recommend you to check this : Milliseconds to Seconds Conversion Calculator Link to comment
ALw7sH Posted May 18, 2015 Share Posted May 18, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now