Faustin Resources

Exports

Add your own pages, markers, legend headings and settings from your scripts.

lua
local menu = exports.faustin_pausemenu

-- opening
menu:Open()                 -- or menu:Open('status'), menu:Open('settings')
menu:Close()
menu:Toggle()
menu:IsOpen()
menu:SetStartTab('status')

-- your own page on a tab of the menu
menu:AddPage({
    id = 'jobs', label = 'Jobs', order = 10,
    content = {
        { title = 'Open positions', items = {
            { type = 'text', text = 'Pick a job to get started.' },
            { type = 'stat', label = 'Hiring', value = '12' },
            { type = 'button', id = 'apply', label = 'Mechanic', hint = 'Los Santos Customs', text = 'Apply' },
            { type = 'toggle', id = 'notify', label = 'Notify me', value = true },
            { type = 'select', id = 'area', label = 'Area', value = 'a', options = { { value = 'a', label = 'Vinewood' }, { value = 'b', label = 'Paleto' } } },
            { type = 'input', id = 'note', label = 'Note', placeholder = 'Optional' },
            { type = 'list', rows = { { label = 'Taxi', value = '3 open' } } },
        } },
    },
})
-- or your own html from your resource: url = 'https://cfx-nui-my_resource/page.html'
AddEventHandler('faustin_pausemenu:pageAction', function(page, item, value) end)
menu:SetPageContent('jobs', content)
menu:UpdatePage('jobs', { label = 'Work' })
menu:OpenPage('jobs')
menu:ClosePage()
menu:CurrentPage()
menu:RemovePage('jobs')

-- markers on the map
local id = menu:AddMarker({
    coords = vec3(100.0, 200.0, 30.0), -- or entity = vehicle, it then follows the entity
    sprite = 60,                       -- or icon = 'name' from web/blips/custom
    colour = '#4fd8c4', label = 'Patrol', group = 'services',
    edge = true,                       -- arrow at the edge of the map when out of view
    cone = { fov = 70, range = 60 },   -- view cone, takes heading from the entity or from heading =
})
menu:RemoveMarker(id)
menu:ClearMarkers()

-- headings in the legend
menu:AddLegendGroup('services', 'Services', 1)
menu:SetLegendGroup({ sprite = 60 }, 'services')     -- or { name = 'Shop*' } or { blip = handle }
menu:SetLegendGroupHidden('services', true)
menu:RemoveLegendGroup('services')

-- your own settings on the Settings tab, saved per player
menu:AddSettings('phone', { label = 'Phone', col = 'map', items = {
    { key = 'silent', label = 'Silent mode', hint = 'No ringtone', type = 'bool', default = false },
} })
AddEventHandler('faustin_pausemenu:settingChanged', function(group, key, value) end)
menu:GetSetting('phone', 'silent')
menu:SetSetting('phone', 'silent', true)
menu:RemoveSettings('phone')

-- the rest
menu:SetProfile({ first = 'Maya', last = 'Torres', job = 'Police', grade = 'Sergeant', avatar = 'https://...' })
menu:SetPostals('ocrp')     -- or false
menu:KeepVisible(entity)    -- stays visible outside the sight limit
menu:ReleaseVisible(entity)

Everything a resource adds is removed when that resource stops, and only that resource can change it.

Hook your own HUD up with Config.hideHud, it gets true when the menu opens and false when it closes.