qbcore-framework / qb-core

FiveM RP Framework Core :muscle:
GNU General Public License v3.0
590 stars 960 forks source link

[BUG] qb-core/server/functions.lua:209: attempt to compare number with string #965

Closed JeiggerCreations closed 1 year ago

JeiggerCreations commented 1 year ago

Summary

after update to latest core, error on player join

Reproduction

-- Paychecks (standalone - don't touch) function PaycheckInterval() if next(QBCore.Players) then for _, Player in pairs(QBCore.Players) do if Player then local payment = QBShared.Jobs[Player.PlayerData.job.name]['grades'][tostring(Player.PlayerData.job.grade.level)].payment if not payment then payment = Player.PlayerData.job.payment end if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then if QBCore.Config.Money.PayCheckSociety then local account = exports['qb-management']:GetAccount(Player.PlayerData.job.name) if account ~= 0 then -- Checks if player is employed by a society if account < payment then -- Checks if company has enough money to pay society TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error') else Player.Functions.AddMoney('bank', payment) exports['qb-management']:RemoveMoney(Player.PlayerData.job.name, payment) TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment})) end else Player.Functions.AddMoney('bank', payment) TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment})) end else Player.Functions.AddMoney('bank', payment) TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment})) end end end end end SetTimeout(QBCore.Config.Money.PayCheckTimeOut (60 1000), PaycheckInterval) end

Expected behavior

no error for function PaycheckInterval and a functioning paycheck for players

Actual behavior

after error no paycheck function was non existent

Additional context

image

Last Updated

last week

Custom Resources

no

Resource Rename

no

JeiggerCreations commented 1 year ago

the line causing the error is this if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then

tom-osborne commented 1 year ago

What did you put for the offDutyPay for your job? Look in qb-core / shared / jobs.lua

JeiggerCreations commented 1 year ago

It’s happened with offdutypay set true, I wasn’t sure if that was the problem or not

GhzGarage commented 1 year ago

I'll test this and confirm, thanks

github-actions[bot] commented 1 year ago

This issue has had 60 days of inactivity & will close within 7 days