mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Code Correction
- Changed onduty for onDuty (CamelCode) - Event now uses bool instead of state arg. - Unemployed is now off-duty (doesn't change the paycheck).
This commit is contained in:
@@ -356,8 +356,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.setDuty(onDuty)
|
||||
self.job.onduty = onDuty
|
||||
function self.setDuty(bool)
|
||||
self.job.onDuty = bool
|
||||
self.triggerEvent('esx:setJob', self.job)
|
||||
end
|
||||
|
||||
@@ -376,7 +376,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.job.grade_name = gradeObject.name
|
||||
self.job.grade_label = gradeObject.label
|
||||
self.job.grade_salary = gradeObject.salary
|
||||
self.job.onduty = true
|
||||
self.job.onDuty = true
|
||||
|
||||
if gradeObject.skin_male then
|
||||
self.job.skin_male = json.decode(gradeObject.skin_male)
|
||||
|
||||
@@ -93,7 +93,7 @@ MySQL.ready(function()
|
||||
grade = 0,
|
||||
label = 'Unemployed',
|
||||
salary = 200,
|
||||
onduty = true,
|
||||
onDuty = false,
|
||||
skin_male = {},
|
||||
skin_female = {}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ function loadESXPlayer(identifier, playerId, isNew)
|
||||
userData.job.grade_name = gradeObject.name
|
||||
userData.job.grade_label = gradeObject.label
|
||||
userData.job.grade_salary = gradeObject.salary
|
||||
userData.job.onduty = true
|
||||
userData.job.onDuty = true
|
||||
|
||||
userData.job.skin_male = {}
|
||||
userData.job.skin_female = {}
|
||||
@@ -603,11 +603,11 @@ AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setDuty')
|
||||
AddEventHandler('esx:setDuty', function(state)
|
||||
AddEventHandler('esx:setDuty', function(bool)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
if xPlayer.job.onduty == state then return end
|
||||
if xPlayer.job.onDuty == bool then return end
|
||||
|
||||
if state then
|
||||
if bool then
|
||||
xPlayer.setDuty(false)
|
||||
xPlayer.triggerEvent('esx:showNotification', _U('stopped_duty'))
|
||||
else
|
||||
|
||||
@@ -5,14 +5,14 @@ function StartPayCheck()
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
for _, xPlayer in pairs(xPlayers) do
|
||||
local job = xPlayer.job.grade_name
|
||||
local onduty = xPlayer.job.onduty
|
||||
local onDuty = xPlayer.job.onDuty
|
||||
local salary = xPlayer.job.grade_salary
|
||||
|
||||
if salary > 0 then
|
||||
if job == 'unemployed' then -- unemployed
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary), 'CHAR_BANK_MAZE', 9)
|
||||
elseif Config.EnableSocietyPayouts and onduty then -- possibly a society
|
||||
elseif Config.EnableSocietyPayouts and onDuty then -- possibly a society
|
||||
TriggerEvent('esx_society:getSociety', xPlayer.job.name, function (society)
|
||||
if society ~= nil then -- verified society
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function (account)
|
||||
@@ -30,7 +30,7 @@ function StartPayCheck()
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
|
||||
end
|
||||
end)
|
||||
elseif onduty then -- generic job
|
||||
elseif onDuty then -- generic job
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user