getWaterHeight
GET_WATER_HEIGHT0xF6829842C06AE524The GTA V native GET_WATER_HEIGHT of the WATER namespace, as LS:MP client scripts call it: the global function getWaterHeight, in JavaScript and in Lua.
getWaterHeight(x: number, y: number, z: number): [ok: boolean, height: number]getWaterHeight(x: number, y: number, z: number): boolean, numberUsage
JavaScript
const [ok, height] = getWaterHeight(x, y, z);Lua
local ok, height = getWaterHeight(x, y, z)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
JavaScript · with vectors
const [ok, height] = getWaterHeight(pos);Lua · with vectors
local ok, height = getWaterHeight(pos)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x | float | number | number |
y | float | number | number |
z | float | number | number |
Returns
2 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | ok | BOOL | boolean | boolean | The native’s own return value. |
| 2 | height | float | number | number | output |
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
This function set height to the value of z-axis of the water surface.
This function works with sea and lake. However it does not work with shallow rivers (e.g. raton canyon will return -100000.0f)
note: seems to return true when you are in water
Reference
- Namespace
- Water WATER
- In the game
BOOL GET_WATER_HEIGHT(float x, float y, float z, float* height)- Hash
0xF6829842C06AE524