> For the complete documentation index, see [llms.txt](https://inside-scripts.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://inside-scripts.gitbook.io/documentation/paid-scripts/dialog-v1/functions.md).

# Functions

## <mark style="color:green;">Camera</mark>

The Camera can only be invoked on the Client-Side!

### Creating Camera

{% tabs %}
{% tab title="Create" %}

```lua
exports["is_dialog"]:createCamera(entity, data)
```

{% endtab %}
{% endtabs %}

* entity: `entity(ped)`
* data: `table` or `nil`
  * camera: `table` or `nil`
    * position: `table` or `nil`
      * x: `number` or `nil`
      * y: `number` or `nil`
      * z: `number` or `nil`
    * offset: `table` or `nil`
      * x: `number` or `nil`
      * y: `number` or `nil`
      * z: `number` or `nil`
    * fov: `number` or `nil`
    * ease: `boolean` or `nil`
    * easeTime: `number` or `nil`
  * animation: `table` or `nil`
    * dict: `string`
    * anim: `string`

#### Example Usage

```lua
-- Example 1: Simple Creating Camera with settings from config.lua

exports["is_dialog"]:createCamera(entity)

-- Example 2: Creating Camera

exports["is_dialog"]:createCamera(entity, {
    camera = {
        position = {
            x = 0.0,
            y = 0.8,
            z = 0.7,
        },
        offset = {
            x = 0.0,
            y = 0.0,
            z = 0.5,
        },
        fov = 65.0,
        ease = true,
        easeTime = 1000,
    },
    animation = {
        dict = "missfbi3_party_d",
        anim = "stand_talk_loop_a_male1",
    },
})
```

### Destroying Camera

{% tabs %}
{% tab title="Destroy" %}

```lua
exports["is_dialog"]:destroyCamera(data)
```

{% endtab %}
{% endtabs %}

* data: `table` or `nil`
  * ease: `boolean` or `nil`
  * easeTime: `number` or `nil`

#### Example Usage

```lua
-- Example 1: Simple Destroying Camera with settings from config.lua

exports["is_dialog"]:destroyCamera()

-- Example 2: Destroying Camera

exports["is_dialog"]:destroyCamera({
    ease = true,
    easeTime = 1000,
})
```

### Getting Camera State

{% tabs %}
{% tab title="Camera State" %}

```lua
exports["is_dialog"]:isCameraActive()
```

{% endtab %}
{% endtabs %}

#### Example Usage

```lua
-- Example 1: Simple Getting Camera State

exports["is_dialog"]:isCameraActive()
```

## <mark style="color:green;">Dialog</mark>

The Dialog can only be invoked on the Client-Side!

### Creating Dialog

{% tabs %}
{% tab title="Create" %}

```lua
exports["is_dialog"]:showDialog(data)
```

{% endtab %}
{% endtabs %}

* data: `table` or `nil`
  * audio: `table` or `nil`
    * path: `string(audio/yourAudioFile.mp3)` or `nil`
    * volume: `number` or `nil`
  * title: `table` or `nil`
    * text: `string` or `nil`
    * background: `table` or `nil`
      * primary: `string(hex)` or `nil`
      * secondary: `string(hex)` or `nil`
  * additional: `table` or `nil`
    * text: `string` or `nil`
    * icon: `string` or `nil`
    * background: `table` or `nil`
      * primary: `string(hex)` or `nil`
      * secondary: `string(hex)` or `nil`
  * message: `table` or `nil`
    * text: `string` or `nil`
    * typeEffect: `number` or `boolean` or `nil`
  * buttons: `table` or `nil`
    * button: `indexed table`
      * input: `boolean`
      * message: `string`
      * type: `text` or `number`
      * icon: `table` or `nil`
        * name: `string` or `nil`
        * color: `string(hex)` or `nil`
      * onSelect: `function`

#### Example Usage

```lua
-- Example 1: Simple Creating Dialog with settings from config.lua

exports["is_dialog"]:showDialog()

-- Example 2: Creating Basic Dialog

exports["is_dialog"]:showDialog({
    title = {
        text = "Example Title",
    },
    message = {
        text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin porttitor purus et posuere molestie.",
    },
    buttons = {
        {
            input = true,
            message = "Provide Your Full Name",
            type = "text",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = true,
            message = "Provide Your Age",
            type = "number",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = false,
            message = "Test Button 1",
            icon = {
                name = "fa-solid fa-house",
                color = "#ff425d",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 2",
            icon = {
                name = "fa-solid fa-house",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 3",
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
    },
})

-- Example 3: Creating Advanced Dialog

exports["is_dialog"]:showDialog({
    audio = {
        path = "audio/example.mp3",
        volume = 50,
    },
    title = {
        text = "Example Title",
        background = {
            primary = "#00243a",
            secondary = "#050f19",
        },
    },
    additional = {
        text = "Example Additional",
        icon = "fa-solid fa-code",
        background = {
            primary = "#ff425d",
            secondary = "#b7162b",
        },
    },
    message = {
        text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin porttitor purus et posuere molestie.",
        typeEffect = 25,
    },
    buttons = {
        {
            input = true,
            message = "Provide Your Full Name",
            type = "text",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = true,
            message = "Provide Your Age",
            type = "number",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = false,
            message = "Test Button 1",
            icon = {
                name = "fa-solid fa-house",
                color = "#ff425d",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 2",
            icon = {
                name = "fa-solid fa-house",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 3",
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
    },
})
```

### Destroying Dialog

{% tabs %}
{% tab title="Destroy" %}

```lua
exports["is_dialog"]:hideDialog()
```

{% endtab %}
{% endtabs %}

#### Example Usage

```lua
-- Example 1: Simple Destroying Dialog

exports["is_dialog"]:hideDialog()
```

### Getting Dialog State

{% tabs %}
{% tab title="Dialog State" %}

```lua
exports["is_dialog"]:isDialogActive()
```

{% endtab %}
{% endtabs %}

#### Example Usage

```lua
-- Example 1: Simple Getting Dialog State

exports["is_dialog"]:isDialogActive()
```

## <mark style="color:green;">Camera & Dialog Usage</mark>

```lua
-- Example 1: Simple Dialog & Camera code

exports["is_dialog"]:createCamera(entity)

exports["is_dialog"]:showDialog({
    title = {
        text = "Example Title",
    },
    message = {
        text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin porttitor purus et posuere molestie.",
    },
    buttons = {
        {
            input = true,
            message = "Provide Your Full Name",
            type = "text",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = true,
            message = "Provide Your Age",
            type = "number",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = false,
            message = "Test Button 1",
            icon = {
                name = "fa-solid fa-house",
                color = "#ff425d",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 2",
            icon = {
                name = "fa-solid fa-house",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 3",
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
    },
})

exports["is_dialog"]:destroyCamera()

-- Example 2: Advanced Dialog & Camera code

exports["is_dialog"]:createCamera(entity, {
    camera = {
        position = {
            x = 0.0,
            y = 0.8,
            z = 0.7,
        },
        offset = {
            x = 0.0,
            y = 0.0,
            z = 0.5,
        },
        fov = 65.0,
        ease = true,
        easeTime = 1000,
    },
    animation = {
        dict = "missfbi3_party_d",
        anim = "stand_talk_loop_a_male1",
    },
})

exports["is_dialog"]:showDialog({
    audio = {
        path = "audio/example.mp3",
        volume = 50,
    },
    title = {
        text = "Example Title",
        background = {
            primary = "#00243a",
            secondary = "#050f19",
        },
    },
    additional = {
        text = "Example Additional",
        icon = "fa-solid fa-code",
        background = {
            primary = "#ff425d",
            secondary = "#b7162b",
        },
    },
    message = {
        text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin porttitor purus et posuere molestie.",
        typeEffect = 25,
    },
    buttons = {
        {
            input = true,
            message = "Provide Your Full Name",
            type = "text",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = true,
            message = "Provide Your Age",
            type = "number",
            onSelect = function(id, input)
                exports["is_dialog"]:hideDialog()
                print(("Input: %s"):format(input))
            end
        },
        {
            input = false,
            message = "Test Button 1",
            icon = {
                name = "fa-solid fa-house",
                color = "#ff425d",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 2",
            icon = {
                name = "fa-solid fa-house",
            },
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
        {
            input = false,
            message = "Test Button 3",
            onSelect = function(id)
                exports["is_dialog"]:hideDialog()
                print(("Button: %s"):format(id))
            end
        },
    },
})

exports["is_dialog"]:destroyCamera({
    ease = true,
    easeTime = 1000,
})
```
