#Paychecks.

1 messages · Page 1 of 1 (latest)

round rapids
#

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.

https://reee.me/2y8413

#

I use qb-banking.

round rapids
small reef
#

Is this also on a fresh build?

round rapids
small reef
#

Did you change in the qb-core config where workers are paid from their society accounts?

small reef
#

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

round rapids
#

but don't think thats paycheck wise

#

So oddd.

small reef
#

Did you make any major changes

round rapids
small reef
#

Did you put money in the job accounts?

round rapids
#

I guess I could add money into them and see if society works.

small reef
#

Try it

round rapids
small reef
#

Qb hud? No

round rapids
#

I use mHud

tight dock
#

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

round rapids
#

Its doing it for everyone. Even the people without a job. 😭

tight dock
#

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

round rapids
#

Haha. I shall. Anyone have any recommendations haha

tight dock
#

Personally I made my own cause of haven’t seen any on the market but it works with discord roles not jobs

round rapids
#

Gotcha

small reef
#

by default if no one has a job they would be a civ/freelancer and get 10 bucks regardless

round rapids
small reef
#

strange, put in a issue ticket in the github

daring vault
#

still have this issues ?

#

i think the problem is checking payment data

#

if we change our job the fucntion not working

rancid oar
#

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.

rancid oar
#

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
daring vault
#

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 :

rancid oar
#

My reply was for the topic of the post, not your specific issue. It looks like you've configured the payment incorrectly.

gaunt epoch
#

and i get no errors

gaunt epoch
rancid oar
gaunt epoch
rancid oar
#

It won't have fixed it on its own, it just adds prints to help you troubleshoot.

gaunt epoch
#

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

uncut trench
#

Anyone else’s paycheck not changing from one hour?

daring vault
#

just update ur qbcore

#

i fix with thhe lastest qbcore

gaunt epoch
#

it works

uncut trench
heady wing
#

I fixed it

heady wing
sly meadow
#

@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
rancid oar
#

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.

sly meadow
#

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

sly meadow
#

all very odd i guess no one gets paid lol ¯_(ツ)_/¯

gaunt epoch
#

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

sly meadow
#

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?

gaunt epoch
#

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

sly meadow
#

@gaunt epochdo you mind if i dm you on this?

gaunt epoch
#

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

sly meadow
#

ah, it was a bit more hand holding which was why but i dont mind everyone knowing how shit i am lol

sly meadow
# gaunt epoch

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

gaunt epoch
#

yes del the job column

sly meadow
#

row or column

#

like row 8

gaunt epoch
#

row 8 yes

#

right click remove column

sly meadow
#

wtf, thats a row not a column! i just learned excel 🤣

#

ok

#

its gone

#

then just hit add and under name type in job

gaunt epoch
#

in collation set to uft8

sly meadow
#

remove the tick and change to no default?

gaunt epoch
#

yes

sly meadow
gaunt epoch
#

yes

sly meadow
#

k

#

then save it and reboot?

gaunt epoch
#

then if that fixes it set it to the desired amount of time to give the check

sly meadow
#

what is the correct job name for shit? like for police

#

i have just been doing /setjob police # 1-4

gaunt epoch
#

that's right

#

police = {
label = 'Law Enforcement',
type = 'leo',
defaultDuty = true,
offDutyPay = false,

sly meadow
#

interesting.....very interesting

#

thank you for holding my hand, it was glorious

gaunt epoch
#

no problem man lmk if that works

sly meadow
#

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

sly meadow
#

hmm

#

im trying another server reboot

#

but i cant select my character

#

it shows him

rancid oar
#

Make your own post, you're cluttering up one that is useful to people who have the paycheck issue.

sly meadow
#

ok, i mean i still have the paycheck issue but i can make a new post

gaunt epoch
wheat stump
#

im also having the same issue fresh install of qbcore

#

paycheks are not working

proven granite
proven granite
severe oracle
#

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.

severe oracle
#

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.

severe oracle
rancid oar
round rapids
daring vault