DgsDetachFromAutoDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} This function allows you to detach element from dgsElement ==Syntax== <syntaxhighlight lang="lua"> bool dgsDetachFromAutoDestroy(element, dgsE...")
 
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
This function allows you to detach element from dgsElement
This function allows you to stop the specific element from destroying with a dgs element.


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


===Required Arguments===  
===Required Arguments===  
*'''element:''' Element you want to detach attached dgsElement
*'''sourceElement:''' An element you want to detach.
*'''dgsElement:''' dgsElement you want to detach attached element
*'''dgsElement:''' A dgs element you want to detach from.


===Returns===
===Returns===
Returns element detached from dgsElement
Returns ''true'' if successful, ''false'' otherwise


==Example==  
==Example==  
Line 25: Line 25:
setTimer(function()
setTimer(function()
     dgsDetachFromAutoDestroy(vehicle, window) -- detach vehicle from window
     dgsDetachFromAutoDestroy(vehicle, window) -- detach vehicle from window
     destroyElement(window) -- destroy only window
     destroyElement(window) -- destroy window only
end,2000,1)
end,2000,1)
</syntaxhighlight>
</syntaxhighlight>
{{DGSFUNCTIONS}}

Revision as of 09:30, 26 April 2020

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

Syntax

bool dgsDetachFromAutoDestroy( element sourceElement, element dgsElement )

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)

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips