Open BigSmashGG opened 6 months ago
running qb management version 2.0.0
i installed the updated multijob today and noticed when i fire someone that they are losing all of their jobs, not just the job i fire them from. i tested this with a user that was offline, and then with the same user while they were online. i fired them, the jobs were all removed. i put them back via the db table backup i had. fired them again while they were online. same problem.
i added the export to the qb mgmt file per the instructions.
when i would fire someone, this would print in the server console: https://cdn.discordapp.com/attachments/900180032935325707/1224445623101685760/image.png?ex=661d84d9&is=660b0fd9&hm=b482649e7c8ece61311fd37125eb77ed004559e93c1323cffe93126a2c4fbf15&
for the time being i commented out the export to put in the qb mgmt files.
I know this is 4.5 months later, but you can change sv_boss.lua in qb-management to use the RemoveJob
export
-- Fire Employee
RegisterNetEvent('qb-bossmenu:server:FireEmployee', function(target)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local Employee = QBCore.Functions.GetPlayerByCitizenId(target)
if not Player.PlayerData.job.isboss then
ExploitBan(src, 'FireEmployee Exploiting')
return
end
if Employee then
if target ~= Player.PlayerData.citizenid then
if Employee.PlayerData.job.grade.level > Player.PlayerData.job.grade.level then
TriggerClientEvent('QBCore:Notify', src, 'You cannot fire this citizen!', 'error')
return
end
if Employee.Functions.SetJob('unemployed', '0') then
TriggerEvent('qb-log:server:CreateLog', 'bossmenu', 'Job Fire', 'red', Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' successfully fired ' .. Employee.PlayerData.charinfo.firstname .. ' ' .. Employee.PlayerData.charinfo.lastname .. ' (' .. Player.PlayerData.job.name .. ')', false)
TriggerClientEvent('QBCore:Notify', src, 'Employee fired!', 'success')
--TriggerEvent('ps-multijob:server:removeJob', target)
exports['ps-multijob']:RemoveJob(target, Player.PlayerData.job.name)
TriggerClientEvent('QBCore:Notify', Employee.PlayerData.source, 'You have been fired! Good luck.', 'error')
else
TriggerClientEvent('QBCore:Notify', src, 'Error..', 'error')
end
else
TriggerClientEvent('QBCore:Notify', src, 'You can\'t fire yourself', 'error')
end
else
local player = MySQL.query.await('SELECT * FROM players WHERE citizenid = ? LIMIT 1', { target })
if player[1] ~= nil then
Employee = player[1]
Employee.job = json.decode(Employee.job)
if Employee.job.grade.level > Player.PlayerData.job.grade.level then
TriggerClientEvent('QBCore:Notify', src, 'You cannot fire this citizen!', 'error')
return
end
local job = {}
local firstname = string.match(player[1].charinfo, "\"firstname\"%s*:%s*\"(.-)\"") --we use pattern matching and regular expressions to get their first name
local lastname = string.match(player[1].charinfo, "\"lastname\"%s*:%s*\"(.-)\"") --and last name
job.name = 'unemployed'
job.label = 'Unemployed'
job.payment = QBCore.Shared.Jobs[job.name].grades['0'].payment or 500
job.onduty = true
job.isboss = false
job.grade = {}
job.grade.name = nil
job.grade.level = 0
MySQL.update('UPDATE players SET job = ? WHERE citizenid = ?', { json.encode(job), target })
TriggerClientEvent('QBCore:Notify', src, 'Employee fired!', 'success')
exports['ps-multijob']:RemoveJob(target, Player.PlayerData.job.name)
--TriggerEvent('ps-multijob:server:removeJob', target)
TriggerEvent('qb-log:server:CreateLog', 'bossmenu', 'Job Fire', 'red', Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' successfully fired ' .. firstname .. ' ' .. lastname .. ' (' .. Player.PlayerData.job.name .. ')', false)
else
TriggerClientEvent('QBCore:Notify', src, 'Civilian not in city.', 'error')
end
end
--TriggerClientEvent('qb-bossmenu:client:OpenMenu', src)
end)```
running qb management version 2.0.0
i installed the updated multijob today and noticed when i fire someone that they are losing all of their jobs, not just the job i fire them from. i tested this with a user that was offline, and then with the same user while they were online. i fired them, the jobs were all removed. i put them back via the db table backup i had. fired them again while they were online. same problem.
i added the export to the qb mgmt file per the instructions.
when i would fire someone, this would print in the server console: https://cdn.discordapp.com/attachments/900180032935325707/1224445623101685760/image.png?ex=661d84d9&is=660b0fd9&hm=b482649e7c8ece61311fd37125eb77ed004559e93c1323cffe93126a2c4fbf15&
for the time being i commented out the export to put in the qb mgmt files.