onClientElementDataChange | Multi Theft Auto: Wiki Skip to content

onClientElementDataChange

Client-side
Server-side
Shared

This event is triggered after an element's data entry is changed. Such changes can be made on the client or the server using setElementData.

Parameters

string theKey, var oldValue, var newValue
  • theKey: The name of the element data entry that has changed.
  • oldValue: The old value of this entry before it changed. See element data for a list of possible datatypes.
  • newValue: the new value of this entry after it changed. This will be equivalent to getElementData(source, theKey).

Source

element: The source of this event is the element whose element data changed.

Code Examples

client

This example tells the client whenever a player's "score" element data is changed.

function scoreChangeTracker(theKey, oldValue, newValue)
if (getElementType(source) == "player") and (theKey == "score") then
outputChatBox(getPlayerName(source).."'s new score is "..newValue.."!")
end
end
addEventHandler("onClientElementDataChange", root, scoreChangeTracker)

See Also

Element Functions