RedM Natives

GET_WATER_HEIGHT

Checks against a global variable that is set by _SET_WORLD_WATER_TYPE.

Hash0xFCA8B23F28813F69
Runtime nameGetWaterHeight
NamespaceWATER
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0xF6829842C06AE524

Signature

BOOL GET_WATER_HEIGHT(float x, float y, float z, float* height);

Parameters

NameTypeDescription
xfloat—
yfloat—
zfloat—
heightfloat*—

Returns BOOL

Description

Checks against a global variable that is set by _SET_WORLD_WATER_TYPE. If that is set to one it will fail. Likely not the only issue but part of it.

Usage

Lua
local retval, height = GetWaterHeight(x, y, z, height)

-- always works, by hash
local retval, height = Citizen.InvokeNative(0xFCA8B23F28813F69, x, y, z, Citizen.PointerValueFloatInitialized(height), Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, height] = GetWaterHeight(x, y, z, height);

// by hash
const [retval, height] = Citizen.invokeNative('0xFCA8B23F28813F69', x + 0.0000001, y + 0.0000001, z + 0.0000001, Citizen.pointerValueFloatInitialized(height), Citizen.returnResultAnyway());
C#
var height = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xFCA8B23F28813F69, x, y, z, height);
// height.GetResult<float>()
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.
  • The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.