WaterClient1 output

getWaterHeight

GET_WATER_HEIGHT0xF6829842C06AE524

The 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.

SignatureJavaScript
getWaterHeight(x: number, y: number, z: number): [ok: boolean, height: number]
SignatureLua
getWaterHeight(x: number, y: number, z: number): boolean, number

Usage

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

ParameterTypeJavaScriptLua
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber

Returns

2 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1okBOOLbooleanbooleanThe native’s own return value.
2heightfloatnumbernumberoutput

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

Open in the interactive natives reference