SetObjectBreakable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Script doesn't work; Do not add "TESTED" in the description; Script not meeting the Wiki standards)
mNo edit summary
Line 7: Line 7:


===Required Arguments===  
===Required Arguments===  
*'''object''' The Object that's being set.
*'''object''' the [[object]] that's being set.
*'''breakable''' A boolean whether the object is breakable(true) or unbreakable (false).
*'''breakable''' a boolean whether the object is breakable(true) or unbreakable (false).


===Returns===
===Returns===
Returns true if the object is now breakable, else false if it can't or if invalid arguments are passed.  
* ''true'' if the object is now breakable.
* ''false'' if it can't or if invalid arguments are passed.  


==Example==  
==Example==  
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.
<syntaxhighlight lang="lua">function toggleObjectVulnerability()
<syntaxhighlight lang="lua">function toggleObjectVulnerability()
local object = createObject(1337, 5540.6654, 1020.55122, 1240.545)
local object = createObject(1337, 5540.6654, 1020.55122, 1240.545)

Revision as of 22:53, 4 October 2014

This function sets an object to be breakable/unbreakable.

Syntax

bool setObjectBreakable ( object theObject, bool breakable )

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

This template will be deleted.

See Also