GetBlipColor: Difference between revisions

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


===Returns===
===Returns===
Returns four [[int]]s corresponding to red, green, blue and alpha respectively, or ''false'' if the blip passed to the function is invalid.  
Returns four integers in RGBA format, with a maximum value of 255 for each.  Each stands for ''red'', ''green'', ''blue'', and ''alpha''.  Alpha decides transparancy where 255 is opaque and 0 is transparent.  ''false'' is returned if the blip is invalid.  


==Example==  
==Example==  

Revision as of 15:13, 16 August 2006

This function will tell you what color a blip is. This color is only applicable to the default blip icon. All other icons will ignore this.

Syntax

int int int int getBlipColor ( blip theBlip )

Required Arguments

  • theBlip: The blip whos color you wish to get.

Returns

Returns four integers in RGBA format, with a maximum value of 255 for each. Each stands for red, green, blue, and alpha. Alpha decides transparancy where 255 is opaque and 0 is transparent. false is returned if the blip is invalid.

Example

This example will find all the blips that exist and set them all to white if they aren't white already.

-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
for blipKey, blipValue in blips do
	-- Retrieve the blip's colors into the variables red, green, blue and alpha
	red, green, blue, alpha = getBlipColor ( blipValue )
	-- If the blip's icon isn't white already
	if ( red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255 ) then
		-- Set the blip's color to white
		setBlipColor ( blipValue, 255, 255, 255, 255 )
	end
end

See Also