DgsDetachFromAutoDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(DGS OOP Syntax changing)
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsDetachFromAutoDestroy( element sourceElement, element dgsElement )
bool dgsDetachFromAutoDestroy( element sourceElement, element dgsElement )
</syntaxhighlight>  
</syntaxhighlight>
{{DGS/OOP|
    Method = '''dgsRootInstance''':detachFromAutoDestroy|
    Counterpart = dgsAttachToAutoDestroy
}}


===Required Arguments===  
===Required Arguments===  
Line 28: Line 32:
end,2000,1)
end,2000,1)
</syntaxhighlight>
</syntaxhighlight>
{{DGSFUNCTIONS}}
 
=See Also=
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>==
{{DGS General Functions}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>==
{{DGS Events/General}}

Latest revision as of 21:38, 3 May 2021

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