DgsAttachToAutoDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(DGS (OOP Syntax)/(Template Organization) Mission)
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsAttachToAutoDestroy( element sourceElement, element dgsElement )
bool dgsAttachToAutoDestroy( element sourceElement, element dgsElement )
</syntaxhighlight>  
</syntaxhighlight>
{{DGS/OOP||AnyElement:attachToAutoDestroy|||dgsDetachFromAutoDestroy}}


===Required Arguments===  
===Required Arguments===  
Line 28: Line 29:
</syntaxhighlight>
</syntaxhighlight>


==See Also==
=See Also=
{{DGSFUNCTIONS}}
 
==<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}}

Revision as of 19:57, 19 April 2021

This function allows you to make a specific element destroy with a dgs element.

Syntax

bool dgsAttachToAutoDestroy( element sourceElement, element dgsElement )

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

Required Arguments

  • sourceElement: An element that you want to attach.
  • dgsElement: A dgs element you want to attach to

Returns

Returns true if successful, false otherwise.

Example

This example create a vehicle attached to window, which will be destroyed after 2 seconds with 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()
    destroyElement(window)
end,2000,1)

See Also

General Functions

General Events