testLineAgainstWater | Multi Theft Auto: Wiki Skip to content

testLineAgainstWater

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function checks to see if a line between two points collides with the water. This is similar to processLineOfSight, but only collides with water. Waves are not taken into account when testing the line.

Syntax

testLineAgainstWater ( )

Code Examples

client

This code snippet adds a /isanywaterbelowme command, which checks if there is water at 500 units below the ground at the position of the player who types it.

function checkForWater()
if isPedOnGround(localPlayer) then
local px, py, pz = getElementPosition(localPlayer)
if testLineAgainstWater(px, py, pz, px, py, pz - 500) then
outputChatBox("Yes, there is water below you.")
else
outputChatBox("This place looks a bit dry.")
end
end
end
addCommandHandler("isanywaterbelowme", checkForWater)

See Also

World Functions