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
| 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.
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)