RespawnObject: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{client function}} This function respawns a specific object. Note: Only breakable objects can respawn. ==Syntax== <syntaxhighlight lang="lua">bool respawnObject ( theObject )</cod...")
 
m (OOP)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{client function}}
{{Client function}}
This function respawns a specific object.
This function respawns a specific object.
Note: Only breakable objects can respawn.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool respawnObject ( theObject )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool respawnObject ( object theObject )</syntaxhighlight>  
 
{{OOP||[[object]]:respawn}}
===Required Arguments===  
===Required Arguments===  
*'''theObject:''' A [[object]] element
*'''theObject:''' an [[object]] element


===Returns===
===Returns===
Returns 'true' if the object sucessfully respawned.
* ''true'' if the object was sucessfully respawned.
'false' if the object is not breakable, or a wrong object was given.
* ''false'' if the object is not breakable, or a wrong object was given.
 
==Example==
This example prevents objects from despawning. When an object breaks, it gets respawned right away.
<syntaxhighlight lang="lua">
addEventHandler ( "onClientObjectBreak", getRootElement(),
    function ()
        respawnObject ( source )
    end
)</syntaxhighlight>


==See Also==
==See Also==
{{Client_object_functions}}
{{Client_object_functions}}

Latest revision as of 22:42, 4 October 2014

This function respawns a specific object.

Syntax

bool respawnObject ( object theObject )

OOP Syntax Help! I don't understand this!

Method: object:respawn(...)


Required Arguments

Returns

  • true if the object was sucessfully respawned.
  • false if the object is not breakable, or a wrong object was given.

Example

This example prevents objects from despawning. When an object breaks, it gets respawned right away.

addEventHandler ( "onClientObjectBreak", getRootElement(),
    function ()
        respawnObject ( source )
    end
)

See Also