Updating script from old versions
3.5 Update - to do if your version is older than 3.5
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
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
Last updated