📄
jaksam's scripts documentation
  • 💻jaksam's scripts
    • Home
    • How to update the scripts
    • Fix server crash on script start
    • Issues with items
    • Manually set ESX shared object
    • Common FAQ
    • Nexus Terms
    • LICENSE
  • ⚠️FiveM escrow system errors
    • Home
    • Error parsing script ... <\1>
    • Failed to verify protected resource
    • You lack the required entitlement
    • What to do if nothing is fixing the errors
  • 💼Jobs Creator
    • Home
    • Installation
    • FAQ
    • Modules
    • Replacing default scripts names
    • Replacing default events names
    • Updating script from old versions
    • QBCore Jobs Injection
    • Client
      • Notifications
        • Replace default notifications
        • Replace help notification/TextUI
      • Actions
        • Using the actions in a radial/external menu
        • Replace default search action
        • Get player allowed actions
        • Open actions menu
        • Integrate external impound script
        • Vehicle repaired
        • Get if local player is handcuffed
      • Duty
        • Duty status toggled
        • Toggle current duty status
      • Buyable vehicles
        • Vehicle spawned
        • Vehicle parked
      • Garage owned
        • Vehicle spawned
        • Vehicle parked
      • Temporary garage
        • Vehicle spawned
        • Vehicle parked
      • Replace Stash/Safe/Armory
      • Replace default billing
      • Progress bar
    • Server
      • Armory
        • Add weapon to armory
        • Remove weapon from armory
        • Get player armory weapons
        • Get all armory weapons
      • Boss
        • Add society account money
        • Remove society account money
        • Get job account money
        • On player fired
        • On player hired
      • Buyable vehicles
        • Get if player is owner of vehicle plate
        • Get all vehicles of player
        • On vehicle bought
        • Get player vehicles in marker ID
      • Crafting table
        • Item crafted
      • Duty
        • Duty status changed
        • Get if a player is on duty
      • Harvest
        • Item harvested
      • Market
        • Item sold
      • Process
        • Item processed
      • Shop
        • Item bought
      • Search/Steal action
        • Item stolen
        • Account stolen
        • Weapon stolen
      • Set handcuffs state
  • 💰Robberies Creator
    • Home
    • Installation
    • FAQ
    • Modules
    • How to edit minigames
    • Client
      • Progress bar
      • Replace default police alert
      • Notifications
        • Replace default notifications
        • Replace default help notifications
    • Server
      • Heist started
      • Heist finished
      • Police alerted
      • Step completed
  • 💡Missions Creator
    • Home
    • Installation
    • How to start
    • How to add minigames
    • Client
      • Replace default police alert
      • On entity spawn
      • Notifications
        • Replace default notifications
        • Replace default help notifications
        • Replace default mugshot notifications
    • Server
      • Police alerted
      • On mission start
      • On mission failed
      • On mission success
  • 🛒Shops Creator
    • Home
    • Installation
    • How to use images for items
    • Client
      • Replace default police alert
      • Notifications
        • Replace default notifications
        • Replace default help notifications
    • Server
      • Police alerted
      • Shop bought
      • Shop sold
      • Get what objects can be sold in shop ID
      • Get objects in shop ID
  • 🚗Dealerships Creator
    • Home
    • Installation
    • Adding custom vehicles/classes
    • Client
      • On test drive vehicle spawn
      • Notifications
        • Replace default notifications
        • Replace default help notifications
      • Showroom
        • On showroom enter
        • On showroom exit
        • Get Is Player In Showroom
        • Get Is Player Doing Test Drive
    • Server
      • On vehicle given
      • On vehicle resell
  • 🏁Races Creator
    • Home
    • Installation
    • Client
      • Replace default police alert
      • Notifications
        • Replace default notifications
        • Replace default help notifications
    • Server
      • Police alerted
  • 📍Blips Creator
    • Home
    • Installation
    • FAQ
    • How to use custom sprites
    • Client
      • Open menu manually
  • 🚪Doors Creator
    • Home
    • Installation
    • FAQ
    • Modules
    • Change doors icon
    • Admin bypass lock
    • Client
      • Replace default notifications
      • Get closest door
      • Toggle icon display
      • Replace default police alert
      • Get door ID from entity
    • Server
      • Refresh database
      • Police alerted
      • Get door ID data
      • Get building ID data
      • Get all buildings list
      • Get all doors list
      • Set door ID state (locked/unlocked)
      • Lockpicked door
      • Create building
      • Create door
      • Delete door
      • Update door
  • 💊Drugs Creator
    • Home
    • Installation
    • FAQ
    • Modules
    • Client
      • Replace default notifications
      • Progress bar
      • Replace default mugshot notifications
      • Replace default help notifications
      • Replace default police alert
      • Manually start drugs effects
      • NPC Selling
        • Disable default selling method for NPCs
        • Add ped to selling blacklist
        • Remove ped from selling blacklist
        • Manually sell to a NPC
        • NPC accepted drug
    • Server
      • Fields
        • Item harvested
      • Harvestable items
        • Item harvested
      • Laboratories
        • Successful craft
      • Sellings
        • Sold to pusher
        • Sold in boat
        • Sold in plane
        • Sold to NPC
        • Sold to narcos
      • Police alerted
      • Pocket crafting finished
  • 🚜Farming Creator
    • Home
    • Installation
    • Client
      • Replace default notifications
      • Progress bar
      • Replace default help notifications
      • Replace default police alert
    • Server
      • Police alerted
      • Item farmed
  • 🛰️Trackers Creator
    • Home
    • Installation
    • FAQ
    • Optimization
    • Client
      • Replace default notifications
      • Panic button pressed
      • Manually start panic button
    • Server
      • Panic button pressed
      • Player lost signal
      • Player set new private frequency
  • 🔑Vehicles Keys
    • Home
    • Installation
    • FAQ
    • How to give keys with /car command
    • Fix hotwiring bought car
    • Lock/unlock vehicle
    • Client
      • Self give current vehicle plate
      • Self give vehicle plate
      • Self remove vehicle plate
      • Open remote UI menu
      • Open keys list
      • Toggle hotwiring
      • Get if local player owns a plate
      • Get owned plates of local player
      • Toggle closest vehicle lock
      • Switch vehicle lock
      • Vehicle locked/unlocked
      • Replace/Disable default progress bar
      • Refresh self owned vehicles
      • Replace default police alert
      • Notifications
        • Replace default notifications
        • Replace default help notifications
      • Bypass start vehicle check
    • Server
      • Refresh player owned vehicles
      • Get if player ID owns a plate
      • Vehicle locked/unlocked
      • Player hotwired a vehicle
      • Player lockpicked a vehicle
      • Give keys to identifier
      • Remove keys from identifier
      • Give keys to player ID
      • Remove keys from player ID
      • Vehicle window broken
      • Get player ID keys
      • Get identifier keys
      • Police alerted
      • Alarms
        • Alarm activated (player vehicle)
        • Alarm activated (NPC vehicle)
  • 🧾Billing UI
    • Home
    • Installation
    • Client
      • Activate billing mode
      • Open billing menu
      • Replace default notifications
      • Pay a bill
      • Send a bill
      • View invoices
    • Server
      • Create bill
      • Delete bill
      • Refresh bill
      • On bill created
      • On bill paid
  • ✅Easy allowlist
    • Home
    • Installation
    • FAQ
    • Commands usage
    • How to enable Discord features
    • External deferrals
    • Server
      • Allowlist
        • Remove identifier from allowlist
        • Add identifier to allowlist
      • Queue
        • Set player queue priority
        • Set discord role queue priority
        • Set identifier queue priority
        • Remove identifier queue priority
        • Remove discord role queue priority
        • Get count of players currently in queue
        • Get queue info
  • 👜Luxury Clothes Theft
    • Home
    • Installation
    • Client
      • Replace default notifications
Powered by GitBook
On this page
  • 3.5 Update - to do if your version is older than 3.5
  • 3.8 Update - to do if your version is older than 3.8
  • 3.11 Update - to do if your version is older than 3.11
  • 3.14 Update - to do if your version is older than 3.14
  • 3.16 Update - to do if your version is older than 3.16
  • 3.18 Update - to do if your version is older than 3.18
  • 4.0 Update - to do if your version is older than 4.0
  • 8.0 Update - to do if your version is older than 8.0

Was this helpful?

  1. Jobs Creator

Updating script from old versions

This section will explain how to update the script from old versions You'll have to follow all steps from your current version to the newer one

A backup is always suggested before doing these steps

3.5 Update - to do if your version is older than 3.5

Add the following code in jobs_creator/integrations/sv_integrations.lua and use the command in the server console or in game (there will be an output when you use the command)

RegisterCommand('updateRecipes', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="crafting_table"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id

                if(result.data) then
                    local data = json.decode(result.data)

                    local newData = {}

                    local anythingChanged = false

                    if(data.craftablesItems) then
                        for itemName, craftingData in pairs(data.craftablesItems) do
                            if(not craftingData.recipes) then
                                anythingChanged = true
                            end

                            newData[itemName] = {
                                recipes = craftingData,
                                animations = {}
                            }
                        end
                    end

                    local markerData = {
                        craftablesItems = newData
                    }

                    if(anythingChanged) then
                        print("Updating marker ID: " .. markerId)
                        MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                            ['@newData'] = json.encode(markerData),
                            ['@markerId'] = markerId
                        })
                    else
                        print("Marker ID " .. markerId .. " doesn't need to update")
                    end
                end
            end
        end)
    end
end)

3.8 Update - to do if your version is older than 3.8

Run this query in the database to convert old job shop items

ALTER TABLE job_shop ADD COLUMN IF NOT EXISTS `item_type` VARCHAR(50) NOT NULL AFTER item_name;
UPDATE job_shop SET item_type = "item_standard";

3.11 Update - to do if your version is older than 3.11

Add the following code in jobs_creator/integrations/sv_integrations.lua and use the command in the server console or in game (there will be an output when you use the command)

RegisterCommand('updateHarvest', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemQuantity) then
                        data.itemMinQuantity = data.itemQuantity
                        data.itemMaxQuantity = data.itemQuantity
                        data.itemQuantity = nil

                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

3.14 Update - to do if your version is older than 3.14

Run this query in the database to convert old database tables and to create the new one

CREATE TABLE IF NOT EXISTS `jobs_wardrobes` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `identifier` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
    `label` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
    `outfit` LONGTEXT NOT NULL DEFAULT '' COLLATE 'utf8mb4_bin',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `identifier` (`identifier`) USING BTREE
);

RENAME TABLE 
    job_armory TO jobs_armories,
    job_garage TO jobs_garages,
    job_shop TO jobs_shops;

3.16 Update - to do if your version is older than 3.16

Add the following code in jobs_creator/integrations/sv_integrations.lua and use the command in the server console or in game (there will be an output when you use the command)

RegisterCommand('updateShops', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="shop"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data and data.itemsOnSale) then
                    for itemName, itemData in pairs(data.itemsOnSale) do
                        if(type(itemData) == "number") then
                            data.itemsOnSale[itemName] = {
                                price = itemData
                            }
                            
                            anythingChanged = true
                        end
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

3.18 Update - to do if your version is older than 3.18

Add the following code in jobs_creator/integrations/sv_integrations.lua and use the command in the server console or in game (there will be an output when you use the command)

RegisterCommand('updateHarvest2', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemName or data.itemMinQuantity or data.itemMaxQuantity) then

                        data.harvestableItems = {
                            {
                                name = data.itemName,
                                minQuantity = data.itemMinQuantity,
                                maxQuantity = data.itemMaxQuantity,
                                time = data.itemTime,
                                chances = 100
                            }
                        }

                        data.itemMinQuantity = nil
                        data.itemMaxQuantity = nil
                        data.itemTime = nil
                        data.itemName = nil

                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

4.0 Update - to do if your version is older than 4.0

After running the server and the script is started, run this query in the database

UPDATE jobs_data SET grades_type="minimumGrade" WHERE grades_type IS NULL;

Add the following code in jobs_creator/integrations/sv_integrations.lua and use both commands in the server console or in game (there will be an output when you use the command)

RegisterCommand('updateHarvest3', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemTool and not data.itemToolLoseProbability) then
                        data.itemToolLoseProbability = 100
                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

RegisterCommand('updateMarkets', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="market"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data and data.items) then
                    for itemName, itemData in pairs(data.items) do
                        if(itemData.price) then
                            itemData.maxPrice = itemData.price
                            itemData.minPrice = itemData.price
                            itemData.price = nil

                            anythingChanged = true
                        end
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

8.0 Update - to do if your version is older than 8.0

Add the following code in jobs_creator/integrations/sv_integrations.lua, save and restart the script, and finally use the command in the server console

-- CONVERT FROM 7.11 to 8.0
RegisterCommand("upgrade_to_8", function(playerId)
    if(playerId ~= 0) then return end -- Only for server console

    local conversionCount = 0

    print("^3Converting to 8.0^7")

    local results = MySQL.Sync.fetchAll("SELECT * FROM jobs_data WHERE type='shop' OR type='market' OR type='harvest' OR type='process' OR type='crafting_table'")

    print("^3Automatically verifying " .. #results .. " markers^7")

    for i=1, #results do
        local currentMarker = results[i]
        local markerData = json.decode(currentMarker.data)
        local hasToUpdate = markerData and true or false

        if(currentMarker.type == "shop" and hasToUpdate) then
            local newItemsOnSale = {}
            markerData.itemsOnSale = markerData.itemsOnSale or {}

            if(#markerData.itemsOnSale == 0) then
                for itemName, content in pairs(markerData.itemsOnSale) do
                    local object = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.object = object

                    table.insert(newItemsOnSale, content)
                end

                markerData.itemsOnSale = newItemsOnSale
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end
        elseif(currentMarker.type == "market" and hasToUpdate) then
            local newItems = {}
            markerData.items = markerData.items or {}

            if(#markerData.items == 0) then
                for itemName, content in pairs(markerData.items) do
                    local object = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.object = object

                    table.insert(newItems, content)
                end

                markerData.items = newItems
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end

        elseif(currentMarker.type == "harvest" and hasToUpdate) then
            local newHarvestableItems = {}
            markerData.harvestableItems = markerData.harvestableItems or {}

            for i=1, #markerData.harvestableItems do
                local harvestableItem = markerData.harvestableItems[i]

                if(harvestableItem.name and hasToUpdate) then
                    local object = { label = harvestableItem.name, type = harvestableItem.name:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = harvestableItem.name }

                    harvestableItem.object = object
                    harvestableItem.name = nil
                    harvestableItem.itemTool = nil

                    table.insert(newHarvestableItems, harvestableItem)
                else
                    hasToUpdate = false
                end
            end

            if(hasToUpdate) then
                if(markerData.itemTool) then                    
                    local toolObject = { label = markerData.itemTool, type = markerData.itemTool:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemTool }
                    markerData.itemTool = toolObject
                end
                markerData.harvestableItems = newHarvestableItems
            end
        elseif(currentMarker.type == "process" and hasToUpdate) then
            if(markerData.itemToAddName) then
                local itemToAdd = { label = markerData.itemToAddName, type = markerData.itemToAddName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemToAddName }
                local itemToRemove = { label = markerData.itemToRemoveName, type = markerData.itemToRemoveName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemToRemoveName }

                markerData.itemToAddName = nil
                markerData.itemToRemoveName = nil

                markerData.itemToAdd = itemToAdd
                markerData.itemToRemove = itemToRemove
            else
                hasToUpdate = false 
            end
        elseif(currentMarker.type == "crafting_table" and hasToUpdate) then
            local newCraftablesItems = {}
            markerData.craftablesItems = markerData.craftablesItems or {}

            if(#markerData.craftablesItems == 0) then
                local foundAnything = false
                for itemName, content in pairs(markerData.craftablesItems) do
                    local resultObject = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.resultObject = resultObject

                    local newRecipes = {}
                    for ingredientName, ingredientContent in pairs(content.recipes) do
                        local ingredientObject = { label = ingredientName, type = ingredientName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = ingredientName }
                        ingredientContent.object = ingredientObject

                        table.insert(newRecipes, ingredientContent)
                    end

                    content.recipes = newRecipes

                    table.insert(newCraftablesItems, content)

                    foundAnything = true
                end

                if(foundAnything) then
                    markerData.craftablesItems = newCraftablesItems
                else
                    hasToUpdate = false
                end
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end 
        end

        if(hasToUpdate) then
            print("UPDATING MARKER ", currentMarker.id)
            currentMarker.data = json.encode(markerData)

            local affectedRows = MySQL.Sync.execute("UPDATE jobs_data SET data=@data WHERE id=@id", {
                ["@data"] = currentMarker.data,
                ["@id"] = currentMarker.id
            })
    
            if(affectedRows > 0) then
                conversionCount = conversionCount + 1
            end 
        end
    end

    if(conversionCount > 0) then
        print("^2Converted ^3" .. conversionCount .. "^2 markers successfully, restart the script!^7")
    else
        print("^3No markers to convert^7")
    end
end)
PreviousReplacing default events namesNextQBCore Jobs Injection

Last updated 5 months ago

Was this helpful?

💼