SetObjectBreakable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Undo revision 49841)
(added note about issue #8458)
Line 28: Line 28:
addEventHandler("onClientResourceStart", resourceRoot, toggleObjectVulnerability)
addEventHandler("onClientResourceStart", resourceRoot, toggleObjectVulnerability)
</syntaxhighlight>
</syntaxhighlight>
== Issues ==
{{Issues|
{{Issue|8458|setObjectBreakable - Melee problem}}
}}
==Requirements==
==Requirements==
{{Requirements|n/a|1.3.0-9.03783|}}
{{Requirements|n/a|1.3.0-9.03783|}}
==See Also==
==See Also==
{{Client_object_functions}}
{{Client_object_functions}}

Revision as of 12:25, 9 May 2017

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)

Issues

Issue ID Description
#8458 setObjectBreakable - Melee problem

Requirements

This template will be deleted.

See Also