context menu

Fontawesome is used to add icons to the list items, you can find the code here.

Context Menu


How to use:

Client-side using exports

Example:

-- menu table
local menu = {
	{
		header = 'header',
		isMenuHeader = true
	},
	{
		header = "Item #1",
		txt = "This trigger an event",
		icon = "fas fa-user", -- add icon to item
		--disabled = true, -- make item disabled
		params = {
			event = "event:client:test1",
			args = {
				number = 1,
			}
		}
	},
	{
		header = "Item #2",
		txt = "Can trigger a event to open a submenu",
		params = {
			event = "qb-menu:client:test2",
			args = {
				number = 2,
			}
		}
	},
}

-- open context menu
exports.lvs_lib:openContext(menu)


-- close context menu
exports.lvs_lib:closeContext()

qb-menu replacement

To replace qb-menu with this script, you need to enable the functionality in the config.lua and remove a comment in the fxmanifest.lua

fxmanifest.lua (line 57)
provide 'qb-menu'
config.lua
--- ### CONTEXT ###
-- make lvs context menu replace of qb-menu
-- uncomment line 57 on fxmanifest.lua [provide 'qb-menu']
-- remove qb-menu
Config.ContextAsQBMenu = true
Config.QBMenuCommand = {
    name = 'playerfocus',
    description = 'Give Menu Focus',
    key = 'Alt',
    keymapping = 'LMENU'
}

Last updated