SetRadarAreaColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setRadarAreaColor ( float x, float y, float x size, float y size, int r, int g, int b, int a )               
bool setRadarAreaColor ( areaName area, int r, int g, int b, int a )               
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[radararea]]:setColor}}
{{OOP||[[radararea]]:setColor}}


===Required Arguments===  
===Required Arguments===  
*'''x:''' x position of your area
*'''area''' name of area, that you want to change color
*'''y:''' y position of your area
*'''x size:''' width of your area
*'''y size:''' height of your area
*'''r:''' an integer representing the amount of red in the color (0 for no red, 255 for solid red)
*'''r:''' an integer representing the amount of red in the color (0 for no red, 255 for solid red)
*'''g:''' an integer representing the amount of green in the color (0 for no green, 255 for solid green)
*'''g:''' an integer representing the amount of green in the color (0 for no green, 255 for solid green)

Revision as of 16:11, 4 December 2016

Sets the color of an existing radar area.

Syntax

bool setRadarAreaColor ( areaName area, int r, int g, int b, int a )               

OOP Syntax Help! I don't understand this!

Method: radararea:setColor(...)


Required Arguments

  • area name of area, that you want to change color
  • r: an integer representing the amount of red in the color (0 for no red, 255 for solid red)
  • g: an integer representing the amount of green in the color (0 for no green, 255 for solid green)
  • b: an integer representing the amount of blue in the color (0 for no blue, 255 for solid blue)
  • a: an integer representing the color's alpha (0 for transparent, 255 for opaque)

Returns

Returns true if the color was set successfully, false if the radar area doesn't exist or the color arguments are improper.

Example

This example creates a radar area and changes its color right away:

someArea = createRadarArea ( 1024, 1024, 75, 100, 0, 0, 0, 255 ) -- create a black radar area
local flag = setRadarAreaColor ( someArea, 255, 85, 85, 170 )    -- change its color
if ( flag ) then                                                 -- if the function returned true...
   outputChatBox ( "Color set successfully!" )
else                                                             -- if the function returned false...
   outputChatBox ( "Failed to set color." )
end

See Also