menu
Creates and displays a context menu
Parameters:
name
(string): Unique identifier for the menulabel
(string, optional): Menu title (default: 'Context Menu')data
(table): Array of menu options
Menu Option Structure:
{
title = "Option Title", -- Display text for the option
description = "Option description", -- Subtitle/description text
icon = "fas fa-icon", -- Font Awesome icon
disabled = false, -- Whether option is disabled
action = function() end, -- Direct function to execute
event = "client:event", -- Client event to trigger
isServer = false, -- If true, triggers server event
args = {data = "value"} -- Arguments to pass with event
}
Example:
ps.menu('main_menu', 'Main Menu', {
{
title = 'Police Actions',
description = 'Access police menu',
icon = 'fas fa-shield-alt',
event = 'police:client:openMenu'
},
{
title = 'Check ID',
description = 'Check nearby player ID',
icon = 'fas fa-id-card',
isServer = true,
event = 'police:server:checkId',
args = {playerId = GetPlayerServerId(PlayerId())}
},
{
title = 'Close Menu',
description = 'Close this menu',
icon = 'fas fa-times',
action = function()
ps.closeMenu()
end
}
})
Last updated