Installation:

There isn't too much to the installation, you just need to edit a few things in ox_inventory.

I also made sure not to interfere with the default crafting functionality if you're using that!

First we need to head to the file "ox_inventory/modules/inventory/server.lua", we're looking for the event "ox_inventory:closeInventory". We're going to add a new event hook for the scraping feature

RegisterServerEvent('ox_inventory:closeInventory', function()
	local inventory = Inventories[source]

	if inventory?.open then
		local secondary = Inventories[inventory.open]

		if secondary then
			if not TriggerEventHooks('closeInventory', {
				source = source,
				changed = secondary.changed,
				toInventory = secondary.id,
				fromInventory = inventory,
				items = secondary.items,
				stashid = secondary.dbId
			}) then return false end
			secondary:closeInventory()
		end

		inventory:closeInventory(true)
	end
end)

Next head to "ox_inventory/modules/crafting/server.lua, and we need to edit a few things here.

First you need to add an export to the createCraftingBench function:

After the createCraftingBench function we're going to add a new function so we can delete the benches if needed:

Next we're looking for the line:

"recipeId" just needs to be changed to recipe here:

In the callback "ox_inventory:openCraftingBench", the return needs to be edited to return the bench data. It looks like so:

We have to return back the bench alongside the other data like so:

Last thing that needs to be changed in this file is adding a new event hook in the callback "ox_inventory:craftItem":

Look for the line:

Underneath that add this event hook:

Now head over to the file "ox_inventory/client.lua"

We're looking for the "ox_inventory:startCrafting" callback, in there you just need to remove the line:

It should now look like this:

Now look for the function "client.OpenInventory"

Specifically the crafting portion of it "elseif inv == "crafting"

You need to change the line from:

To:

This line after this callback needs to be deleted:

Lastly in "QBCore/server/player.lua" we just need to add the metadata option.

You can add it anywhere inside the QBCore.Player.CheckPlayerData function:

And that's everything, you're all set!

Hope you enjoy the resource, if you have any questions, suggestions, or issues please join the discord and I'll assist you!

Last updated