IsElementStreamedIn: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Added example.) |
||
Line 18: | Line 18: | ||
==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}} | ||
Revision as of 10:44, 24 July 2010
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 )
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