esx paycheck notification system.

hi, so i want the notification system to work with my ox lib notify but its not working.

what is wrong with my code ? (i got no error, still getting paid but no notification via ox lib)
(yes i put 2 notification because i want to see if its working or not and my k5 is workingg fine but i dont like it)

function StartPayCheck()
CreateThread(function()
while true do
Wait(Config.PaycheckInterval)
local xPlayers = ESX.GetExtendedPlayers()
for _, xPlayer in pairs(xPlayers) do
local job = xPlayer.job.grade_name
local salary = xPlayer.job.grade_salary

            if salary > 0 then
                if job == 'unemployed' then -- unemployed
                    xPlayer.addAccountMoney('bank', salary)
                    TriggerClientEvent("k5_notify:notify", xPlayer.source, 'Banque', 'Vous Avez Reçu Une Paye !', 'success', 10000)
                    TriggerClientEvent('ox_lib:notify', xPlayer.source, { type = 'success', text = 'Vous Avez Reçu Une Paye !', duration = 10000 })
                elseif Config.EnableSocietyPayouts then -- possibly a society
                    TriggerEvent('esx_society:getSociety', xPlayer.job.name, function(society)
                        if society ~= nil then -- verified society
                            TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
                                if account.money >= salary then -- does the society have enough money to pay its employees?
                                    xPlayer.addAccountMoney('bank', salary)
                                    account.removeMoney(salary)
                                    TriggerClientEvent("k5_notify:notify", xPlayer.source, 'Banque', 'Vous Avez Reçu Une Paye !', 'success', 10000)
                                    TriggerClientEvent('ox_lib:notify', xPlayer.source, { type = 'success', text = 'Vous Avez Reçu Une Paye !', duration = 10000 })
                                else
                                    TriggerClientEvent("k5_notify:notify", xPlayer.source, 'Banque', 'Vous Avez Reçu Une Paye !', 'success', 10000)
                                    TriggerClientEvent('ox_lib:notify', xPlayer.source, { type = 'success', text = 'Vous Avez Reçu Une Paye !', duration = 10000 })
                                end
                            end)
                        else -- not a society
                            xPlayer.addAccountMoney('bank', salary)
                            TriggerClientEvent("k5_notify:notify", xPlayer.source, 'Banque', 'Vous Avez Reçu Une Paye !', 'success', 10000)
                            TriggerClientEvent('ox_lib:notify', xPlayer.source, { type = 'success', text = 'Vous Avez Reçu Une Paye !', duration = 10000 })
                        end
                    end)
                else -- generic job
                    xPlayer.addAccountMoney('bank', salary)
                    TriggerClientEvent("k5_notify:notify", xPlayer.source, 'Banque', 'Vous Avez Reçu Une Paye !', 'success', 10000)
                    TriggerClientEvent('ox_lib:notify', xPlayer.source, { type = 'success', text = 'Vous Avez Reçu Une Paye !', duration = 10000 })
                end
            end
        end
    end
end)

end

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.