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

Function

hasElementData

Checks whether an element has a value under a key. Unlike getElementData, it tells a missing value apart from false.

Syntax

bool hasElementData(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

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

Returns

true if the key exists.

Example

if not hasElementData(player, "level") then
    setElementData(player, "level", 1)
end