'~DaLesTe^' Posted May 31, 2015 Share Posted May 31, 2015 when I type the command / back I did not go back to the AFK and says I'm not AFK " function PosTime(source) local pos1 = getElementPosition(source) if (pos == pos1) then outputChatBox ( "You are AFK use /back to exit AFK mode", source, 0, 255, 0) setElementFrozen (source, true) setElementDimension (source, -- s8) --> setElementData(source, "", 1) else outputChatBox ( "You moved", source, 255, 0, 0) end end function afkGo(source) pos = getElementPosition(source) outputChatBox ( "Wait 5 seconds without moving", source, 0, 255, 0) setTimer(PosTime,5000,1,source) end addCommandHandler('afk', afkGo) function afkExit(source) local away = getElementData(source, "back") if (away == 0) then outputChatBox ( "", source, 0, 255, 0) if isElementFrozen ( source ) and getElementData(player,"back") then setElementFrozen ( source, false ) setElementDimension (source,0) setElementData (source,"back",0) else outputChatBox ( "Dont AFK", source, 0, 255, 0) end end end end addCommandHandler('back', afkExit) function awayList(source) local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do local afk = getElementData(aPlayer, "afk") if (afk == 1) then outputChatBox ( "tst", source) end end end addCommandHandler('dbug1', awayList) 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