Custom Pause Menu Navbar

Adding

Head over to /shared/ui_cfg/config_pausemenu.lua file and find:

Config.PauseMenu.Buttons = {
    ['ui'] = {
        name = 'ui',
        path = {
            type = 'UISettings',
        },
        icon = 'UI',
    },
    ['settings'] = {
        name = 'settings',
        path = {
            type = 'game',
            value = 'settings',
        },
        icon = 'fas fa-cog',
    },
    ['map'] = {
        name = 'map',
        path = {
            type = 'game',
            value = 'map',
        },
        icon = 'fas fa-map',
    },
}

In that example, we will add Logout action for our Multicharacter.

['logout'] = { -- Unique key
    name = 'logout', -- Unique name as the key
    path = {
        type = 'custom_payload', -- Do not change that!
        export = {
            resource = 'ZSX_Multicharacter',
            exportFunction = 'Logout',
            params = {}
        },
    },
    icon = 'fas fa-times',
},

Path object explained

Path is the object that determines payload which will be executed after user interaction.

key
Information

type

This should always be 'custom_payload'

export

Object revised beneath

icon

Export object explained

There's 2 options to use it properly. There's an export object which obviously is only client-sided. You can use it for any kind of interaction you'd like to. Other is event, which needs to be determined whether it's client sided or server sided. Also, take a note that you can parse params, but there's a catch. Do not use it as an object since we unpack the table!

Export object

key
Information

resource

Determines parent resource of the selected export

exportFunction

Exported function name

params

Arguments of the function

Event object

key
Information

type

Determines if it's client or server side event

name

Registered event name

params

Arguments of the event

Examples

Export

['logout'] = { -- Unique key
    name = 'logout', -- Unique name as the key
    path = {
        type = 'custom_payload', -- Do not change that!
        export = {
            resource = 'ZSX_Multicharacter',
            exportFunction = 'Logout',
            params = {}
        },
    },
    icon = 'fas fa-times',
},

Event

['logout'] = { -- Unique key
    name = 'logout', -- Unique name as the key
    path = {
        type = 'custom_payload', -- Do not change that!
        event = {
            type = 'client',
            name = 'ZSX_Multicharacter:Event:Logout',
            params = {},
        },
    },
    icon = 'fas fa-times',
},

Last updated