DgsDetachFromAutoDestroy

From Multi Theft Auto: Wiki
Revision as of 08:40, 26 April 2020 by Temois (talk | contribs) (Created page with "__NOTOC__ {{Client function}} This function allows you to detach element from dgsElement ==Syntax== <syntaxhighlight lang="lua"> bool dgsDetachFromAutoDestroy(element, dgsE...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function allows you to detach element from dgsElement

Syntax

bool dgsDetachFromAutoDestroy(element, dgsElement)

Required Arguments

  • element: Element you want to detach attached dgsElement
  • dgsElement: dgsElement you want to detach attached element

Returns

Returns element detached from dgsElement

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 only window
end,2000,1)