getWaterColor | Multi Theft Auto: Wiki Skip to content

getWaterColor

Client-side
Server-side
Shared

Pair: setWaterColor

Manual Review Required

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


This function returns the water color of the GTA world.

OOP Syntax Help! I don't understand this!

  • Method:water:getColor(...)

Syntax

int,​ int,​ int,​ int getWaterColor ( )

Returns

  • int: value1
  • int: value2
  • int: value3
  • int: value4

Returns 4 ints , indicating the color of the water. (RGBA)

Code Examples

shared
function waterColor ()
local r,g,b,a = getWaterColor ()
if ( r and g and b and a ) then -- If color is true
-- Output of the value of the water color to the chat
outputChatBox ( "The color of water is: "..math.ceil(r)..", "..math.ceil(g)..", "..math.ceil(b)..", "..math.ceil(a).."", r, g, b )
else
-- Notify the player if the value of the colors is false
outputChatBox ( "Failed to get the color of water!" )
end
end
-- Add command handler for the function
addCommandHandler("watercolor", waterColor )