Skip to content

Commit

Permalink
feature: if menu exists with same id, remove older and create new
Browse files Browse the repository at this point in the history
  • Loading branch information
SubZer0GLX committed Oct 4, 2024
1 parent 7ccb2a9 commit bd63eb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions modules/mri/client-side/ox_lib-modules/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ end
exports('RemoveItemFromMenu', removeItemFromMenu)

local function addManageMenu(item)
if locateMenuItem(managementMenu, item.title) > 0 then
removeItemFromMenu('management', item.title)
end
addItemToMenu('management', item)
end

Expand All @@ -105,6 +108,9 @@ end
exports('RemoveManageMenu', removeManageMenu)

local function addPlayerMenu(item)
if locateMenuItem(runTimePlayerMenu, item.title) > 0 then
removeItemFromMenu('player', item.title)
end
addItemToMenu('player', item)
end

Expand Down
2 changes: 1 addition & 1 deletion modules/mri/client-side/ox_lib-modules/staff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ local function openStaffMenu()
lib.showContext(ctx.id)
end

exports['mri_Qbox']:AddItemToMenu('f10',
exports['mri_Qbox']:AddManageMenu(
{
title = 'Staff',
description = 'Gerencie a staff do servidor.',
Expand Down
2 changes: 1 addition & 1 deletion modules/mri/client-side/ox_lib-modules/vip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ local function openVipMenu()
lib.showContext(ctx.id)
end

exports['mri_Qbox']:AddItemToMenu('f10',
exports['mri_Qbox']:AddManageMenu(
{
title = 'Vip',
description = 'Gerencie o Vip do servidor.',
Expand Down

0 comments on commit bd63eb0

Please sign in to comment.