IsPedOnGround: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(added info about issue #8378)
m (Remove issues section, cause provided issue was solved)
 
(2 intermediate revisions by 2 users not shown)
Line 14: Line 14:
===Returns===
===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 or on object outside world map.
Returns ''true'' if the ped is on foot and on the ground, ''false'' otherwise, even if he is in a car that stands still or on object outside world map.
=== Issues ===
{{Issues|
{{Issue|8378|isPedOnGround issues}}
}}


==Example==
==Example==

Latest revision as of 11:51, 24 January 2026

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 )

OOP Syntax Help! I don't understand this!

Method: ped:isOnGround(...)
Variable: .onGround


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 or on object outside world map.

Example

Click to collapse [-]
Server

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