onElementAttach
ServerEventCancellable
Fired when the server calls attachElements, before the element is attached. Cancelling the event stops the attachment and makes attachElements return false.
addEventHandler("onElementAttach", root, function(element attachedTo, float x, y, z, float rx, ry, rz) … end)
Handler parameters
| Name | Type | Description |
|---|---|---|
| attachedTo | element | The element it will hang on. |
| x, y, z | float | The requested offset from the target. |
| rx, ry, rz | float | The requested rotation relative to the target. |
Source
The element about to be attached.
Example
addEventHandler("onElementAttach", root, function(attachedTo)
if getElementType(source) == "player" and getElementType(attachedTo) == "vehicle" then
cancelEvent()
end
end)