setObjectBreakable | Multi Theft Auto: Wiki Skip to content

setObjectBreakable

Client-side
Server-side
Shared

Pair: isObjectBreakable

Manual Review Required

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


This function sets an object to be breakable/unbreakable.

OOP Syntax Help! I don't understand this!

  • Method:object:setBreakable(...)
  • Variable: .breakable

Syntax

bool setObjectBreakable ( object theObject, bool breakable )
Required Arguments
  • theObject: MISSING_PARAM_DESC
  • breakable:

Returns

  • bool: value

This example creates an object when the resource starts and sets it to be breakable.

Code Examples

shared

This example creates an object when the resource starts and sets it to be breakable.

function toggleObjectVulnerability()
local object = createObject(1337, 5540.6654, 1020.55122, 1240.545)
if isObjectBreakable(object) then
setObjectBreakable(object, false)
outputChatBox("The object is now not breakable.")
else
setObjectBreakable(object, true)
outputChatBox("The object is now breakable.")
end
end
addEventHandler("onClientResourceStart", resourceRoot, toggleObjectVulnerability)