IsPedOnGround

From Multi Theft Auto: Wiki
Revision as of 17:23, 30 March 2008 by Arc (talk | contribs) (New page: __NOTOC__ {{Client function}} This function is used to determine whether or not a ped is on the ground. This is for on-foot usage only. ==Syntax== <syntaxhighlight lang="lua"> bool isPedOnGround ( ped the...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function is used to determine whether or not a ped is on the ground. This is for on-foot usage only.

Syntax

bool isPedOnGround ( ped thePed )

Required Arguments

  • thePed: The ped you are checking.

Returns

Returns true if the ped is on foot and on the ground, false otherwise, even if he is in a car that stands still.

Example

This example checks if the player who enters the 'amiflying' command is on the ground and outputs a message.

function isHeFlying ( sourcePlayer )
    if ( isPedOnGround ( 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 " .. getPlayerName ( sourcePlayer ) .. "!", sourcePlayer )
    end
end
addCommandHandler ( "amiflying", isHeFlying )

See Also