SetElementStreamable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setStreams()
object1 = createObject ( 1097, 0, 0, 5 )
setElementStreamable ( object1, true )
end
addEventHandler ( "onClientResourceStart", resourceRoot, setStreams )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client_element_functions}}
{{Client_element_functions}}

Revision as of 03:04, 25 June 2011

This function can be used to disable streaming for an element. This will make sure the element is not virtualized (streamed out from GTA) when the player moves far away from it. If the limit for that element type is reached, the furthest away elements that are streamable will be streamed out until it's below the limit.

Note: You shouldn't disable streaming on too many elements as there are limits for every GTA element type. Disabling streaming for some far-away elements will reduce number of elements that can be shown nearby.
Note: Disabling streaming for extremely many vehicles (>80) can cause low FPS and unwanted effect when warping players into far away vehicles.

Syntax

bool setElementStreamable ( element theElement, bool streamable ) 

Required Arguments

  • theElement: The element you wish to set the streaming of
  • streamable: True if this element should stream in/out like normal, false if it should always be streamed in

Returns

Returns true if the element was streamed in successfully right now, false if it could not be streamed in for some reason, for example limit reached, or invalid element.

Example

function setStreams()
object1 = createObject ( 1097, 0, 0, 5 )
setElementStreamable ( object1, true )
end
addEventHandler ( "onClientResourceStart", resourceRoot, setStreams )

See Also