BreakObject

From Multi Theft Auto: Wiki
Revision as of 10:53, 6 June 2024 by FileEX (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function breaks a specific object.

ADDED/UPDATED IN VERSION 1.6.0 r22489:
This function is now also available on the server side.
[[{{{image}}}|link=|]] Note: Only breakable objects can be broken.

Syntax

bool breakObject ( object theObject )

OOP Syntax Help! I don't understand this!

Method: object:break(...)


Required Arguments

Returns

  • true if the object was successfully broken.
  • false if the object is not breakable, or a wrong object was given.

Example

This example checks if the object created is breakable and if it is then breaks it.

addCommandHandler("createObj",
function(command, id)
    local x, y, z = getElementPosition(localPlayer)
    local object = createObject (id, x, y, z)
    if (id) then
        if isObjectBreakable(object) then
            breakObject(object)
        end
    end
end
)

See Also