GetGroundHeight

From GT-MP
Jump to: navigation, search
GetGroundHeight
Client-Side Function
System-users.png Client-Side Javascript.png JavaScript

Gets the height of the ground at the given position of the map.

NOTE: The player has to be near the GetGroundHeight-Position, otherwise it will return 0.


Syntax

API.getGroundHeight(Vector3 position);

Required Arguments

  • position: parameter input should be in Vector3 type.

NOTE: This function returns data in float type.

Usage example(s)

API.onServerEventTrigger.connect(function (evName, args) {
    switch (evName) {
        case "printGroundHeight":
            var pos = API.getEntityPosition(API.getLocalPlayer());
            var height = API.getGroundHeight(pos);
            API.sendChatMessage("The floor under you is at height ~b~" + height);
            break;
    }
});

References