DgsAttachToAutoDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
This function allows you to attach element to dgsElement
This function allows you to make a specific element destroy with a dgs element.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsAttachToAutoDestroy(element, dgsElement)
bool dgsAttachToAutoDestroy( element dgsElement)
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''element:''' Element you want to attach dgsElement
*'''element:''' An element that you want to attach.
*'''dgsElement:''' dgsElement you want to attach element
*'''dgsElement:''' the dgs element you want to attach to


===Returns===
===Returns===
Returns element attached to dgsElement
Returns ''true'' if successful, ''false'' otherwise.


==Example==  
==Example==  

Revision as of 09:26, 26 April 2020

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

Syntax

bool dgsAttachToAutoDestroy( element dgsElement)

Required Arguments

  • element: An element that you want to attach.
  • dgsElement: the 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)