Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server/player): setting default duty after job exists #453

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions server/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,7 @@ function CheckPlayerData(source, playerData)
local job = GetJob(playerData.job?.name) or GetJob('unemployed')
assert(job ~= nil, 'Unemployed job not found. Does it exist in shared/jobs.lua?')
local jobGrade = GetJob(playerData.job?.name) and playerData.job.grade.level or 0
if QBX.Shared.ForceJobDefaultDutyAtLogin and (job.defaultDuty ~= nil) then
playerData.job.onduty = job.defaultDuty
end

playerData.job = {
name = playerData.job?.name or 'unemployed',
label = job.label,
Expand All @@ -376,6 +374,10 @@ function CheckPlayerData(source, playerData)
level = jobGrade,
}
}
if QBX.Shared.ForceJobDefaultDutyAtLogin and (job.defaultDuty ~= nil) then
playerData.job.onduty = job.defaultDuty
end

playerData.jobs = jobs or {}
local gang = GetGang(playerData.gang?.name) or GetGang('none')
assert(gang ~= nil, 'none gang not found. Does it exist in shared/gangs.lua?')
Expand Down