OnElementDataChange: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
No edit summary |
||
Line 29: | Line 29: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
{{See also/Server event|Element events}} | {{See also/Server event|Element events}} |
Revision as of 21:45, 23 May 2010
This event is triggered when an elementdata entry for an element changes. A client can perform this change on the element or it can be done using setElementData.
Parameters
string theName, var theOldValue
- theName: The name of the element data entry that changed
- theOldValue: The old value of this entry before it changed. The new value can be accessed using getElementData ( source, theName ).
Source
The source of this event is the element whose elementdata changed.
Example
Click to collapse [-]
ServerThis example outputs a message to players when any of their element data values is changed.
function outputChange(dataName,oldValue) if getElementType(source) == "player" then -- check if the element is a player local newValue = getElementData(source,dataName) -- find the new value outputChatBox("Your element data '"..tostring(dataName).."' has changed from '"..tostring(oldValue).."' to '"..tostring(newValue).."'",source) -- output the change for the affected player end end addEventHandler("onElementDataChange",getRootElement(),outputChange)
See Also
Element events
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled