DgsDetachFromAutoDestroy

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function allows you to stop the specific element from destroying with a dgs element.

Syntax

bool dgsDetachFromAutoDestroy( element sourceElement, element dgsElement )

DGS OOP Syntax Help! I don't understand this!

Method: dgsRootInstance:detachFromAutoDestroy(...)
Counterpart: dgsAttachToAutoDestroy

Required Arguments

  • sourceElement: An element you want to detach.
  • dgsElement: A dgs element you want to detach from.

Returns

Returns true if successful, false otherwise

Example

This example create a vehicle attached to window, then detach and destroy only window

DGS = exports.dgs

local window = dgsCreateWindow(200,200,200,200,"test",false)
local vehicle = createVehicle(411,0,0,3)
dgsAttachToAutoDestroy(vehicle,window)
setTimer(function()
    dgsDetachFromAutoDestroy(vehicle, window) -- detach vehicle from window
    destroyElement(window) -- destroy window only
end,2000,1)

See Also

General Functions

General Events