IsPlayerOnGround: Difference between revisions
Jump to navigation
Jump to search
m (Visual improvement) |
|||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function is used to determine whether or not a player is on the ground. | {{Server client function}} | ||
{{Deprecated|isPedOnGround}} | |||
This function is used to determine whether or not a player is on the ground. This is for on-foot usage only. | |||
==Syntax== | ==Syntax== | ||
<section name="Server and client" class="both" show="true"> | |||
<syntaxhighlight lang="lua">bool isPlayerOnGround ( player thePlayer )</syntaxhighlight> | <syntaxhighlight lang="lua">bool isPlayerOnGround ( player thePlayer )</syntaxhighlight> | ||
===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. | ||
</section> | |||
==Example== | ==Example== | ||
<section name="Serverside example" class="server" show="true"> | |||
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 ( sourcePlayer ) | |||
function isHeFlying ( | if ( isPlayerOnGround ( sourcePlayer ) ) then | ||
outputChatBox ( "No, you're not flying, you're just stoned!", sourcePlayer ) | |||
else | |||
outputChatBox ( "Is it a bird, is it a plane... No it's " .. getClientName ( sourcePlayer ) .. "!", sourcePlayer ) | |||
end | |||
end | end | ||
addCommandHandler ( "amiflying", isHeFlying ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Latest revision as of 11:49, 26 June 2014
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use isPedOnGround instead. |
This function is used to determine whether or not a player is on the ground. This is for on-foot usage only.
Syntax
Click to collapse [-]
Server and clientbool 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
Click to collapse [-]
Serverside exampleThis example checks if the player who enters the 'amiflying' command is on the ground and outputs a message.
[lua] function isHeFlying ( sourcePlayer ) if ( isPlayerOnGround ( sourcePlayer ) ) then outputChatBox ( "No, you're not flying, you're just stoned!", sourcePlayer ) else outputChatBox ( "Is it a bird, is it a plane... No it's " .. getClientName ( sourcePlayer ) .. "!", sourcePlayer ) 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