GetBlipColor: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
(11 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{Server client function}} | ||
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. | __NOTOC__ | ||
This function will tell you what color a blip is. This color is only applicable to the default blip icon ([[Image:Blipid0s.png|12px]], [[Image:Blipid0u.png|12px]] or [[Image:Blipid0d.png|12px]]). All other icons will ignore this. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int int int int getBlipColor ( blip theBlip )</syntaxhighlight> | <syntaxhighlight lang="lua">int int int int getBlipColor ( blip theBlip )</syntaxhighlight> | ||
{{OOP||[[blip]]:getColor||setBlipColor}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theBlip:''' The blip | *'''theBlip:''' The blip whose color you wish to get. | ||
===Returns=== | ===Returns=== | ||
Returns four | Returns four integers in RGBA format, with a maximum value of 255 for each. The values are, in order, ''red'', ''green'', ''blue'', and ''alpha''. Alpha decides the transparancy where 255 is opaque and 0 is fully transparent. ''false'' is returned if the blip is invalid. | ||
==Example== | ==Example== | ||
Line 17: | Line 19: | ||
blips = getElementsByType ( "blip" ) | blips = getElementsByType ( "blip" ) | ||
-- Loop through the list, storing the blip from the table in the variable blipValue | -- Loop through the list, storing the blip from the table in the variable blipValue | ||
for blipKey, blipValue in blips do | for blipKey, blipValue in ipairs(blips) do | ||
-- Retrieve the blip's colors into the variables red, green, blue and alpha | -- Retrieve the blip's colors into the variables red, green, blue and alpha | ||
red, green, blue, alpha = getBlipColor ( blipValue ) | red, green, blue, alpha = getBlipColor ( blipValue ) | ||
Line 28: | Line 30: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | |||
{{Blip_functions}} | |||
[[hu:getBlipColor]] | |||
[[ro:getBlipColor]] |
Latest revision as of 20:10, 18 July 2019
This function will tell you what color a blip is. This color is only applicable to the default blip icon (, or ). All other icons will ignore this.
Syntax
int int int int getBlipColor ( blip theBlip )
OOP Syntax Help! I don't understand this!
- Method: blip:getColor(...)
- Counterpart: setBlipColor
Required Arguments
- theBlip: The blip whose color you wish to get.
Returns
Returns four integers in RGBA format, with a maximum value of 255 for each. The values are, in order, red, green, blue, and alpha. Alpha decides the transparancy where 255 is opaque and 0 is fully 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 ipairs(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