IsPlayerOnGround: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer''' | *'''thePlayer:''' The [[player]] you are checking. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the player is on the ground, ''false'' otherwise | Returns ''true'' if the player is on foot and on the ground, ''false'' otherwise, even if he is in a vehicle capable of flying. | ||
==Example== | ==Example== | ||
This | This example checks if the player who enters the 'amiflying' command is on the ground and outputs a message. | ||
<syntaxhighlight lang="lua"> [lua] | <syntaxhighlight lang="lua"> [lua] | ||
function isHeFlying ( source, key ) | function isHeFlying ( source, key ) | ||
if ( isPlayerOnGround ( source ) ) then | |||
outputChatBox ( "No, you're not flying, you're just stoned!" ) | |||
else | |||
outputChatBox ( "Is it a bird, is it a plane... No it's " .. getClientName ( source ) .. "!" ) | |||
end | |||
end | end | ||
addCommandHandler ( "amiflying", isHeFlying ) | addCommandHandler ( "amiflying", isHeFlying ) |
Revision as of 20:20, 16 August 2007
This function is used to determine whether or not a player is on the ground. This is for on-foot usage only.
Syntax
bool isPlayerOnGround ( player thePlayer )
Required Arguments
- thePlayer: The player you are checking.
Returns
Returns true if the player is on foot and on the ground, false otherwise, even if he is in a vehicle capable of flying.
Example
This example checks if the player who enters the 'amiflying' command is on the ground and outputs a message.
[lua] function isHeFlying ( source, key ) if ( isPlayerOnGround ( source ) ) then outputChatBox ( "No, you're not flying, you're just stoned!" ) else outputChatBox ( "Is it a bird, is it a plane... No it's " .. getClientName ( source ) .. "!" ) end end addCommandHandler ( "amiflying", isHeFlying )
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