[ESX] Adding core_crafting crafting in Base Building

This snippet will help you setup crafting from core_crafting as events to use on other scripts like hrs_base_building

In core_crafting

core_crafting\client\main.lua

  • OLD CODE:


Citizen.CreateThread(
    function()
        while true do
            Citizen.Wait(1)

            local ped = PlayerPedId()
            local coords = GetEntityCoords(ped)

            for _, v in ipairs(Config.Workbenches) do
                local dst = #(coords - v.coords)
                if dst < 20 then
                    DrawText3D(v.coords[1], v.coords[2], v.coords[3] - 0.8, Config.Text["workbench_hologram"])
                end
                if dst < 2 then
                    if IsControlJustReleased(0, Keys["E"]) then
                        local open = false
                        for _, g in ipairs(v.jobs) do
                            if g == job then
                                open = true
                            end
                        end

                        if open or #v.jobs == 0 then
                            openWorkbench(v)
                        else
                            SendTextMessage(Config.Text["wrong_job"])
                        end
                    end
                end
            end
        end
    end
) 
  • NEW CODE:

core_crafting\config.lua

In HRS_base_building

hrs_base_building\config.lua

Last updated