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

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)

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

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)

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)

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

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)

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

Last updated

Was this helpful?