Jump to content

I want to change the time afk.


Recommended Posts

Posted

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 

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

600000 milliseconds = 600 seconds = 10 minutes

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted
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

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
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 

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...