[RELEASE][ESX] esx_crafting

For anyone wanting to know what the UI looks like…

Someone please make this work for InventoryHud xD

1 Like

Would be pretty dope, pretty sure it’s not that hard to make

1 Like

Cant be too hard im sure!

Just depends if the pros will share there findings or not :roll_eyes:

1 Like

I hope so, that would be super badass of them. :crazy_face:

1 Like

within the config how to we make it craft multiples,
like making 2/3/4/5 lockpicks at once

you could add an amount variable to the item table:

["lockpick"] = {
        label = "Lockpick",
        needs = {
            ["metalscrap"] = {label = "Metalscrap", count = 2},
            ["plastic"] = {label = "Plastic", count = 4},
            ["wood"] = {label = "Wood", count = 1},
        },
        threshold = 100,
        amount = 4,
    },

And edit the success event like this:

RegisterServerEvent('rs_crafting:CraftingSuccess')
AddEventHandler('rs_crafting:CraftingSuccess', function(CraftItem)
    local src = source
    local xPlayer = ESX.GetPlayerFromId(src)
    local item = Crafting.Items[CraftItem]
    for itemname, v in pairs(item.needs) do
        xPlayer.removeInventoryItem(itemname, v.count)
    end
    if CraftItem == "weapon_pistol" or CraftItem == "weapon_combatpistol" then
        xPlayer.addWeapon(CraftItem, 0)
    else
        xPlayer.addInventoryItem(CraftItem, item.amount)
    end
    -- Adding function for crafting points (you can remove it if you want, YOU HAVE TO REMOVE THRESHOLDS ASWELL) 
    AddCraftingPoints(src)
    TriggerClientEvent('esx:showNotification', src, "You have made ~b~"..item.label.."~w~!")
end)
1 Like

Is there anyway to remove this mini game

You could remove

SetNuiFocus(true,true)
SendNUIMessage({
      action = "opengame",
})

and just trigger the server success event

1 Like

Thanks :smiley:

@KASH I created it like this but when i start crafting it just freeze me and i dont get item
https://pastebin.com/ePSrRxdD

You have to add the item you want to craft to the server event so like this:
TriggerServerEvent("rs_crafting:CraftingSuccess", CurrentCraft)

Thanks for great script and realeasing it and helping community.

Is there any chance that i can put like u need pistol to reassemble and get grip barrel etc…

Yes, just add the items to the config and set the grip item in the needs table

Nice release nerd :wink:

Is there anyway to make crafting to be in esx_inventoryhud so u swap item that u want to craft and u lose required items

It is. just make the items in the SQL table.

Do u have code maybe

Thanks a lot for this, saved me a bunch of time.

So ive been trying to make separate shops in this, for example hidden ones for drug components and general ones for normal stuff.

When adding a shop with

Crafting.Locations = {
    [1] = {x = , y = , z = },
   [2] = {x = , y = , z = },

All the shops are linked with what they can craft.

When i make a separate separate resource and run it as a separate shop it causes all kinds of issues and only one of the shops will work.