Trying to figure out my players aren't getting thier paychecks every 10 mins. There are no errors anywhere about it.
This is my code from qb-core/server/functions.
nothing looks wrong.
1 messages · Page 1 of 1 (latest)
Trying to figure out my players aren't getting thier paychecks every 10 mins. There are no errors anywhere about it.
This is my code from qb-core/server/functions.
nothing looks wrong.
I use qb-banking.
Is this also on a fresh build?
Yes.
Did you change in the qb-core config where workers are paid from their society accounts?
Strange on a fresh build your not getting payment, restart qb-core and see if anything generates for an error but something must of changed to happen to cause this but lets see what we can find out
Only error looks like its this....
but don't think thats paycheck wise
So oddd.
Did you make any major changes
I didn't. Nothing I remember with paychecks. Im gonna try and debug it. Might have to do another install
Did you put money in the job accounts?
Try it
Do you think a hud would cause the issue as well?
Qb hud? No
I use mHud
I use mHud and it works fine, check if you’re on duty when you log in, the paycheck don’t work if you’re not on duty
Its doing it for everyone. Even the people without a job. 😭
That’s weird, try off duty pay true and see if that works.
Im not gonna lie tho, this paycheck system is not reliable if you have a lot of players
Haha. I shall. Anyone have any recommendations haha
Personally I made my own cause of haven’t seen any on the market but it works with discord roles not jobs
Gotcha
by default if no one has a job they would be a civ/freelancer and get 10 bucks regardless
I tried a fresh build. No extra scripts and still no paychecks lol. Just thought I'd share lol
strange, put in a issue ticket in the github
still have this issues ?
i think the problem is checking payment data
if we change our job the fucntion not working
You've removed a job from the shared jobs that someone still has.
Add it back in, or clear it from their player data in the database.
You could find this job by adding debug prints into the paycheckInterval function.
function PaycheckInterval()
if next(QBCore.Players) then
for _, Player in pairs(QBCore.Players) do
if Player then
-- Find the fucker with the broken job
print("Checking job for player: " .. Player.PlayerData.name .. " (Server ID: " .. Player.PlayerData.source .. ")")
print("Job: " .. Player.PlayerData.job.name .. " Job Details: " .. json.encode(Player.PlayerData.job))
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
print("Processing paycheck for player: " .. Player.PlayerData.source)
print("Job: " .. Player.PlayerData.job.name .. ", Grade: " .. Player.PlayerData.job.grade.level .. ", On Duty: " .. tostring(Player.PlayerData.job.onduty))
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
print("Company too poor to pay player: " .. Player.PlayerData.source)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
else
print("Paying player: " .. Player.PlayerData.source .. ", Amount: " .. payment)
Player.Functions.AddMoney('bank', payment, 'paycheck')
exports['qb-management']:RemoveMoney(Player.PlayerData.job.name, payment, 'Employee Paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
else
print("Paying player: " .. Player.PlayerData.source .. ", Amount: " .. payment)
Player.Functions.AddMoney('bank', payment, 'paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
else
print("Paying player: " .. Player.PlayerData.source .. ", Amount: " .. payment)
Player.Functions.AddMoney('bank', payment, 'paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
else
print("Player: " .. Player.PlayerData.source .. " is not being paid. Payment: " .. payment .. ", On Duty: " .. tostring(Player.PlayerData.job.onduty))
end
end
end
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end
Nah, ijust change my job
i mean first time server up and first joining server paycheck is working perfectly. but after change the job the paycheck didnt work and showing this error :
My reply was for the topic of the post, not your specific issue. It looks like you've configured the payment incorrectly.
mad caps are u still free to help so i have the same problem and i did everything u just said do for every player emptied the job data and i still have no checks coming in
and i get no errors
did u fix it
Did you use my print snippet? If so what do you see getting printed?
your snippet fixed it fr goat
It won't have fixed it on its own, it just adds prints to help you troubleshoot.
well then maybe i need to restart the server for the job data to reset id either way what u said fixed it so thanks
Anyone else’s paycheck not changing from one hour?
i do every 30 minutes
it works
mine isnt
I fixed it
Sorry I was washing dishes
@rancid oarsorry for the pings, i just cop that to replace this?
function PaycheckInterval()
if not next(QBCore.Players) then return end
for _, Player in pairs(QBCore.Players) do
if not Player then return end
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-banking']:GetAccountBalance(Player.PlayerData.job.name)
if account ~= 0 then
if account < payment then
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
else
Player.Functions.AddMoney('bank', payment, 'paycheck')
exports['qb-banking']:RemoveMoney(Player.PlayerData.job.name, payment, 'Employee Paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
else
Player.Functions.AddMoney('bank', payment, 'paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
else
Player.Functions.AddMoney('bank', payment, 'paycheck')
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
end
end
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end
Yes, all it's doing is adding prints so you can deduce where the issue is. Most likely it's someone that has a job that no longer exists in the shared jobs.
i just started the server
last server i spun up also had the same issue but i scrapped it to move to a dedicated machine
all very odd i guess no one gets paid lol ¯_(ツ)_/¯
do what mad caps said it will work
del the job cat in the players table of the db , then added it back fixed my problem , it was indeed one of the players with job that was not there anymore
this part?
if i delete it, whats the right way to add it back? or will it just repopulate itself?
also, where did you change it to be every 30 min?
you will have to reassign whitelisted job and city jobs they can just go get back at cityhall
@sly meadow
remove this table
add it back
just like this
line 12 is how u change how often
@gaunt epochdo you mind if i dm you on this?
better to ask here just in case others have the same question i can answer to all
just try to ask i should be able to help
ah, it was a bit more hand holding which was why but i dont mind everyone knowing how shit i am lol
so basically i just delete that by clicking on it and hitting remove
then to put it back, i just hit add then type in Job and call it a day?
thats what i got now
yes del the job column
wtf, thats a row not a column! i just learned excel 🤣
ok
its gone
then just hit add and under name type in job
in collation set to uft8
remove the tick and change to no default?
yes
"utf8mb4_general_ci"
yes
do this and set it to 5 to test
then if that fixes it set it to the desired amount of time to give the check
what is the correct job name for shit? like for police
i have just been doing /setjob police # 1-4
that's right
police = {
label = 'Law Enforcement',
type = 'leo',
defaultDuty = true,
offDutyPay = false,
no problem man lmk if that works
i will, i have a guy who i will have test it right now since.... i may or may not be at work.....and i may or may not be working....
lol
hmm, so far it seems like it just takes longer to get server permissions and it didnt load the multi character right the first time
hmm
im trying another server reboot
but i cant select my character
it shows him
Make your own post, you're cluttering up one that is useful to people who have the paycheck issue.
ok, i mean i still have the paycheck issue but i can make a new post
Has nothing to do with paychecks
i'm also having same issue no one is getting paid while being on duty .
i fixed it
how did you fix it ?
I am having the same issue. I have followed the directions in the forum with removing the job line from the data base and adding it back in and adding the paycheckinterval function. I changed the interval time to 2 minutes so I can see if its working and nothing. I am not using the society accounts so money being in business accounts isn't preventing it.
Also. Since following the steps to clear the job line in the database, when I fly in, I can't actually select my character to fly in. I have to select an empty slot then click my character but it still doesn't show my character information.
#1336798745983189012 message
How did you fix it?
just update ur qbcore