Resource:Blipstreamer/setBlipStreamable

From Multi Theft Auto: Wiki
Revision as of 19:21, 15 January 2009 by Talidan (talk | contribs) (-)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function enables a blip to automatically stream according to the radius

Syntax

bool setBlipStreamable ( element blip, bool streamingEnabled [, float radius = 500 ] )

Required Arguments

  • blip: The blip in which you wish to enable/disable streaming for
  • streamingEnabled: A boolean, where true enables streaming, and false disables it (restoring to previous dimension)

Optional Arguments

  • radius: The maximum distance for players to be within for the blip to be visible

Returns

Returns true if streaming was enabled/disabled successfully, or false if bad arguments were provided

Example

This function creates a streamed blip for a vehicle when it spawns.

function vehicleSpawn()
	--Destroy any old attached blips
	for k,element in ipairs(getAttachedElements(source)) do
		if getElementType(element) == "blip" then
			destroyElement(element)
		end
	end
	--Create a new blip and make it streamable
	local blip = createBlipAttachedTo ( source, 0, 1 )
	call(getResourceFromName"blipstreamer","setBlipStreamable",blip,true)
end
addEventHandler ( "onVehicleSpawn", getRootElement(), vehicleSpawn )