IsPlayerOnGround: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 9: Line 9:


===Returns===
===Returns===
Returns ''true'' if the player is on the ground, ''false'' otherwise.
Returns ''true'' if the player is on the ground, ''false'' otherwise and if he is in a vehicle capable of flying.


==Example==
==Example==
This examle 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]
addCommandHandler ( "amiflying", "isHeFlying" )
function isHeFlying ( source, key )
function isHeFlying ( source, key )
   if ( isPlayerOnGround ( source ) ) then
   if ( isPlayerOnGround ( source ) ) then
Line 21: Line 21:
   end
   end
end
end
addCommandHandler ( "amiflying", isHeFlying )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Revision as of 18:42, 30 July 2007

This function is used to determine whether or not a player is on the ground.

Syntax

bool isPlayerOnGround ( player thePlayer )

Required Arguments

  • thePlayer: The player you are checking.

Returns

Returns true if the player is on the ground, false otherwise and if he is in a vehicle capable of flying.

Example

This examle 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 its " .. getClientName ( source ) )
  end
end
addCommandHandler ( "amiflying", isHeFlying )

See Also