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

Function

testLineAgainstWater

Server and clientWorldIdentical to MTA:SA

Checks whether a segment crosses the water surface (by the level from getWaterLevel) and returns the crossing point.

Syntax

bool, float, float, float testLineAgainstWater(float sx, float sy, float sz, float ex, float ey, float ez)

Arguments

sxfloat
Start X.
syfloat
Start Y.
szfloat
Start Z.
exfloat
End X.
eyfloat
End Y.
ezfloat
End Z.

Returns

true and a point x, y, z, or false.

Example

local hit, x, y, z = testLineAgainstWater(2900, -2000, 10, 2900, -2000, -10)
if hit then outputDebugString("Woda na wysokosci " .. z) end

Notes

Client. In a client script it checks the game's water.

See also