SetObjectBreakable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 13: Line 13:


==Example==  
==Example==  
<section name="Client" class="client" show="true">
This example creates an object when the resource starts and sets it to be breakable. (TESTED!)
This example creates an object when the resource starts and sets it to be breakable. (TESTED!)
<syntaxhighlight lang="lua">addEventHandler("onClientResourceStart",resourceRoot,function()
<syntaxhighlight lang="lua">addEventHandler("onClientResourceStart",resourceRoot,function()
Line 24: Line 23:
end)
end)
</syntaxhighlight>
</syntaxhighlight>
</section>
 
==See Also==
==See Also==
{{Object functions}}
{{Object functions}}

Revision as of 18:47, 20 April 2012

This function sets an object to be breakable/unbreakable.

Syntax

bool setObjectBreakable ( object theObject, bool breakable )

Required Arguments

  • object The Object that's being checked.
  • breakable A boolean whether the object is breakable(true) or unbreakable (false).

Returns

Returns true if the object is now breakable, else 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. (TESTED!)

addEventHandler("onClientResourceStart",resourceRoot,function()
	local object = createObject ( 1337, 5540.6654, 1020.55122, 1240.545 )
	if setObjectBreakable(object,true) then
		outputChatBox("The object is now breakable.")
	else
		outputChatBox("The object can't be breakable")
	end
end)

See Also