Dialog

Library
Updated 2 months ago · v1.3.7

The dialog system provides interactive NPC-style dialog with camera focus, branching responses, and metadata display.

lib.registerDialog

Register a dialog tree.

lua
lib.registerDialog('shop_npc', {
    entity = pedEntity,
    title = 'Shop Keeper',
    dialog = 'Welcome! What can I help you with?',
    responses = {
        { label = 'Show me your wares', action = function() TriggerEvent('shop:open') end },
        { label = 'Nevermind', action = function() end },
    },
})
ParameterTypeRequiredDescription
idstringyesUnique dialog identifier
datatableyesDialog definition

Dialog Data

FieldTypeDescription
titlestringDialog title
dialogstringMain dialog text
iconstringOptional icon
entitynumberOptional ped/entity for camera focus
responsestable | functionDialog responses array or callback returning responses
metadatatable | functionOptional metadata badges
prevDialogstringPrevious dialog ID for back-navigation
prevContextstringPrevious context menu ID for back-navigation
clickSoundsbooleanOverride click sounds
hoverSoundsbooleanOverride hover sounds
disableFocusbooleanDisable scripted camera focus

Response Fields

FieldTypeDescription
labelstringButton label
actionfunctionCallback when selected
dialogstringOpen another dialog
contextstringOpen a context menu
dontClosebooleanKeep dialog open after action

lib.openDialog

Open a registered dialog.

lua
lib.openDialog(pedEntity, 'shop_npc')
ParameterTypeRequiredDescription
entitynumbernoEntity used for camera focus
idstringyesRegistered dialog ID

lib.closeDialog

Close one dialog by ID, or all open dialogs if no ID is provided.

lua
lib.closeDialog('shop_npc')
lib.closeDialog() -- close all
ParameterTypeRequiredDescription
idstringnoDialog ID to close
keep_cambooleannoKeep current dialog camera active
Was this page helpful?
This page was last updated on 12 March 2026
DIRKSCRIPTS
All you need for your FiveM server.10% off your first order

Unsubscribe any time.

Copyright © 2026 DirkScripts. Not affiliated with or endorsed by Rockstar North or Take-Two Interactive.