ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server events
  3. onElementDataChange

Event

onElementDataChange

ServerElementsIdentical to MTA:SA

An element's data changed (setElementData or removeElementData), also from a client.

Handler

addEventHandler("onElementDataChange", root, function(theKey, oldValue, newValue) ... end)

Parameters

theKeystring
The key.
oldValuemixed
The previous value (false if there was none).
newValuemixed
The new value (false after removeElementData).

Source

source is the element.

Example

Protection: a client cannot change money by itself.

addEventHandler("onElementDataChange", root, function(key, old)
    if key == "pieniadze" and client then
        setElementData(source, key, old)
    end
end)

See also