3B00DG4MER Posted March 12, 2014 Share Posted March 12, 2014 (edited) Hello,I made New System AFK IT's Work without Bugs But it doesn't get to Dimension 1 Server : 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) setElementDimension ( thePlayer, 1 ) outputChatBox("AFk Check") end end end setTimer(checkAFKPlayers, 30000, 0) -- Timer to execute every 30 seconds, checking for idlers Edited March 14, 2014 by Guest Link to comment
Chronos Posted March 12, 2014 Share Posted March 12, 2014 Try this setElementDimension ( source, 1 ) Link to comment
Saml1er Posted March 12, 2014 Share Posted March 12, 2014 function DimensionP (player, dimension) if isPedInVehicle (player) then local veh = getPedOccupiedVehicle (player) setElementDimension ( player, dimension ) setElementDimension ( veh, dimension ) else setElementDimension ( player, dimension ) end return true end 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) DimensionP ( thePlayer, 1 ) outputChatBox("AFk Check") end end end setTimer(checkAFKPlayers, 30000, 0) Link to comment
3B00DG4MER Posted March 13, 2014 Author Share Posted March 13, 2014 Can you made it if He Move will Go to Default Dimension setElementDimension ( thePlayer, 0 ) Link to comment
Controlled Posted March 14, 2014 Share Posted March 14, 2014 function DimensionP (player, dimension) if isPedInVehicle (player) then local veh = getPedOccupiedVehicle (player) setElementDimension ( player, dimension ) setElementDimension ( veh, dimension ) else setElementDimension ( player, dimension ) end return true end 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) DimensionP ( thePlayer, 1 ) outputChatBox("AFk Check") elseif ( getElementDimension ( thePlayer) == 1 ) and (getPlayerIdleTime(thePlayer) < 300000) then setElementDimension ( thePlayer, 0) end end end setTimer(checkAFKPlayers, 30000, 0) Link to comment
Ab-47 Posted March 14, 2014 Share Posted March 14, 2014 function checkAFKPlayers() for index, source in ipairs(getElementsByType("player"))do -- Loop all online players if (getPlayerIdleTime(source) > 300000) then -- Player hasn't moved for 300,000ms (5 minutes) DimensionP ( source, 1 ) outputChatBox("AFk Check") elseif ( getElementDimension ( source) == 1 ) and (getPlayerIdleTime(source) < 300000) then setElementDimension ( source, 0) end end end setTimer(checkAFKPlayers, 30000, 0) Try this, you haven't defined "thePlayer" either, but I replaced thePlayer with source which should get the local player. Not tested Link to comment
Moderators Citizen Posted March 14, 2014 Moderators Share Posted March 14, 2014 you haven't defined "thePlayer" either It was defined in the for loop: for index, thePlayer in ipairs(getElementsByType("player")) do Link to comment
3B00DG4MER Posted March 14, 2014 Author Share Posted March 14, 2014 Can you lock it mod please 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