# createDui (Client)

> Opens a web page off screen, with a transparent background, and gives it back as an image that can be drawn.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Web interface
- **URL**: https://wiki.mymp.gg/en/createDui

## Syntax

```lua
dui|false createDui(string url, int width, int height)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `url` | `string` | The page's address. |
| `width` | `int` | Width in pixels, from 1 to 4096. |
| `height` | `int` | Height in pixels, from 1 to 4096. |

## Returns

The created `dui` element, or `false` if it could not be created.

The dui works anywhere an image is taken, such as `dxDrawImage` or `engineSetTxdTexture`. The page's sound plays through the game's audio. `destroyElement` closes the page.

## Example

```lua
local dui = createDui("https://example.com", 1024, 576)

addEventHandler("onClientRender", root, function()
    dxDrawImage(100, 100, 512, 288, dui)
end)
```

### Note

A size outside 1 to 4096 logs a warning and returns `false`.

## See also

- [drawDui (Client)](https://wiki.mymp.gg/en/drawDui.md): Draws a dui on the screen for one frame, in coordinates relative to the screen.
- [setDuiUrl (Client)](https://wiki.mymp.gg/en/setDuiUrl.md): Takes a dui to another address.
- [sendDuiMessage (Client)](https://wiki.mymp.gg/en/sendDuiMessage.md): Sends a message to a dui's page. The page receives it in the window's message event.
- [isDuiReady (Client)](https://wiki.mymp.gg/en/isDuiReady.md): Tells whether a dui's page has finished loading.
