diff --git a/README.md b/README.md index 258d20ed..983abdd2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # esx_society + Society management for ESX. Adds employee management (hire, fire, promote / demote, change salary), society bank accounts and money washing. It's crucial that this script gets started before all resources that utilize societies do, or else many things will go wrong. ## Requirements @@ -52,7 +53,7 @@ end, {wash = false}) -- set custom options, e.g disable washing ### License esx_society - societies for ESX -Copyright (C) 2015-2018 Jérémie N'gadi +Copyright (C) 2015-2020 Jérémie N'gadi This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/server/main.lua b/server/main.lua index 4cb443e4..9960b071 100644 --- a/server/main.lua +++ b/server/main.lua @@ -272,10 +272,9 @@ ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier end) ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job, grade, salary) - local isBoss = isPlayerBoss(source, job) - local identifier = GetPlayerIdentifier(source, 0) + local xPlayer = ESX.GetPlayerFromId(source) - if isBoss then + if xPlayer.job.name == job and xPlayer.job.grade_name == 'boss' then if salary <= Config.MaxSalary then MySQL.Async.execute('UPDATE job_grades SET salary = @salary WHERE job_name = @job_name AND grade = @grade', { ['@salary'] = salary, @@ -286,21 +285,21 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job, local xPlayers = ESX.GetPlayers() for i=1, #xPlayers, 1 do - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + local xTarget = ESX.GetPlayerFromId(xPlayers[i]) - if xPlayer.job.name == job and xPlayer.job.grade == grade then - xPlayer.setJob(job, grade) + if xTarget.job.name == job and xTarget.job.grade == grade then + xTarget.setJob(job, grade) end end cb() end) else - print(('esx_society: %s attempted to setJobSalary over config limit!'):format(identifier)) + print(('esx_society: %s attempted to setJobSalary over config limit!'):format(xPlayer.identifier)) cb() end else - print(('esx_society: %s attempted to setJobSalary'):format(identifier)) + print(('esx_society: %s attempted to setJobSalary'):format(xPlayer.identifier)) cb() end end)