SetBlipIcon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (Link to the Romanian translation of this page added.)
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
This function sets the icon for a blip element that has already been created.
{{Server client function}}
This function sets the icon for an existing blip element.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setBlipIcon ( blip theBlip, int icon )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setBlipIcon ( blip theBlip, int icon )</syntaxhighlight>
{{OOP||[[blip]]:setIcon|icon|getBlipIcon}}


===Required Arguments===  
===Required Arguments===  
*'''theBlip''' The blip you wish to set the icon of.
*'''theBlip''' The blip you wish to set the icon of.
*'''icon:''' A number indicating the icon you wish to change it do. Valid values are:
*'''icon:''' A number indicating the icon you wish to change it do. Valid values are listed on the [[Radar Blips]] page.
{{Blip_Icons}}


===Returns===
===Returns===
Returns ''true'' if the icon was succesfully set, ''false'' if the element passed was not a valid blip or the icon value was not a valid icon number.
Returns ''true'' if the icon was successfully set, ''false'' if the element passed was not a valid blip or the icon value was not a valid icon number.


==Example==  
==Example==  
Line 31: Line 32:


==See Also==
==See Also==
{{Blip_Functions}}
{{Blip_functions}}
 
[[hu:setBlipIcon]]
[[RO:setBlipIcon]]

Latest revision as of 19:51, 20 July 2019

This function sets the icon for an existing blip element.

Syntax

bool setBlipIcon ( blip theBlip, int icon )

OOP Syntax Help! I don't understand this!

Method: blip:setIcon(...)
Variable: .icon
Counterpart: getBlipIcon


Required Arguments

  • theBlip The blip you wish to set the icon of.
  • icon: A number indicating the icon you wish to change it do. Valid values are listed on the Radar Blips page.

Returns

Returns true if the icon was successfully set, false if the element passed was not a valid blip or the icon value was not a valid icon number.

Example

This example resets all blip icons to the default blip icon, 0.

-- 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 icon into the variable 'blipIcon'
	blipIcon = getBlipIcon ( blipValue )
	-- If the blip's icon wasn't the default already
	if ( blipIcon ~= 0 ) then
		-- Set the blip's icon to the default
		setBlipIcon ( blipValue, 0 )
	end
end

See Also