Jump to content

getPlayerIdleTime [bugged?]


Castillo

Recommended Posts

Posted

Hi, today I wanted to implement this function as a replacement of my AFK script, but for some reason the function is not reseting the time after the player leaves, I connect to the server and pum, kicked for being "Idle".

Posted
function checkAFKPlayers() 
    for index, thePlayer in ipairs(getElementsByType("player"))do -- Loop all online players 
        if (getPlayerIdleTime(thePlayer) > 300000) then -- Player hasn't moved for 300,000ms (5 minutes) 
            kickPlayer(thePlayer, "Idle for 5 minutes") -- Kick the idle player 
        end 
    end 
end 
setTimer(checkAFKPlayers, 30000, 0) -- Timer to execute every 30 seconds, checking for idlers 

Posted

Dude, do you think I'm one of these newbies who comes here to ask for help with all their problems? Nah, I come here ONLY when I have tried it all.

And btw, copying a wiki example WON'T HELP ME.

Now, please everyone who doesn't have idea of what is this about, DON'T REPLY.

Posted

Solidsnake is one of the most talented scripters, so don't think that copying from the wiki, or creating something same by yourself is going to work; he has tried everything there can be, and now asking for solutions from other scripters who may have solved this.

However, this is the wrong place to post.

Report it up at Mantis or PM one of the developers who are involved with functions.

Posted

I don't have any experience in MTA Scripts yet (Lua), but still have the basic programming/scripting knowledge. Anyway, try setting or manually deleting the Player Idle Time varible to 0 when the player leaves?

setPlayerIdleTime maybe?

Either that or just create/use your own varibles...

Posted
i tried it , and it works fine for me ! , using latest 1.2 version

If you tried it and it works fine on you, mind giving us something to work on?

How are we going to solve this without any help. Scripting forum is for help, not to say that you know the answer and you're not going to share it until we solve it with nothing to work with.

Posted
i tried it , and it works fine for me ! , using latest 1.2 version

If you tried it and it works fine on you, mind giving us something to work on?

How are we going to solve this without any help. Scripting forum is for help, not to say that you know the answer and you're not going to share it until we solve it with nothing to work with.

i used the example that Evil-Cod3r posted and when i reconnect the idle time is reset'ed

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