# Dialog System

```lua
dialogue = {
    name      = "Paul",          -- big uppercase header
    tag       = "Lumberjack",    -- accent badge under the name
    startMsg  = "How can I help?",
    elements  = {
        {
            label  = "Tell me about the job",
            -- canInteract is optional — return false to hide the entry
            canInteract = function() return ESX.PlayerData.job.name == "unemployed" end,
            action = function(changeDialog, close)
                changeDialog("Here's what you'll do…", {
                    { label = "Sounds good", action = function(_, close) close() end },
                })
            end,
        },
        { label = "Goodbye", action = function(_, close) close() end },
    },
}
```

* `changeDialog(message, elements)` pushes the current screen to a stack and renders the new one. A "Back" entry is auto-injected.
* `close(callback)` closes the conversation and runs `callback` once the camera/HUD have been restored.
* `Escape` always closes the dialogue.

The dialogue camera, voice lines, HUD toggling and on-close exports are fully configurable in `Config.Dialogue`. If your server uses a HUD other than `core_ui` / `spirit`, replace the events in `Config.Dialogue.hudEvents`.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.var-fivem.com/interaction/configuration/dialog-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
