createWater | Multi Theft Auto: Wiki Skip to content

createWater

Client-side
Server-side
Shared

Manual Review Required

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


Creates an area of water.

Note

X and Y positions will be changed to an even integer. i.e. -2, 0, 2, 4 etc.

Important

If you're working with dimensions, be sure to apply it by using setElementDimension .

OOP Syntax Help! I don't understand this!

Syntax

water createWater ( float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, [ bool bShallow = false ] )
Required Arguments
  • x1: MISSING_PARAM_DESC
  • y1: MISSING_PARAM_DESC
  • z1: MISSING_PARAM_DESC
  • x2: MISSING_PARAM_DESC
  • y2: MISSING_PARAM_DESC
  • z2: MISSING_PARAM_DESC
  • x3: MISSING_PARAM_DESC
  • y3: MISSING_PARAM_DESC
  • z3: MISSING_PARAM_DESC
  • x4: MISSING_PARAM_DESC
  • y4: MISSING_PARAM_DESC
  • z4: MISSING_PARAM_DESC
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • bShallow (default: false): gives the water a shallow water effect.

Returns

  • water: value

Returns a water element if successful, false otherwise. The water element can be repositioned with setElementPosition and destroyed with destroyElement .

Code Examples

shared

Example code for creating a water area to cover the entire San Andreas Map (flood the cities). Also,setWaterLevelis used to raise the existing rivers and lakes.

-- Setting water properties.
height = 40
SizeVal = 2998
-- Defining variables.
southWest_X = -SizeVal
southWest_Y = -SizeVal
southEast_X = SizeVal
southEast_Y = -SizeVal
northWest_X = -SizeVal
northWest_Y = SizeVal
northEast_X = SizeVal
northEast_Y = SizeVal
-- OnClientResourceStart function that creates the water.
function thaResourceStarting( )
water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height )
setWaterLevel ( height )
end
addEventHandler("onClientResourceStart", resourceRoot, thaResourceStarting)