Skip to content

Commit

Permalink
fix: revert commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm committed Nov 11, 2024
1 parent e1c8a8d commit 19c6925
Showing 1 changed file with 15 additions and 32 deletions.
47 changes: 15 additions & 32 deletions server/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -903,37 +903,24 @@ function CreatePlayer(playerData, Offline)

AddEventHandler('qbx_core:server:onJobUpdate', function(jobName, job)
if self.PlayerData.job.name ~= jobName then return end

if not job then
self.PlayerData.job = {
name = 'unemployed',
label = 'Civilian',
self.Functions.setJob('unemployed', 0)
return
end
self.PlayerData.job.label = job.label
self.PlayerData.job.type = job.type or 'none'
local jobGrade = job.grades[self.PlayerData.job.grade.level]
if jobGrade then
self.PlayerData.job.grade.name = jobGrade.name
self.PlayerData.job.payment = jobGrade.payment or 30
self.PlayerData.job.isboss = jobGrade.isboss or false
else
self.PlayerData.job.grade = {
name = 'No Grades',
level = 0,
payment = 30,
isboss = false,
onduty = true,
payment = 10,
grade = {
name = 'Freelancer',
level = 0,
}
}
else
self.PlayerData.job.label = job.label
self.PlayerData.job.type = job.type or 'none'

local jobGrade = job.grades[self.PlayerData.job.grade.level]

if jobGrade then
self.PlayerData.job.grade.name = jobGrade.name
self.PlayerData.job.payment = jobGrade.payment or 30
self.PlayerData.job.isboss = jobGrade.isboss or false
else
self.PlayerData.job.grade = {
name = 'No Grades',
level = 0,
payment = 30,
isboss = false,
}
end
end

if not self.Offline then
Expand All @@ -945,7 +932,6 @@ function CreatePlayer(playerData, Offline)

AddEventHandler('qbx_core:server:onGangUpdate', function(gangName, gang)
if self.PlayerData.gang.name ~= gangName then return end

if not gang then
self.PlayerData.gang = {
name = 'none',
Expand All @@ -958,9 +944,7 @@ function CreatePlayer(playerData, Offline)
}
else
self.PlayerData.gang.label = gang.label

local gangGrade = gang.grades[self.PlayerData.gang.grade.level]

if gangGrade then
self.PlayerData.gang.isboss = gangGrade.isboss or false
else
Expand All @@ -971,7 +955,6 @@ function CreatePlayer(playerData, Offline)
self.PlayerData.gang.isboss = false
end
end

if not self.Offline then
UpdatePlayerData(self.PlayerData.source)
TriggerEvent('QBCore:Server:OnGangUpdate', self.PlayerData.source, self.PlayerData.gang)
Expand Down

0 comments on commit 19c6925

Please sign in to comment.