Setup

ox_inventory -> client.lua

Step 1 - Add Button Functions

find this

---@param id number
---@param slot number
local function useButton(id, slot)
	if PlayerData.loaded and not invBusy and not lib.progressActive() then
		local item = PlayerData.inventory[slot]
		if not item then return end

		local data = Items[item.name]
		local buttons = data?.buttons

		if buttons and buttons[id]?.action then
			buttons[id].action(slot)
		end
	end
end

replace to this

---@param id number
---@param slot number
local function useButton(id, slot)
	if PlayerData.loaded and not invBusy and not lib.progressActive() then
		local item = PlayerData.inventory[slot]
		if not item then return end

		local data = exports.fmid_split:GetItemData(PlayerData.inventory, slot)
		local buttons = data?.buttons

		if buttons and buttons[id]?.action then
			buttons[id].action(slot)
		end
	end
end

Step 2 - Apply Split Button to all items

find this event

ox_inventory:setPlayerInventory

and this keyword inside that eventname,

ItemData[v.name] = {

above that words, you can put this

buttons = exports.fmid_split:SetSplitButton(buttons)

Step 3 - Save Data of All Overwritten Items

find this

SendNUIMessage({
	action = 'init',
	data = {
		locale = uiLocales,
		items = ItemData,
		leftInventory = {
			id = cache.playerId,
			slots = shared.playerslots,
			items = PlayerData.inventory,
			maxWeight = shared.playerweight,
		},
		imagepath = client.imagepath
	}
})

above of that, you can add this

exports.fmid_split:SaveItemData(ItemData)

Last Setup, Adjust your server.cfg

put fmid_split resource above of ox_inventory at server.cfg's list,

example

ensure fmid_split
ensure ox_inventory

Setup Done! you can enjoy the script.

Last updated