DirkScripts Logo

Login With FiveM

Login

📚 Dirk Lib
â€ē
Modules
â€ē
ui
â€ē

Dialog

Dialog

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

Copyright Š 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.