Castillo Posted December 18, 2011 Posted December 18, 2011 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". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Evil-Cod3r Posted December 18, 2011 Posted December 18, 2011 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 My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Castillo Posted December 18, 2011 Author Posted December 18, 2011 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Evil-Cod3r Posted December 18, 2011 Posted December 18, 2011 i dont get what you mean at the first topic My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Castillo Posted December 18, 2011 Author Posted December 18, 2011 Then why did you reply? to increase your post count? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Evil-Cod3r Posted December 18, 2011 Posted December 18, 2011 no Man iam just trying to help any one My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
JR10 Posted December 18, 2011 Posted December 18, 2011 Same problem here, it's bugged. Every time I enter, same idle time. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
myonlake Posted December 19, 2011 Posted December 19, 2011 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. If I helped you, please click the like button on the right Thanks!
ReZurrecti0n Posted December 19, 2011 Posted December 19, 2011 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...
Al3grab Posted December 19, 2011 Posted December 19, 2011 i tried it , and it works fine for me ! , using latest 1.2 version ING : [xXx]~Al3grab
myonlake Posted December 19, 2011 Posted December 19, 2011 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. If I helped you, please click the like button on the right Thanks!
Al3grab Posted December 19, 2011 Posted December 19, 2011 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 ING : [xXx]~Al3grab
NotAvailable Posted December 19, 2011 Posted December 19, 2011 (edited) --------------------------Removed Edited December 19, 2011 by Guest
BinSlayer1 Posted December 19, 2011 Posted December 19, 2011 You'll need to update again.. They just fixed this http://code.google.com/p/mtasa-blue/sou ... ail?r=3563
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