GetGroundZExcludingObjectsFor3dCoord
Docslocal retval, groundZ = GetGroundZExcludingObjectsFor3dCoord(x, y, z, waterAsGround)Description
Introduced in build 505
Determines the highest ground Z-coordinate directly below a specified 3D coordinate, excluding any objects at that point. Optionally, water can be considered as ground when determining the highest point.
NativeDB Added Parameter 6: BOOL ignoreDistToWaterLevelCheck - If set to true, the distance to the water level will be ignored when checking for water as ground.
Parameters
| Name | Type | Description |
|---|---|---|
x | float | X-coordinate of the point to check. |
y | float | Y-coordinate of the point to check. |
z | float | Z-coordinate of the point to check. |
groundZ | float* | A pointer to a float where the ground Z-coordinate will be stored if found. |
waterAsGround | BOOL | If set to `true`, water will be included in the check, and its height will be returned if it is higher than the ground level. |
Quick Snippet: Get Coordinatesxyz
xyzAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Returns
BOOLReturns TRUE (1) or FALSE (0).