IsElementStreamedIn: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} This function checks whether an element is currently streamed in (not virtualized) and are actual GTA objects in the world. You can force an element to be...) |
(OOP) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
{{Client function}} | {{Client function}} | ||
This function checks whether an [[element]] is currently streamed in (not virtualized) and are actual GTA objects in the world. You can force an element to be streamed in using [[setElementStreamable]].<br> | This function checks whether an [[element]] is currently streamed in (not virtualized) and are actual GTA objects in the world. You can force an element to be streamed in using [[setElementStreamable]].<br> | ||
{{ | {{Deprecated feature|3|1.0| | ||
DP2 can return true even if this element is not fully streamed in. This can happen during the period when the vehicle/object model is loading while the element is not actually fully created yet. | DP2 can return true even if this element is not fully streamed in. This can happen during the period when the vehicle/object model is loading while the element is not actually fully created yet. | ||
}} | }} | ||
Line 10: | Line 10: | ||
bool isElementStreamedIn ( element theElement ) | bool isElementStreamedIn ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:isStreamedIn|streamedIn}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 18: | Line 19: | ||
==Example== | ==Example== | ||
This command shows you how many objects you have streamed in. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function checkTheObjects ( cmd ) | |||
local amount = 0 -- When starting the command, we don't have any objects looped. | |||
for k,v in ipairs ( getElementsByType ( "object" ) ) do -- Looping all the objects in the server | |||
if isElementStreamedIn ( v ) then -- If the object is streamed in | |||
amount = amount + 1 -- It's an object more streamed in | |||
end | |||
end | |||
outputChatBox ( "You have currently " ..amount.. " objects streamed in." ) -- Send the player the amount of objects that are streamed in | |||
end | |||
addCommandHandler ( "checkobjects", checkTheObjects ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Note: Objects can already stream from a very long distance, so even when you can't see some objects, they can still be returned. | |||
==See Also== | ==See Also== | ||
{{Client element functions}} | {{Client element functions}} | ||
Latest revision as of 19:30, 17 September 2023
This function checks whether an element is currently streamed in (not virtualized) and are actual GTA objects in the world. You can force an element to be streamed in using setElementStreamable.
Syntax
bool isElementStreamedIn ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:isStreamedIn(...)
- Variable: .streamedIn
Required Arguments
- theElement: The element to check whether is streamed in or not.
Returns
Returns true if the passed element is currently streamed in, false if it is virtualized.
Example
This command shows you how many objects you have streamed in.
function checkTheObjects ( cmd ) local amount = 0 -- When starting the command, we don't have any objects looped. for k,v in ipairs ( getElementsByType ( "object" ) ) do -- Looping all the objects in the server if isElementStreamedIn ( v ) then -- If the object is streamed in amount = amount + 1 -- It's an object more streamed in end end outputChatBox ( "You have currently " ..amount.. " objects streamed in." ) -- Send the player the amount of objects that are streamed in end addCommandHandler ( "checkobjects", checkTheObjects )
Note: Objects can already stream from a very long distance, so even when you can't see some objects, they can still be returned.
See Also
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement