The AddItem export allows you to add a new action item to an existing category in the radial menu. This is useful when you want to trigger custom logic, open interfaces, or integrate actions from other scripts without modifying the main menu configuration.
To add an item to a category, use the following client-side export:
local success, error = exports['qs-radialmenu']:AddItem(categoryId, itemData)
local success, error = exports['qs-radialmenu']:AddItem(categoryId, itemData)
-- Add a basic item to a category
local success, error = exports['qs-radialmenu']:AddItem("myresource_main", {
label = "Open Menu",
icon = "Menu",
action = function()
print("Item clicked!")
end
})
if not success then
print("Error adding item: " .. tostring(error))
end
-- Add a basic item to a category
local success, error = exports['qs-radialmenu']:AddItem("myresource_main", {
label = "Open Menu",
icon = "Menu",
action = function()
print("Item clicked!")
end
})
if not success then
print("Error adding item: " .. tostring(error))
end
This will add a clickable item called “Open Menu” inside the specified category.
Adding an Item to a Config Category
-- Add item to an existing category defined in config.lua
exports['qs-radialmenu']:AddItem("Vehicle", {
label = "Repair Vehicle",
icon = "Wrench",
action = function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
SetVehicleEngineHealth(vehicle, 1000.0)
SetVehicleBodyHealth(vehicle, 1000.0)
end
end
})
-- Add item to an existing category defined in config.lua
exports['qs-radialmenu']:AddItem("Vehicle", {
label = "Repair Vehicle",
icon = "Wrench",
action = function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
SetVehicleEngineHealth(vehicle, 1000.0)
SetVehicleBodyHealth(vehicle, 1000.0)
end
end
})
You can use the category label directly if the category already exists in config.lua.
Item with Job Restriction
-- Item only visible for police
exports['qs-radialmenu']:AddItem("police_menu", {
label = "Fine Player",
icon = "Ticket",
job = "police",
jobGrade = 2,
action = function()
exports['police-system']:FinePlayer()
end
})
-- Item only visible for police
exports['qs-radialmenu']:AddItem("police_menu", {
label = "Fine Player",
icon = "Ticket",
job = "police",
jobGrade = 2,
action = function()
exports['police-system']:FinePlayer()
end
})
The item will only appear if the player has the required job and grade.
Item with Dynamic canInteract
-- Item only visible when the player has a specific item
exports['qs-radialmenu']:AddItem("myresource_main", {
label = "Use Special Item",
icon = "Star",
canInteract = function()
return exports['qb-core']:HasItem('special_item')
end,
action = function()
exports['qb-core']:UseItem('special_item')
end
})
-- Item only visible when the player has a specific item
exports['qs-radialmenu']:AddItem("myresource_main", {
label = "Use Special Item",
icon = "Star",
canInteract = function()
return exports['qb-core']:HasItem('special_item')
end,
action = function()
exports['qb-core']:UseItem('special_item')
end
})
The item will automatically appear or disappear based on the condition.
success -- true or false
error -- error message if something failed
success -- true or false
error -- error message if something failed
true → Item added successfully
false → Item was not added (error message provided)