ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getElementByIndex

Function

getElementByIndex

Returns the n-th element of a type (from 0).

Syntax

element getElementByIndex(string theType, int index)

Arguments

theTypestring
Element type.
indexint
Index from 0.Optional in MTA:SA: int index = 0

Differences from MTA:SA

  • Arguments in a different colour differ from MTA:SA.

In MTA:SA

getElementByIndex(string theType, int index = 0)

Returns

The element or false.

Example

local first = getElementByIndex("player", 0)