OnElementModelChange: Difference between revisions
Jump to navigation
Jump to search
m (Grammatical changes.) |
|||
Line 18: | Line 18: | ||
==Cancel Effect== | ==Cancel Effect== | ||
This event doesn't support [[Event system#Canceling|cancellation]]. | This event doesn't support [[Event system#Canceling|cancellation]]. Use setElementModel with the old value to reverse. | ||
==Example== | ==Example== |
Revision as of 08:46, 18 December 2014
Available only in MTA SA 1.2 and onwards This event is triggered when the model of an element is changed using setElementModel.
Parameters
int oldModel, int newModel
- oldModel: The model of the element beforehand.
- newModel: The new model of the element.
Source
The source of this event is the element that changed its model
Cancel Effect
This event doesn't support cancellation. Use setElementModel with the old value to reverse.
Example
This example sends a message to players when their model changes telling them what the model ID is and was.
function informPlayerOnModelChange(oldModel, newModel) if ( getElementType(source) == "player" ) then -- Make sure the element is a player outputChatBox("Model ID changing from: "..oldModel.." to: "..newModel, source, 0, 255, 0) -- Message for player end end addEventHandler("onElementModelChange", root, informPlayerOnModelChange) -- Bind the event to every element
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