GetWaterColor: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Server client function}} This function returns the water color of the GTA world. '''Note:''' The server can only return the water color, if it has actually been set ...") |
m (fix oop) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 9: | Line 9: | ||
int, int, int, int getWaterColor ( ) | int, int, int, int getWaterColor ( ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[water]]:getColor||setWaterColor}} | |||
===Returns=== | ===Returns=== | ||
Line 14: | Line 16: | ||
==Example== | ==Example== | ||
These two examples adds the command ''watercolor'' which get water color(RGBA) and show in chat. | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
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 ) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | 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).."", getRootElement(), 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 ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Client water functions}} | {{Client water functions}} |
Latest revision as of 15:02, 7 August 2016
This function returns the water color of the GTA world.
Note: The server can only return the water color, if it has actually been set by script.
Syntax
int, int, int, int getWaterColor ( )
OOP Syntax Help! I don't understand this!
- Method: water:getColor(...)
- Counterpart: setWaterColor
Returns
Returns 4 ints, indicating the color of the water. (RGBA)
Example
These two examples adds the command watercolor which get water color(RGBA) and show in chat.
Click to collapse [-]
Clientfunction 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 )
Click to collapse [-]
Serverfunction 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).."", getRootElement(), 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 )
See Also
- getWaterLevel
- isWaterDrawnLast
- setWaterDrawnLast
- Shared
- createWater
- getWaterColor
- getWaterVertexPosition
- getWaveHeight
- resetWaterColor
- resetWaterLevel
- setWaterColor
- setWaterLevel
- setWaterVertexPosition
- setWaveHeight