Skip to main content

Entity::getHeightAboveGround

Client-side function

JavaScript​

The getHeightAboveGround function returns the entity’s height above the ground level in meters, making it straightforward to interpret the result as a metric measurement. This function can be useful for determining altitude in various gameplay scenarios, such as checking if a player or vehicle is flying above a certain threshold.

Required Params​

  • None

Return Value​

  • float – Height in meters above ground level.

Syntax​

entity.getHeightAboveGround();

Example​

// Example usage of getHeightAboveGround

let heightAboveGround = mp.players.local.getHeightAboveGround();
mp.gui.chat.push("Height above ground: " + heightAboveGround.toFixed(2) + " meters");