SetBlipVisibleDistance: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fix oop)
m (Link to the Romanian translation of this page added.)
 
(5 intermediate revisions by 3 users not shown)
Line 4: Line 4:


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">float setBlipVisibleDistance ( blip theBlip, float theDistance )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setBlipVisibleDistance ( blip theBlip, float theDistance )</syntaxhighlight>
{{OOP||[[blip]]:setVisibleDistance|visibleDistance|getBlipVisibleDistance|}}
{{OOP||[[blip]]:setVisibleDistance|visibleDistance|getBlipVisibleDistance|}}


===Required Arguments===  
===Required Arguments===  
*'''theBlip:''' The blip whose visible distance you wish to get.
*'''theBlip:''' The blip whose visible distance you wish to get.
*'''theDistance:''' The distance you want the blip to be visible for.
*'''theDistance:''' The distance you want the blip to be visible for. Value gets clamped between 0 and 65535.


===Returns===
===Returns===
Line 36: Line 36:
==See Also==
==See Also==
{{Blip_functions}}
{{Blip_functions}}
[[hu:setBlipVisibleDistance]]
[[RO:setBlipVisibleDistance]]

Latest revision as of 17:29, 29 July 2019

This function will set the visible distance of a blip.

Syntax

bool setBlipVisibleDistance ( blip theBlip, float theDistance )

OOP Syntax Help! I don't understand this!

Method: blip:setVisibleDistance(...)
Variable: .visibleDistance
Counterpart: getBlipVisibleDistance


Required Arguments

  • theBlip: The blip whose visible distance you wish to get.
  • theDistance: The distance you want the blip to be visible for. Value gets clamped between 0 and 65535.

Returns

Returns true if successful, false otherwise.

Example

This example will demonstrate basic functionality of setBlipVisibleDistance

local blip = createBlip(0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 1000)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --1000
setBlipVisibleDistance(blip, 2000)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --2000

This example will set the visible distance of all blips to half the original value.

-- Retrieve a table containing all the blips that exist
local blips = getElementsByType("blip")
-- Loop through the list, storing the blips visible distance with the rest.
for index, blip in ipairs(blips) do
	-- Retrieve the blip's visible distance and divide by 2
	setBlipVisibleDistance(blip, getBlipVisibleDistance(blip) / 2)
end

See Also