setWaterLevel | Multi Theft Auto: Wiki Skip to content

setWaterLevel

Client-side
Server-side
Shared
Needs checking

This function was partially migrated from the old wiki. Please review manually:

  • Missing section: Alternate client-only syntax

Pair: getWaterLevel

This page is incomplete! Help wanted!

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


Sets the height of some or all the water in the game world.

Note

When the water level is 0, the standard GTA rendering is performed so that water is visible when viewed through translucent surfaces, such as vehicle windows. However, some MTA custom objects placed underwater will appear in front of the water. Setting the water level to any non-zero value (i.e. setWaterLevel(0.001) ) forces alternative rendering and MTA custom objects placed underwater will be drawn correctly.

Syntax

setWaterLevel ( )

Code Examples

server

This example code will slowly drain away all rivers and seas.

local level = 0
function drainSomeWater()
level = level - 0.01
setWaterLevel ( level )
end
setTimer ( drainSomeWater, 100, 15000 )