๐งInstallation
Follow these steps to ensure the script works correctly
qb-core
Replace the function called
self.Functions.Setjobwith the following
function self.Functions.SetJob(job, grade, fromMJ)
local job = job:lower()
local grade = tostring(grade) or '0'
if QBCore.Shared.Jobs[job] ~= nil then
if not fromMJ and GetResourceState('origen_masterjob') == 'started' then
local BusN = exports["origen_masterjob"]:GetBusiness(self.PlayerData.job.name)
if BusN then
BusN.Functions.RemovePlayer(self.PlayerData.citizenid, true)
TriggerClientEvent("origen_masterjob:client:OnBusinessUpdate", self.PlayerData.source, false)
end
end
self.PlayerData.job.name = job
self.PlayerData.job.label = QBCore.Shared.Jobs[job].label
self.PlayerData.job.onduty = QBCore.Shared.Jobs[job].defaultDuty
if QBCore.Shared.Jobs[job].grades[grade] then
local jobgrade = QBCore.Shared.Jobs[job].grades[grade]
self.PlayerData.job.grade = {}
self.PlayerData.job.grade.name = jobgrade.name
self.PlayerData.job.grade.level = tonumber(grade)
self.PlayerData.job.payment = jobgrade.payment ~= nil and jobgrade.payment or 30
self.PlayerData.job.isboss = jobgrade.isboss ~= nil and jobgrade.isboss or false
else
return false
end
self.Functions.UpdatePlayerData()
TriggerClientEvent("QBCore:Client:OnJobUpdate", self.PlayerData.source, self.PlayerData.job)
return true
elseif GetResourceState('origen_masterjob') == 'started' then
local BusN = exports["origen_masterjob"]:GetBusiness(job)
if BusN then
local jobgrade = BusN.Functions.GetGrade(grade)
if not jobgrade then
return false
end
local oldBusN = exports["origen_masterjob"]:GetBusiness(self.PlayerData.job.name)
if oldBusN then
BusN.Functions.RemovePlayer(self.PlayerData.citizenid, true)
TriggerClientEvent("origen_masterjob:client:OnBusinessUpdate", self.PlayerData.source, false)
end
self.PlayerData.job.name = job
self.PlayerData.job.label = BusN.Data.label
self.PlayerData.job.onduty = false
self.PlayerData.job.grade = {}
self.PlayerData.job.grade.name = jobgrade.label or "Sin grado"
self.PlayerData.job.grade.level = tonumber(grade)
self.PlayerData.job.payment = jobgrade.pay or 30
self.PlayerData.job.isboss = jobgrade.boss or false
self.Functions.UpdatePlayerData()
TriggerClientEvent("QBCore:Client:OnJobUpdate", self.PlayerData.source, self.PlayerData.job)
if not fromMJ then
BusN.Functions.AddPlayer(self.PlayerData.citizenid, self.PlayerData.charinfo.firstname .. " " .. self.PlayerData.charinfo.lastname, tostring(grade), true)
end
return true
end
end
return false
endSet the value
QBShared.ForceJobDefaultDutyAtLoginto false
Add the following check in the function called
PaycheckInterval
Add the following item
pma-voice
Add the following code at the end of the file
Last updated