SetBlipSize: 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.)
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{Server client function}}
This function sets the size of a blip's icon.
This function sets the size of a blip's icon.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setBlipSize ( blip theBlip, int iconSize )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setBlipSize ( blip theBlip, int iconSize )</syntaxhighlight>
 
{{OOP||[[blip]]:setSize|size|getBlipSize|}}
===Required Arguments===  
===Required Arguments===  
*'''theBlip:''' The blip you wish to get the size of.
*'''theBlip:''' The blip you wish to get the size of.
*'''iconSize:''' The size you wish the icon to be. 2 is the default value.
*'''iconSize:''' The size you wish the icon to be. 2 is the default value. 25 is the maximum value. Value gets clamped between 0 and 25.


===Returns===
===Returns===
Returns an ''true'' if the blip's size was set sucessfully. Returns ''false'' if the [[element]] passed was not a [[blip]] or if the icon size passed was invalid.
Returns an ''true'' if the blip's size was set successfully. Returns ''false'' if the [[element]] passed was not a [[blip]] or if the icon size passed was invalid.


==Example==  
==Example==  
Line 17: Line 18:
-- Retrieve a table containing all the blips that exist
-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
-- Loop through the list
for blipKey, blipValue in blips do
for blipKey, blipValue in ipairs(blips) do
-- Retrieve the blip's size into the variable 'blipSize'
-- Retrieve the blip's size into the variable 'blipSize'
blipSize = getBlipSize ( blipValue )
blipSize = getBlipSize ( blipValue )
-- If the blip's size wasn't 2 (the default size) already
-- If the blip's size wasn't 2 (the default size) already
if ( blipSize ~= 2 ) then
if ( blipSize ~= 2 ) then
-- Set the blip's icon to the default
-- Set the size to the default
setBlipSize ( blipValue, 2 )
setBlipSize ( blipValue, 2 )
end
end
Line 30: Line 31:


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

Latest revision as of 17:20, 29 July 2019

This function sets the size of a blip's icon.

Syntax

bool setBlipSize ( blip theBlip, int iconSize )

OOP Syntax Help! I don't understand this!

Method: blip:setSize(...)
Variable: .size
Counterpart: getBlipSize


Required Arguments

  • theBlip: The blip you wish to get the size of.
  • iconSize: The size you wish the icon to be. 2 is the default value. 25 is the maximum value. Value gets clamped between 0 and 25.

Returns

Returns an true if the blip's size was set successfully. Returns false if the element passed was not a blip or if the icon size passed was invalid.

Example

This example will reset the size of all blips to the default.

-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list
for blipKey, blipValue in ipairs(blips) do
	-- Retrieve the blip's size into the variable 'blipSize'
	blipSize = getBlipSize ( blipValue )
	-- If the blip's size wasn't 2 (the default size) already
	if ( blipSize ~= 2 ) then
		-- Set the size to the default
		setBlipSize ( blipValue, 2 )
	end
end

See Also