Custom Context-Menu UI
Customizing the context-menu system used in Vanguard products.
Customize Context-Menu
How to create your Menu
You need to add this on your menu script.
Menu = Vanguard.GetMenu()
if Menu == "lib" then
Menu = lib
else
Menu = Vanguard
end
You need to register your menu on a function.
function OpenTestMenu()
Menu.showContext('test_menu')
end
You need to to create your menu.
Menu.registerContext({
id = 'test_menu', -- Same id/name on Menu.showContext
title = 'Test Menu', -- Your menu Title
description = 'New menu for your server', -- Your menu Description (optional)
canClose = true, -- This menu can be closed? (Leave true always)
options = {
{
title = 'Option 1', -- Your first option
icon = 'fa-solid fa-shirt', -- Your option Icon
description = 'Click to open option 1', -- Your option description.
onSelect = function()
print("you selected option 1") -- Here you put what this option can do.
end,
canClose = true -- When you click, the menu closes automatically-
},
{
title = 'Option 2',
icon = 'fa-solid fa-tools',
description = 'Click to open option 2',
onSelect = function()
print("you selected option 2")
end,
canClose = false -- When clicking the menu remains open-
}
}
})Now your menu is ready to work. (Dont forget to create a command or something else to execute the function created.)
ATTENTION! It is necessary to correctly add the Vanguard_Bridge in the fxmanifest for the menus to work. (Also you need to choice Vanguard on menu settings in the bridge.)


How to create your Menu with subMenus
You need to add this on your menu script.
You need to register your menu and subMenu function.
You need to to create your Menu and subMenu.
Now your menu is ready to work. (Dont forget to create a command or something else to execute the function created.)
ATTENTION! It is necessary to correctly add the Vanguard_Bridge in the fxmanifest for the menus to work.


Last updated