Exports

Functions

OpenDialog

Opens a dialog interaction with a specified NPC or entity, allowing players to select options from a customizable menu.

Parameters:

  • data: A table containing the following fields:

    • ped: The NPC or entity to interact with.

    • pedName: A string representing the name of the NPC displayed at the top of the dialog.

    • info (optional): A descriptive text providing additional context or information about the dialog.

    • options: A table of interaction options. Each option can define an action to take when selected.

Usage:

exports('OpenDialog', OpenDialog)

Example:

OpenDialog({ 
    ped = GetClosestPed(5.0), -- The NPC or entity to interact with
    pedName = 'Merchant', -- The name of the NPC
    info = 'Welcome to my shop! What would you like to do?', -- Optional dialog description
    options = { 
        { 
            label = 'Buy Items', -- Text for the interaction option
            onSelect = function() 
                print('You chose to buy items!') 
            end 
        }, 
        { 
            label = 'Sell Items', 
            onSelect = function() 
                print('You chose to sell items!') 
            end 
        }, 
        { 
            label = 'Leave', 
            onSelect = function() 
                print('You left the conversation.') 
            end 
        } 
    } 
})

Last updated