ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getElementsByType

Function

getElementsByType

Returns all elements of a type, optionally only under a given element (e.g. resourceRoot).

Syntax

table getElementsByType(string theType [, element startAt = root])

Arguments

theTypestring
Type, e.g. "player", "vehicle", "object", "marker".
startAtelement, optional = root
The element to search from.

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool streamedIn = false

In MTA:SA

getElementsByType(string theType, element startat = getRootElement(), bool streamedIn = false)

Returns

A table of elements.

Example

addCommandHandler("naprawwszystko", function()
    for _, veh in ipairs(getElementsByType("vehicle")) do
        fixVehicle(veh)
    end
end)

See also