GetBlipVisibleDistance: Difference between revisions

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


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">float getBlipVisibleDistance ( blip theBlip )</syntaxhighlight>  
<syntaxhighlight lang="lua">float getBlipVisibleDistance ( blip theBlip )</syntaxhighlight>
{{OOP||getVisibleDistance|visibleDistance|setBlipVisibleDistance}}
{{OOP||[[blip]]:getVisibleDistance|visibleDistance|setBlipVisibleDistance}}
===Required Arguments===  
===Required Arguments===  
*'''theBlip:''' The blip whose visible distance you wish to get.
*'''theBlip:''' The blip whose visible distance you wish to get.
Line 34: Line 34:
==See Also==
==See Also==
{{Blip_functions}}
{{Blip_functions}}
[[hu:getBlipVisibleDistance]]
[[ro:getBlipVisibleDistance]]

Latest revision as of 19:29, 20 July 2019

This function will tell you what visible distance a blip has.

Syntax

float getBlipVisibleDistance ( blip theBlip )

OOP Syntax Help! I don't understand this!

Method: blip:getVisibleDistance(...)
Variable: .visibleDistance
Counterpart: setBlipVisibleDistance


Required Arguments

  • theBlip: The blip whose visible distance you wish to get.

Returns

Returns one float with the blips visible distance, false if the blip is invalid.

Example

This example will demonstrate basic functionality of getBlipVisibleDistance

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

This example will combine the total visible distances of all blips

-- Retrieve a table containing all the blips that exist
local blips = getElementsByType("blip")
local distance = 0
-- 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
	distance = distance + getBlipVisibleDistance(blip) or 0 -- "or 0" just incase its false ;)
end
outputDebugString("Combined total of all blips visible distances: "..distance)

See Also