diff --git a/package/client/resource/interface/radial.ts b/package/client/resource/interface/radial.ts index d05528cd9..3797cf8a6 100644 --- a/package/client/resource/interface/radial.ts +++ b/package/client/resource/interface/radial.ts @@ -4,7 +4,7 @@ type RadialItem = { id: string; label: string; icon: IconName | [IconPrefix, IconName]; - onSelect?: () => void; + onSelect?: (currentMenu: string | null, itemIndex: number) => void; menu?: string; }; diff --git a/resource/interface/client/radial.lua b/resource/interface/client/radial.lua index 51c92784d..c922af7f8 100644 --- a/resource/interface/client/radial.lua +++ b/resource/interface/client/radial.lua @@ -3,7 +3,7 @@ ---@field icon string ---@field label string ---@field menu? string ----@field onSelect? function +---@field onSelect? fun(currentMenu: string | nil, itemIndex: number) ---@field [string] any ---@class RadialMenuProps @@ -168,7 +168,15 @@ end RegisterNUICallback('radialClick', function(index, cb) cb(1) - local item = (currentRadial and currentRadial.items or menuItems)[index + 1] + local itemIndex = index + 1 + local item, currentMenu + + if currentRadial then + item = currentRadial.items[itemIndex] + currentMenu = currentRadial.id + else + item = menuItems[itemIndex] + end if item.menu then if currentRadial then @@ -180,7 +188,7 @@ RegisterNUICallback('radialClick', function(index, cb) lib.hideRadial() end - if item.onSelect then item.onSelect() end + if item.onSelect then item.onSelect(currentMenu, itemIndex) end end) RegisterNUICallback('radialBack', function(_, cb)