M MY Multiplayer: Wiki
Side
Kind

getElementsByType

Client

Lists every element of a type below an element of the tree on this client.

Also exists on the server, with its own implementation: getElementsByType

table getElementsByType(string type [, element startAt = root, bool streamedIn = false])

Parameters

NameTypeDescription
typestringThe type to look for, such as "vehicle" or a type from createElement.
startAtelementThe element the search goes down from.default root
streamedInboolWith true, leaves out the elements that are not loaded in this client's world.default false

Returns

A table with the elements, empty if there are none.

Example

for _, ped in ipairs(getElementsByType("ped", root, true)) do
    setElementCastShadow(ped, false)
end

See also