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

Function

getElementData

Returns an element's data value under a key. Data is set with setElementData; broadcast data is visible on the client too.

Syntax

mixed getElementData(element theElement, string key)

Arguments

theElementelement
The element.
keystring
The key.

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool inherit = true

In MTA:SA

getElementData(element theElement, string key, bool inherit = true)

Returns

The value, or false when it is not set.

Example

addEventHandler("onClientRender", root, function()
    local level = getElementData(localPlayer, "level") or 1
    dxDrawText("Poziom " .. level, 20, 400)
end)

See also