SetSunColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server client function}} This function is used to set the color of the sun. ==Syntax== <syntaxhighlight lang="lua"> bool setSunColor ( int Red, int Green, int Blue ) </syntaxhighlight> ===Re...")
 
No edit summary
 
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setSunColor ( int Red, int Green, int Blue )
bool setSunColor ( int aRed, int aGreen, int aBlue, int bRed, int bGreen, int bBlue  )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===  
===Required Arguments===  
*'''Red:''' The amount of red (0-255) you want the sun to be.
*'''aRed:''' The amount of red (0-255) you want the sun to be.
*'''Green:''' The amount of green (0-255) you want the sun to be.
*'''aGreen:''' The amount of green (0-255) you want the sun to be.
*'''Blue:''' The amount of blue (0-255) you want the sun to be.
*'''aBlue:''' The amount of blue (0-255) you want the sun to be.
*'''bRed:''' The amount of red (0-255) you want the sun to be.
*'''bGreen:''' The amount of green (0-255) you want the sun to be.
*'''bBlue:''' The amount of blue (0-255) you want the sun to be.


===Returns===
===Returns===
Line 19: Line 22:
This example lets any player set the color of the sun like /setsuncolor 255 0 0
This example lets any player set the color of the sun like /setsuncolor 255 0 0
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function commandSetSunColor(player, command, r, g, b)
function commandSetSunColor(player, command, r, g, b, r2, g2, b2)
     local r, g, b = tonumber(r), tonumber(g), tonumber(b)
     local r, g, b, r2, g2, b2 = tonumber(r), tonumber(g), tonumber(b), tonumber(r2), tonumber(g2), tonumber(b2)
     if (r and g and b) then
     if (r and g and b and r2 and g2 and b2) then
         setSunColor(r, g, b)
         setSunColor(r, g, b, r2, g2, b2)
         outputChatBox("Color of sun now set", player, 0, 255, 0)
         outputChatBox("Color of sun now set", player, 0, 255, 0)
     else
     else
         outputChatBox("Usage: /setsuncolor r g b (eg: /setsuncolor 255 0 0)", player, 255, 0, 0)
         outputChatBox("Usage: /setsuncolor r g b r2 g2 b2 (eg: /setsuncolor 255 0 0 255 0 0)", player, 255, 0, 0)
     end
     end
end
end

Latest revision as of 19:24, 14 March 2011

This function is used to set the color of the sun.

Syntax

bool setSunColor ( int aRed, int aGreen, int aBlue, int bRed, int bGreen, int bBlue  )

Required Arguments

  • aRed: The amount of red (0-255) you want the sun to be.
  • aGreen: The amount of green (0-255) you want the sun to be.
  • aBlue: The amount of blue (0-255) you want the sun to be.
  • bRed: The amount of red (0-255) you want the sun to be.
  • bGreen: The amount of green (0-255) you want the sun to be.
  • bBlue: The amount of blue (0-255) you want the sun to be.

Returns

Returns true if the color of the sun was set, false otherwise.

Example

This example lets any player set the color of the sun like /setsuncolor 255 0 0

function commandSetSunColor(player, command, r, g, b, r2, g2, b2)
    local r, g, b, r2, g2, b2 = tonumber(r), tonumber(g), tonumber(b), tonumber(r2), tonumber(g2), tonumber(b2)
    if (r and g and b and r2 and g2 and b2) then
        setSunColor(r, g, b, r2, g2, b2)
        outputChatBox("Color of sun now set", player, 0, 255, 0)
    else
        outputChatBox("Usage: /setsuncolor r g b r2 g2 b2 (eg: /setsuncolor 255 0 0 255 0 0)", player, 255, 0, 0)
    end
end
addCommandHandler("setsuncolor", commandSetSunColor)

See Also