GetRadarAreaColor: Difference between revisions
Jump to navigation
Jump to search
Black Dragon (talk | contribs) mNo edit summary |
(Fixed example, minor changes) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server function}} | ||
This function can be used to retrieve the current color of a | This function can be used to retrieve the current color of a [[radararea|radar area]]. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int int int int getRadarAreaColor ( radararea theRadararea ) | int, int, int, int getRadarAreaColor ( radararea theRadararea ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theRadararea:''' The radar area you wish to retrieve the colour of | *'''theRadararea:''' The [[radararea|radar area]] you wish to retrieve the colour of. | ||
===Returns=== | ===Returns=== | ||
Returns four integers in RGBA format (''red'', ''green'', ''blue'', ''alpha''), with a maximum value of 255 for each. Alpha decides | Returns four integers in RGBA format (''red'', ''green'', ''blue'', ''alpha''), with a maximum value of 255 for each. Alpha decides transparency where 255 is opaque and 0 is transparent. Returns ''false'' if the radararea is invalid. | ||
==Example== | ==Example== | ||
This example checks the color of a radararea defined as 'area' and announces if it is ballas or grove street. | This example checks the color of a radararea defined as 'area' and announces if it is ballas or grove street. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local r,g,b,a = getRadarAreaColor ( area ) --get the color of 'area' and | local r,g,b,a = getRadarAreaColor ( area ) --get the color of 'area' and store it in 'r', 'g', 'b' and 'a' | ||
if g == 255 then --if the radar area is fully green | if r == 0 and g == 255 and b == 0 then --if the radar area is fully green | ||
outputChatBox ( "This is Grove Street turf!" ) --announce it as grove street area | outputChatBox ( "This is Grove Street turf!" ) --announce it as grove street area | ||
elseif r == 255 then --if it is | elseif r == 255 and g == 0 and b == 255 then --if it is purple however | ||
outputChatBox ( "This is Ballas turf!" ) --announce it as ballas area | outputChatBox ( "This is Ballas turf!" ) --announce it as ballas area | ||
end | end |
Revision as of 11:46, 13 August 2007
This function can be used to retrieve the current color of a radar area.
Syntax
int, int, int, int getRadarAreaColor ( radararea theRadararea )
Required Arguments
- theRadararea: The radar area you wish to retrieve the colour of.
Returns
Returns four integers in RGBA format (red, green, blue, alpha), with a maximum value of 255 for each. Alpha decides transparency where 255 is opaque and 0 is transparent. Returns false if the radararea is invalid.
Example
This example checks the color of a radararea defined as 'area' and announces if it is ballas or grove street.
local r,g,b,a = getRadarAreaColor ( area ) --get the color of 'area' and store it in 'r', 'g', 'b' and 'a' if r == 0 and g == 255 and b == 0 then --if the radar area is fully green outputChatBox ( "This is Grove Street turf!" ) --announce it as grove street area elseif r == 255 and g == 0 and b == 255 then --if it is purple however outputChatBox ( "This is Ballas turf!" ) --announce it as ballas area end
See Also
- createRadarArea
- getRadarAreaColor
- getRadarAreaSize
- isInsideRadarArea
- isRadarAreaFlashing
- setRadarAreaColor
- setRadarAreaFlashing
- setRadarAreaSize