breakObject | Multi Theft Auto: Wiki Skip to content

breakObject

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function breaks a specific object.

Note

Only breakable objects can be broken.

OOP Syntax Help! I don't understand this!

Syntax

bool breakObject ( object theObject )
Required Arguments
  • theObject: an object element

Returns

  • bool: value

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

Code Examples

shared

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
)