SetObjectBreakable

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

ADDED/UPDATED IN VERSION 1.6.0 r21765:
Added also as a server-side function. Previously only available as a client-side function.

This function sets an object to be breakable/unbreakable.

Syntax

bool setObjectBreakable ( object theObject, bool breakable )

OOP Syntax Help! I don't understand this!

Method: object:setBreakable(...)
Variable: .breakable
Counterpart: isObjectBreakable


Required Arguments

  • object the object that's being set.
  • breakable a boolean whether the object is breakable (true) or unbreakable (false).

Returns

  • true if the object is now breakable.
  • false if it can't or if invalid arguments are passed.

Example

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)

Requirements

Minimum server version n/a
Minimum client version 1.3.0-9.03783

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.03783" />

See Also