mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 18:01:25 +00:00
society update
This commit is contained in:
@@ -287,7 +287,8 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job,
|
||||
MySQL.update('UPDATE job_grades SET salary = ? WHERE job_name = ? AND grade = ?', {salary, job, grade},
|
||||
function(rowsChanged)
|
||||
Jobs[job].grades[tostring(grade)].salary = salary
|
||||
|
||||
ESX.RefreshJobs()
|
||||
Wait(1)
|
||||
local xPlayers = ESX.GetExtendedPlayers('job', job)
|
||||
for _, xTarget in pairs(xPlayers) do
|
||||
|
||||
@@ -295,7 +296,6 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job,
|
||||
xTarget.setJob(job, grade)
|
||||
end
|
||||
end
|
||||
|
||||
cb()
|
||||
end)
|
||||
else
|
||||
@@ -308,6 +308,31 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job,
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('esx_society:setJobLabel', function(source, cb, job, grade, label)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.job.name == job and xPlayer.job.grade_name == 'boss' then
|
||||
MySQL.update('UPDATE job_grades SET label = ? WHERE job_name = ? AND grade = ?', {label, job, grade},
|
||||
function(rowsChanged)
|
||||
Jobs[job].grades[tostring(grade)].label = label
|
||||
ESX.RefreshJobs()
|
||||
Wait(1)
|
||||
local xPlayers = ESX.GetExtendedPlayers('job', job)
|
||||
for _, xTarget in pairs(xPlayers) do
|
||||
|
||||
if xTarget.job.grade == grade then
|
||||
xTarget.setJob(job, grade)
|
||||
end
|
||||
end
|
||||
cb()
|
||||
end)
|
||||
else
|
||||
print(('esx_society: %s attempted to setJobSalary'):format(xPlayer.identifier))
|
||||
cb()
|
||||
end
|
||||
end)
|
||||
|
||||
local getOnlinePlayers, onlinePlayers = false, {}
|
||||
ESX.RegisterServerCallback('esx_society:getOnlinePlayers', function(source, cb)
|
||||
if getOnlinePlayers == false and next(onlinePlayers) == nil then -- Prevent multiple xPlayer loops from running in quick succession
|
||||
|
||||
Reference in New Issue
Block a user