GetMarkerColor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">int int int getMarkerColor ( marker myMarker )</syntaxhighlight>
<syntaxhighlight lang="lua">
 
int int int getMarkerColor ( marker myMarker )
This function also has three variants that allow you to retrieve data from just one of the three axes.
</syntaxhighlight>
 
<syntaxhighlight lang="lua">int getMarkerColor|getMarkerColorRed ( marker myMarker )</syntaxhighlight>
 
<syntaxhighlight lang="lua">int getMarkerColor|getMarkerColorGreen ( marker myMarker )</syntaxhighlight>
 
<syntaxhighlight lang="lua">int getMarkerColor|getMarkerColorBlue ( marker myMarker )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''marker''': The [[marker]] that you wish to retrieve the color of.
*'''myMarker''': The [[marker]] that you wish to retrieve the color of.


===Returns===
===Returns===
Returns three [[int]]s corresponding to the amount of red, green and blue (respectively) in the marker's color.
Returns three [[int]]s corresponding to the amount of red, green and blue (respectively) in the marker's color. If the function fails, it'll return ''false''. Check this by checking the ''red'' [[int]]'s value for ''false''.


==Example==
==Example==
<syntaxhighlight lang="lua">newMarker = createMarker ( 1, 1000, 1000, 1000, 1,0,0 )
<syntaxhighlight lang="lua">
-- Create a new marker
r,g,b = getMarkerColor ( newmarker )
newMarker = createMarker ( 1, 1000, 1000, 1000, 1,0,0 )
if (r) then
-- Get the marker's color components into the three variables, red, green and blue.
  OutputChatBox ( ("Current marker color: ",r,",",g,",",b,"."), player )
red,green,blue = getMarkerColor ( newMarker )
end</syntaxhighlight>
if ( red ) then
outputChatBox ( ("Current marker color: " .. r .. "," .. g .. "," .. b .. ".") )
end
</syntaxhighlight>

Revision as of 17:00, 18 May 2006

This function returns three ints corresponding to the amount of red, green and blue (respectively) in the marker's color. It can be useful for coloring objectives text to the same color as the marker.

Syntax

int int int getMarkerColor ( marker myMarker )

Required Arguments

  • myMarker: The marker that you wish to retrieve the color of.

Returns

Returns three ints corresponding to the amount of red, green and blue (respectively) in the marker's color. If the function fails, it'll return false. Check this by checking the red int's value for false.

Example

-- Create a new marker
newMarker = createMarker ( 1, 1000, 1000, 1000, 1,0,0 )
-- Get the marker's color components into the three variables, red, green and blue.
red,green,blue = getMarkerColor ( newMarker )
if ( red ) then
	outputChatBox ( ("Current marker color: " .. r .. "," .. g .. "," .. b .. ".") )
end