isElementStreamedIn | Multi Theft Auto: Wiki Skip to content

isElementStreamedIn

Client-side
Server-side
Shared

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.

OOP Syntax Help! I don't understand this!

  • Method:element:isStreamedIn(...)
  • Variable: .streamedIn

Syntax

bool isElementStreamedIn ( ​element theElement )
Required Arguments
  • theElement: The element to check whether is streamed in or not.

Returns

  • bool: result

Returns true if the passed element is currently streamed in, false if it is virtualized.

Code Examples

client

This command shows you how many objects you have streamed in. Objects can already stream from a very long distance, so even when you can't see some objects, they can still be returned.

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)

See Also

Element Functions