Config

RegisterCommand('testMenu', function()
    local menuArray = {
        id = 'menu_test_1', -- unique ID for General Menu
        titleConfig = { -- title configuration
            menuTitle = "Test Menu", -- title text
            menuTitleType = 'animated', -- type of icon
            menuTitleIcon = "vczwnict", -- icon name
        },
        menuItems = {
            {
                title = "Item 3", -- menu item title
                description = "This is item 3", -- description; if you don't want the description, just remove it
                iconAnimated = "vczwnict", -- icon type and icon name, different types:
                
                -- animated = https://lordicon.com/
                -- icon = https://fontawesome.com/
                -- imageByItemName = go to nui/main.js and replace https://cfx-nui-qb-inventory/html/images/${this.iconName}.png for your inventory
                params = {
                    handler = function()
                        -- here is where you want

                        local newArray = {
                            titleConfig = {
                                menuTitle = "Sub Menu",
                                menuTitleType = 'animated',
                                menuTitleIcon = "vczwnict",
                            },
                            menuItems = {
                                {
                                    title = "Sub Item 1",
                                    description = "This is sub item 1",
                                    imageByItemName = "phone",
                                    params = {
                                        handler = function()
                                            print("Sub Item 1 was clicked")
                                        end
                                    }
                                }
                            }
                        }
                        exports['cT-Menu']:createContextMenu(newArray)
                    end
                }
            }
        }
    }

    exports['cT-Menu']:createContextMenu(menuArray)
end)

Última actualización