[RELEASE][ESX] esx_crafting

Hey guys,

I made this resource a while ago, some dutch servers were using it so I thought I might as well release it to the public. This resource allows you to craft certain items by playing a game (https://codepen.io/marctannous/pen/qONmob) and also has a crafting points system (which you can edit).

It also has a threshold system with the point system where you have to be a certain points (all of this you can edit in the config) you can also set it to 0 to totally remove it with items.

Some clarification on the config:
You can edit the config very easy to make it create items that you want to, you can remove the items I left in there because it was made for someone else first

["item_name"] = { // This is the name of the item you want to craft (not the label)
        label = "Item Label", // The label of the item you want to craft
        needs = { // Here you can put certain items you need before you can start crafting, you can add as many as you want to.
            ["item_to_use_name"] = {label = "Item Use Label", count = 1},  // the key of the table is the item name (not label)
            ["item_to_use_name2"] = {label = "Item Use Label", count = 2},
        },
        threshold = 0, // Here you can set a certain threshold where a player has to have a certain amount of points to craft this item, you can leave it 0 when you don't want to use the point system.
    },

Support
I don’t really wanna deal with support privately anymore, I will respond on the FiveM forums sometimes but not on discord anymore.

Installation
Download: https://github.com/KASHZIN/esx_crafting

  • Put the ‘esx_crafting’ in your resource folder. Pay ATTENTION: You have to call the resource ‘esx_crafting’ in order for the javascript to work!!!

  • Start the resource in your server.cfg

  • Upload the esx_crafting.sql to your database

  • Voila, you can edit the config however you like, I added some comments that explain how the config works.

Credits
I also have to give credits ofcourse to Marc Tannous (https://codepen.io/marctannous) for the codepen.io code.

Hope you all enjoy the resource <3

(sorry that I don’t have screenshots, if people respond with them or even a video would be lovely! or else I will be adding them soon)

15 Likes

Ouvv <3

1 Like

wasn’t this already a thing few month ago

Don’t work i get error for client main 28 in f8 menu
image

1 Like

Replace that in the client.lua

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(7)
        if ESX ~= nil and Crafting.Locations ~= nil then
            local pos = GetEntityCoords(GetPlayerPed(-1), true)
            for i=1, #Crafting.Locations, 1 do
                if GetDistanceBetweenCoords(pos.x, pos.y, pos.z, Crafting.Locations[i].x, Crafting.Locations[i].y, Crafting.Locations[i].z, true) < 2.5 then
                    DrawText3D(Crafting.Locations[i].x, Crafting.Locations[i].y, Crafting.Locations[i].z, "[~g~E~w~] to craft item")
                    if IsControlJustReleased(0, Keys["E"]) then
                        OpenCraftMenu()
                    end
                end
            end
        end
    end
end)

DrawText3D = function(x, y, z, text)
    local onScreen,x,y = World3dToScreen2d(x, y, z)
    local factor = #text / 370

    if onScreen then
        SetTextScale(0.35, 0.35)
        SetTextFont(4)
        SetTextProportional(1)
        SetTextColour(255, 255, 255, 215)
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        DrawText(x,y)
        DrawRect(x,y + 0.0125, 0.015 + factor, 0.03, 41, 11, 41, 120)
    end
end
4 Likes

Legend thank you :slight_smile:

1 Like

So changed that config and now the error seems to have gone but when go to the location can’t do nothing no crafting menu or nothing.

picturessss plz

2 Likes

“This resource allows you to craft certain items by playing a game”

That is extremely vague. Could you possibly give some more information?

Sorry I always forget to remove my added things to es_extenden, I have pushed a fix to the repository.
Also thanks @HytroNTV for posting the fix <3

2 Likes

Yeah, thats basically what it is xd, when I have the time I’ll make a short video of the resource

1 Like

There seems to be a error somewhere, when i try to craft something, it wont let me and some extended errors is appear. Seems to be something in line 65 in server.lua :man_shrugging:

Can you post a screenshot?

Once I get home, I can send a screenshot, I mean it is working, i get the menu and stuff but when I’m about to craft it give errors in line 65 in server.lua

if xPlayer.getInventoryItem(itemname).count < v.count then
            cb(false)
        end
1 Like

Alright maybe you could’ve put in a wrong itemname in the config that it can’t get the item.

Ye maybe, I’m will take a look on that :slight_smile:

You can do html hud can you :smiley:

is there a way to make it so the click doesnt have be exact on the thing, and so it doesnt take the items if it fails

To change the position you click you can edit the window.addEventListener('click' function()). You certainly can remove that you lose items in server/main.lua you can change line 30 to
if rand <= 100 then or remove the if statement as a whole

whats the menu look like for this?