M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
attachedToelementThe element it will hang on.
x, y, zfloatThe requested offset from the target.
rx, ry, rzfloatThe 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)

See also