OnClientObjectBreak: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added onClientObjectBreak documentation)
 
(Remove obsolete Requirements section)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}
{{Client event}}
This event is fired before an object breaks. Also note that this event is only triggered for players nearby the local player's camera. This is due to elements far away being streamed out.
This event is fired before an object breaks.
{{Note|This event is only triggered for objects that are streamed in}}
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 26: Line 27:
)</syntaxhighlight>
)</syntaxhighlight>
</section>
</section>
==Requirements==
{{Requirements|n/a|1.3-9.05086|}}


==See Also==
==See Also==

Latest revision as of 17:11, 7 November 2024

This event is fired before an object breaks.

[[{{{image}}}|link=|]] Note: This event is only triggered for objects that are streamed in

Parameters

element attacker
  • attacker: the vehicle/ped/player who is breaking the object

Source

The source of this event is the object which will break.

Cancel effect

If this event is canceled, the object will not break.

Example

Click to collapse [-]
Client

This example prevents objects from beeing broken in interiors.

addEventHandler("onClientObjectBreak", root,
    function()
        if getElementInterior(source) ~= 0 then
            cancelEvent()
        end
    end
)

See Also

Client object events


Client event functions