Configuration

Follow all necessary steps to ensure the script works correctly

ESX

  • Check your es_extended/server/functions.lua to see if there is a function called ESX.RefreshJobs(), if this function is not included in your file, add it:

function ESX.RefreshJobs()
    local Jobs = {}
    local jobs = MySQL.query.await("SELECT * FROM jobs")

    for _, v in ipairs(jobs) do
        Jobs[v.name] = v
        Jobs[v.name].grades = {}
    end

    local jobGrades = MySQL.query.await("SELECT * FROM job_grades")

    for _, v in ipairs(jobGrades) do
        if Jobs[v.job_name] then
            Jobs[v.job_name].grades[tostring(v.grade)] = v
        else
            print(('[^3WARNING^7] Ignoring job grades for ^5"%s"^0 due to missing job'):format(v.job_name))
        end
    end

    for _, v in pairs(Jobs) do
        if ESX.Table.SizeOf(v.grades) == 0 then
            Jobs[v.name] = nil
            print(('[^3WARNING^7] Ignoring job ^5"%s"^0 due to no job grades found'):format(v.name))
        end
    end

    if not Jobs then
        -- Fallback data, if no jobs exist
        ESX.Jobs["unemployed"] = { label = "Unemployed", grades = { ["0"] = { grade = 0, label = "Unemployed", salary = 200, skin_male = {}, skin_female = {} } } }
    else
        ESX.Jobs = Jobs
    end
end

Export

In order for stores to deduct money correctly and be added to the businesses you want, you'll need to add this export to the stores that deduct money.

-- Server Side
local coords = GetEntityCoords(GetPlayerPed(source))
exports["jc_negocios"]:sumarGanancia(price, coords.x, coords.y, coords.z)

Example

For example, for weapons shops, esx_weaponshop/server/main.lua, we'll look for the section where it deducts money from purchases and add the export to the section where it deducts the money from the player who buys. This way, we can create all the ammunition businesses we want. For clothing stores, badulaques, etc., it will be the same. Look for the section where it deducts money from the player and add the export. This way, you can use all the points from that business.

Last updated