ox_inventory
ox_inventory copied to clipboard
Change givePlayerList to use contextMenu instead of normal menu
Is your feature request related to a problem? Please describe. When the feature is enabled you have to switch between mouse use (to select the give option) and the keyboard (to select which person should recive the item)
Describe the solution you'd like Change the use of lib.registerMenu with lib.registerContext
You can replace from line 1677 to line 1700 with this snippet and it should work
for i = 1, #nearbyPlayers do
local option = nearbyPlayers[i]
if isGiveTargetValid(option.ped, option.coords) then
local playerName = GetPlayerName(option.id)
option.id = GetPlayerServerId(option.id)
---@diagnostic disable-next-line: inject-field
option.title = ('[%s] %s'):format(option.id, playerName)
option.onSelect = function ()
giveItemToTarget(option.id, data.slot, data.count)
end
n += 1
giveList[n] = option
end
end
if n == 0 then return end
lib.registerContext({
id = 'ox_inventory:givePlayerList',
title = 'Give item',
options = giveList
})
return lib.showContext('ox_inventory:givePlayerList')