toggleObjectRespawn | Multi Theft Auto: Wiki Skip to content

toggleObjectRespawn

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function is used to toggle if an object should respawn after it got destroyed

Note

The object will be respawned when it is streamed

Syntax

toggleObjectRespawn ( )

Code Examples

server

This example adds commandtosthat toggles respawn of all the objects.

local respawn = false
addCommandHandler("tos",
function ()
for i, object in pairs(getElementsByType("object")) do
toggleObjectRespawn(object, not respawn)
end
outputChatBox("Object respawning " .. (respawn and "disabled" or "enabled"))
respawn = not respawn
end)