GetPlayerIdleTime: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
'''Available only in MTA SA 1.2 and onwards''' | '''Available only in MTA SA 1.2 and onwards''' | ||
}} | }} | ||
This function gets the amount of time in | This function gets the amount of time in milliseconds that a players position has not changed. | ||
==Syntax== | ==Syntax== | ||
Line 15: | Line 15: | ||
===Returns=== | ===Returns=== | ||
Returns the amount of '''time in | Returns the amount of '''time in milliseconds''' that a player has been idle, '''false''' otherwise. | ||
==Example== | ==Example== |
Revision as of 11:17, 20 November 2011
Available only in MTA SA 1.2 and onwards This function gets the amount of time in milliseconds that a players position has not changed.
Syntax
int getPlayerIdleTime ( player thePlayer )
Required Arguments
- thePlayer: The player you wish to get the idle time of.
Returns
Returns the amount of time in milliseconds that a player has been idle, false otherwise.
Example
Click to collapse [-]
Serverside exampleThis example will kick a player if they don't move for 5 minutes and the resource has access to "function.kickPlayer"
function checkAFKPlayers() for index, thePlayer in ipairs(getElementsByType("player")) -- 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
Requirements
This template will be deleted.
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState