QBOX Core
In qbx_core/server/functions.lua add following:
CreateThread(function()
local gangsData = MySQL.query.await('SELECT * FROM `uniq_mafia_gang_data`')
for i = 1, #gangsData do
local data = gangsData[i]
local value = json.decode(gangsData[i].grades)
local grades, grades2 = {}, {}
for grade, info in pairs(value) do
grades[tostring(grade)] = { info = info, grade = tonumber(grade) }
end
table.sort(grades, function (a, b)
return a.grade < b.grade
end)
for k,v in pairs(grades) do
grades2[v.grade] = v.info
end
QBX.Shared.Gangs[data.name] = {
label = data.label,
grades = grades2
}
end
end)
Last updated