M MY Multiplayer: Wiki
Side
Kind

isPedOnGround

Shared

Tells whether a ped or player is on the ground.

bool isPedOnGround(ped ped [, bool checkVehicles = false])

Parameters

NameTypeDescription
pedpedThe ped or player.
checkVehiclesbooltrue to also count the ped standing on another entity, such as a vehicle. Only has an effect on the client.default false

Returns

true if it is on the ground, false if not or if there is no state to read.

On the client, the ped is on the ground when it is at most 1 metre above the ground beneath it. On the server, the last state the client synced is used: the ped is on the ground when it is not in the air, swimming or on a ladder.

Example

bindKey("space", "down", function()
    if not isPedOnGround(localPlayer, true) then
        print("Already in the air")
    end
end)

See also