ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getWaterLevel

Function

getWaterLevel

Server and clientWorldModified from MTA:SA

Returns the water level stored with setWaterLevel; when not set, for a given point it returns 0 (sea level).

Syntax

float getWaterLevel([float x = nil, float y = nil, float z = nil])

Arguments

xfloat, optional = nil
Point X coordinate.
yfloat, optional = nil
Y coordinate.
zfloat, optional = nil
Z coordinate.

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool ignoreDistanceToWaterThreshold = false

In MTA:SA

getWaterLevel(float posX, float posY, float posZ, bool ignoreDistanceToWaterThreshold = false)

Returns

The water level, or false (no point and nothing set).

Example

local x, y, z = 2000, -1700, 5
if z < getWaterLevel(x, y, z) then outputDebugString("Pod woda") end

Notes

Client. In a client script the water height comes from the game (with waves when checkWaves = true); false when there is no water there or the point is over 100 m above it.

See also