SetSkyGradient: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Updated syntax)
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{Server client function}}
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function changes the sky color to a two-color gradient.


==Syntax==  
==Syntax==
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setSkyGradient ( int top red, int top green, int top blue, int bottom red, int bottom green, int bottom blue )
bool setSkyGradient ( [ int topRed = 0, int topGreen = 0, int topBlue = 0, int bottomRed = 0, int bottomGreen = 0, int bottomBlue = 0 ] )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''argumentName:''' description
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''argumentName2:''' description
*'''topRed:''' The ''red'' value of the upper part of the sky, from 0 to 255.
*'''argumentName3:''' description
*'''topGreen:''' The ''green'' value of the upper part of the sky, from 0 to 255.
*'''topBlue:''' The ''blue'' value of the upper part of the sky, from 0 to 255.
*'''bottomRed:''' The ''red'' value of the lower part of the sky, from 0 to 255.
*'''bottomGreen:''' The ''green'' value of the lower part of the sky, from 0 to 255.
*'''bottomBlue:''' The ''blue'' value of the lower part of the sky, from 0 to 255.


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if sky color was set correctly, ''false'' if invalid values were passed.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example sets the sky to a hot pink gradient.
This example does...
<section name="Client" class="client" show="true">
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function ClientStarted ()
blabhalbalhb --abababa
setSkyGradient( 200, 0, 100, 150, 0, 70 )
--This line does this...
end
mooo
addEventHandler( "onClientResourceStart", resourceRoot, ClientStarted )
</syntaxhighlight>
</syntaxhighlight>
</section>
This example will set a blue '''realistic sky'''.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
function ClientStarted ()
setSkyGradient( 60, 100, 196, 136, 170, 212 )
end
addEventHandler( "onClientResourceStart", resourceRoot, ClientStarted )
</syntaxhighlight>
</section>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{World functions}}
{{FunctionArea_functions}}
 
[[Category:Need_Syntax]]  -- leave this until syntax is available. Cannot document the function or event without syntax.
[[ru:setSkyGradient]]
[[Category:Incomplete]] -- leave this unless you complete the function

Latest revision as of 14:03, 6 January 2022

This function changes the sky color to a two-color gradient.

Syntax

bool setSkyGradient ( [ int topRed = 0, int topGreen = 0, int topBlue = 0, int bottomRed = 0, int bottomGreen = 0, int bottomBlue = 0 ] )

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • topRed: The red value of the upper part of the sky, from 0 to 255.
  • topGreen: The green value of the upper part of the sky, from 0 to 255.
  • topBlue: The blue value of the upper part of the sky, from 0 to 255.
  • bottomRed: The red value of the lower part of the sky, from 0 to 255.
  • bottomGreen: The green value of the lower part of the sky, from 0 to 255.
  • bottomBlue: The blue value of the lower part of the sky, from 0 to 255.

Returns

Returns true if sky color was set correctly, false if invalid values were passed.

Example

This example sets the sky to a hot pink gradient.

Click to collapse [-]
Client
function ClientStarted ()
setSkyGradient( 200, 0, 100, 150, 0, 70 )
end 
addEventHandler( "onClientResourceStart", resourceRoot, ClientStarted )

This example will set a blue realistic sky.

Click to collapse [-]
Client
function ClientStarted ()
setSkyGradient( 60, 100, 196, 136, 170, 212 )
end 
addEventHandler( "onClientResourceStart", resourceRoot, ClientStarted )

See Also