Interface
NPC Dialogue

NPC Dialogue exports

This is just a nice UI to add some actions when interacting with NPCs

Preview imagem

Client exports

Show NPC Dialogue

exports.mt_lib:showDialogue(data)
  • data: table (object)
    • ped: number (integer)
      • Target ped entity
    • label: string
      • Dialogue Title
    • speech: string
      • Dialogue description
    • options: table (object)
      • id: string | number
        • Option index
      • label: string
        • Option label
      • icon: string
        • Option Icon from Fontawesome
      • close: boolean
        • If the UI should close after using the option
      • action: function
        • Function to execute when clicking the option
      • canInteract: boolean
        • Check to show the option or not (optional, true by default)

Usage example:

exports.ox_target:addLocalEntity(ped, {
    {
        label = "Falar com a Maria",
        icon = "fas fa-refresh",
        onSelect = function()
            exports.mt_lib:showDialogue({
                ped = ped,
                label = 'Maria Fernanda',
                speech = 'How can I help sweety?',
                options = {
                    {
                        id = 'sell',
                        label = 'I want to sell fruits',
                        icon = 'apple-alt',
                        close = true,
                        action = function()
                            -- Code
                        end
                    },
                    {
                        id = 'buy',
                        label = 'I want to buy seeds',
                        icon = 'seedling',
                        close = true,
                        action = function()
                            -- Code
                        end
                    },
                    {
                        id = 'close',
                        label = 'I don't need anything',
                        icon = 'ban',
                        close = true,
                    },
                }
            })
        end
    }
})