M MY Multiplayer: Wiki
Side
Kind

onClientElementAttach

ClientEventCancellable

Fired when a client script calls attachElements, before the element is attached. Cancelling the event stops the attachment and makes attachElements return false.

addEventHandler("onClientElementAttach", 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.

Attachments made by the server do not fire this event on the client.

Example

addEventHandler("onClientElementAttach", root, function(attachedTo)
    if getElementType(source) == "light" and getElementType(attachedTo) == "ped" then
        cancelEvent()
    end
end)

See also