BreakObject: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
This function breaks a specific object.
This function breaks a specific object.
Note: Only breakable objects can be broken.
Note: Only breakable objects can be broken.
{{Note|This function does not support any kind of glass objects}}


==Syntax==  
==Syntax==  

Revision as of 08:54, 21 May 2014

This function breaks a specific object. Note: Only breakable objects can be broken.

Syntax

bool breakObject ( object theObject )

Required Arguments

Returns

Returns true if the object was successfully broken. false if the object is not breakable, or a wrong object was given.

Example

This example checks if the object created is breakable and if it is then breaks it.

addCommandHandler("createObj",
function(command, id)
    local x, y, z = getElementPosition(localPlayer)
    local object = createObject (id, x, y, z)
    if (id) then
        if isObjectBreakable(object) then
            breakObject(object)
        end
    end
end
)

See Also

Shared