📍Dialog System

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.


Last updated