Resource:Blipstreamer/setBlipStreamable: Difference between revisions
Jump to navigation
Jump to search
(-) |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''radius:''' The maximum distance for players to be within for the blip to be visible | *'''radius:''' The maximum distance for players to be within for the blip to be visible. The minimum value is 180 (Radius of the radar itself). Specifying lower will mean the blip only shows when within the radar's visibility. | ||
===Returns=== | ===Returns=== | ||
Line 19: | Line 19: | ||
==Example== | ==Example== | ||
This function | This function makes all vehicles in the server have a streaming blip. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function addVehicleBlips() | ||
for i,vehicle in ipairs(getElementsByType"vehicle") do | |||
for k,element in ipairs(getAttachedElements(source)) do | |||
if getElementType(element) == "blip" then | |||
destroyElement(element) | |||
end | |||
end | end | ||
--Create a new blip and make it streamable | |||
local blip = createBlipAttachedTo ( vehicle, 0, 1 ) | |||
call(getResourceFromName"blipstreamer","setBlipStreamable",blip,true,10) | |||
end | end | ||
end | end | ||
addEventHandler ( " | addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), addVehicleBlips ) | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 21:02, 24 January 2009
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. The minimum value is 180 (Radius of the radar itself). Specifying lower will mean the blip only shows when within the radar's visibility.
Returns
Returns true if streaming was enabled/disabled successfully, or false if bad arguments were provided
Example
This function makes all vehicles in the server have a streaming blip.
function addVehicleBlips() for i,vehicle in ipairs(getElementsByType"vehicle") do 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 ( vehicle, 0, 1 ) call(getResourceFromName"blipstreamer","setBlipStreamable",blip,true,10) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), addVehicleBlips )