IsObjectBreakable: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{Shared function}} | |||
{{New feature/item|3.0161|1.6.0|21765|Added also as a server-side function. Previously only available as a client-side function.}} | |||
This function checks if an object / model ID is breakable. | |||
==Syntax== | |||
<syntaxhighlight lang="lua">bool isObjectBreakable ( object theObject / int modelId )</syntaxhighlight> | |||
{{OOP||[[object]]:isBreakable|breakable|setObjectBreakable}} | |||
===Required Arguments=== | |||
*'''theObject / modelId:''' The [[object]] / model ID that's being checked. | |||
===Returns=== | |||
* ''true'' if the object is breakable. | |||
* ''false'' if the object is not breakable. | |||
==Example== | |||
This example creates an object when the resource starts and checks if the object is breakable. | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler("onClientResourceStart", resourceRoot, function() | |||
local object = createObject(1337, 5540.6654, 1020.55122, 1240.545) | |||
if isObjectBreakable(object) then | |||
outputChatBox("Yes, the object is breakable.") | |||
else | |||
outputChatBox("No, the object is not breakable") | |||
end | |||
end) | |||
</syntaxhighlight> | |||
==Requirements== | |||
{{Requirements|n/a|1.3.0-9.03783|}} | |||
==See Also== | |||
{{Client_object_functions}} | |||
Latest revision as of 21:31, 16 April 2023
This function checks if an object / model ID is breakable.
Syntax
bool isObjectBreakable ( object theObject / int modelId )
OOP Syntax Help! I don't understand this!
- Method: object:isBreakable(...)
- Variable: .breakable
- Counterpart: setObjectBreakable
Required Arguments
- theObject / modelId: The object / model ID that's being checked.
Returns
- true if the object is breakable.
- false if the object is not breakable.
Example
This example creates an object when the resource starts and checks if the object is breakable.
addEventHandler("onClientResourceStart", resourceRoot, function() local object = createObject(1337, 5540.6654, 1020.55122, 1240.545) if isObjectBreakable(object) then outputChatBox("Yes, the object is breakable.") else outputChatBox("No, the object is not breakable") end end)
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
- breakObject
- getObjectMass
- getObjectProperty
- isObjectMoving
- respawnObject
- setObjectMass
- setObjectProperty
- toggleObjectRespawn
Shared