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 ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="crafting_table"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idif(result.data) thenlocal data = json.decode(result.data)local newData = {}local anythingChanged =falseif(data.craftablesItems) thenfor itemName, craftingData inpairs(data.craftablesItems) doif(not craftingData.recipes) then anythingChanged =trueend newData[itemName] = { recipes = craftingData, animations = {} }endendlocal markerData = { craftablesItems = newData }if(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(markerData), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendendend)endend)
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 ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idlocal data = json.decode(result.data)local anythingChanged =falseif(data) thenif(data.itemQuantity) then data.itemMinQuantity = data.itemQuantity data.itemMaxQuantity = data.itemQuantity data.itemQuantity =nil anythingChanged =trueendendif(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(data), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendend)endend)
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 ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="shop"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idlocal data = json.decode(result.data)local anythingChanged =falseif(data and data.itemsOnSale) thenfor itemName, itemData inpairs(data.itemsOnSale) doif(type(itemData) =="number") then data.itemsOnSale[itemName] = { price = itemData } anythingChanged =trueendendendif(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(data), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendend)endend)
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 ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idlocal data = json.decode(result.data)local anythingChanged =falseif(data) thenif(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 =trueendendif(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(data), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendend)endend)
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 ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idlocal data = json.decode(result.data)local anythingChanged =falseif(data) thenif(data.itemTool andnot data.itemToolLoseProbability) then data.itemToolLoseProbability =100 anythingChanged =trueendendif(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(data), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendend)endend)RegisterCommand('updateMarkets', function(playerId)if(playerId ==0orisAllowed(playerId)) then MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="market"', {}, function(results)for k, result inpairs(results) dolocal markerId = result.idlocal data = json.decode(result.data)local anythingChanged =falseif(data and data.items) thenfor itemName, itemData inpairs(data.items) doif(itemData.price) then itemData.maxPrice = itemData.price itemData.minPrice = itemData.price itemData.price =nil anythingChanged =trueendendendif(anythingChanged) thenprint("Updating marker ID: " .. markerId) MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", { ['@newData'] = json.encode(data), ['@markerId'] = markerId })elseprint("Marker ID " .. markerId .." doesn't need to update")endendend)endend)