Exports
This section is aimed at developers. Basic scripting knowledge will help you get the most out of it.
The crm-radialmenu script lets you add or remove menus and items dynamically using exports.
qb-radialmenu bridge — if a script already supports qb-radialmenu exports, you don’t need to change anything. crm-radialmenu includes an automatic compatibility bridge.
add
Add a new menu, or add new items to an existing menu.
-- Add a new item to an existing menu:
exports['crm-radialmenu']:add(
{
crm_menu = "crm-citizen",
crm_items = {
{
crm_id = 'crm-test-item-1',
crm_title = "New Item 1",
crm_icon = "globe",
crm_close = true,
crm_click = function()
print('New Item 1 Clicked')
end,
},
{
crm_id = 'crm-test-item-2',
crm_title = "New Item 2",
crm_icon = "globe",
crm_close = true,
crm_action = {crm_type = "crm-client", crm_event = "qb-phone:client:GiveContactDetails", crm_args = {}},
},
},
}
)
-- Add a new menu to the radial:
exports['crm-radialmenu']:add(
{
crm_id = 'crm-new-menu',
crm_title = "My New Menu",
crm_icon = "car",
crm_items = {
{
crm_id = 'crm-new-menu-1',
crm_title = "Menu Item 1",
crm_icon = "car",
crm_close = true,
crm_command = "commandname", -- Execute /commandname
},
},
}
)remove
Remove items from an existing menu, or remove an entire menu by its ID.
-- Remove an item from an existing menu:
exports['crm-radialmenu']:remove(
{crm_menu = "crm-citizen", crm_items = {"crm-test-item-1", "crm-test-item-2"}}
)
-- Remove a menu from the radial:
exports['crm-radialmenu']:remove("crm-new-menu")