[ESX - ENG/DE] myBills - Billing with Partial Payment, Bill Requests and Discord Webhooks

I‘ve answered your DM. There I‘ll send you instructions.

1 Like

Hey dude ! I want to add a notification to the sender when a bill of society (source) was paied.

Actually, i just have the “accept” notification but no the “pay” notification

myBilling - Update - 08.01.2021

  • Added notification for the player, who gave a society bill (f.e. police officer gets a notification when somebody paid his fine)

myBills - Update - 18.01.2021

  • Complete rewrite of the PayBill-Functions, to make it work with the new ESX versions and also to make it possible to use bank payment instead of cash. You can set this up in Config.lua
  • You can now trigger the Client event TriggerEvent(‘myBills:openMenu’) to open the Billing menu from another script.
  • If you use ESXv.1.2 or ESX v.1final, you have to set Config.useNewESX to true

myBills - Update - 26.01.2021 - Added the esx:getBills event to the script, to improve the compatibility with other scripts. - Added a Config option to disable the key usage -> When you only want to open the billing menu from another script.

There was an optional upgrade released for myBilling!
You’ll find further information here: EnhancedUI for myBilling - Releases - Cfx.re Community

What MS does this script run at?

Hey,
when the menu isn’t open the script shouldn’t take any performance. I guess about 0.02-0.03ms is realistic. Anyways Iam pretty sure it will use less ms than esx_billing :wink:

So I just have to turn off esx_billling and edit all scripts that use esx_billing trigger?

No, you don’t have to edit the scripts, which use esx_billing trigger. The esx events are included in myBilling so you can migrate this without changes needed.
But in some scripts esx_billing is listed as a dependency in the fxmanifest.lua or __ressource.lua. Then you have to remove it from this.

I now got a problem I send someone a bill but after he throws it in the trash he cant move anymore…

Then I guess the ressource name isn’t myBilling anymore.

I made it to myBilling or do I have to make it to myBills?

myBilling is fine. But it have to be myBilling and not myBillingUI.
I’ve also sent you instructions via DM to make further support easier :wink:

Best regards,
Luis

i am having a problem when someone sends an invoice and the other one is paying for it only the one who paid for it gets the notification not the one who sent it
here is my client code

if Config.useAccountMoney then
            xPlayer.removeAccountMoney(Config.Account, amount)
        else
            xPlayer.removeMoney(amount)
        end
        TriggerClientEvent('myBills:msg', xPlayer.source, Translation[Config.Locale]['bill_paid'] .. amount .. Translation[Config.Locale]['bill_paid2'])
        TriggerClientEvent('myBills:refreshMenu', source)

        if target_type == 'society' then
            TriggerEvent('esx_addonaccount:getSharedAccount', target, function(account)
                account.addMoney(amount)
            end)
			local xPlayers    = ESX.GetPlayers()
			for k, v in pairs(xPlayers) do

                local xPlayer2 = ESX.GetPlayerFromId(xPlayers[k])
				if xPlayer2.identifier == sender then
					TriggerClientEvent('myBills:msg', xPlayer2.source, Translation[Config.Locale]['society_bill_paid'] .. amount .. Translation[Config.Locale]['society_bill_paid2'])
					break
				end
                
			end
        else -- target type = player
            local xPlayers    = ESX.GetPlayers()

            for k, v in pairs(xPlayers) do

                local xPlayer2 = ESX.GetPlayerFromId(xPlayers[k])

                if xPlayer2.identifier == target then    
                    -- Player online
                    if Config.useAccountMoney then
                        xPlayer2.addAccountMoney(Config.Account, amount)
                    else
                        xPlayer2.addMoney(amount)
                    end
                    TriggerClientEvent('myBills:msg', xPlayer2.source, Translation[Config.Locale]['society_bill_paid'] .. amount .. Translation[Config.Locale]['society_bill_paid2'])

                elseif k == #xPlayers then
                    -- Player not online
                    if Config.useNewESX then
                        MySQL.Async.fetchAll('SELECT accounts from users WHERE identifier = @identifier', {
                            ['@identifier'] = target
                        },
                        function(result)
                            if #result > 0 then
                                local accountsData = json.decode(result[1].accounts)
                                accountsData.money = accountsData.money + amount
                                local newAccountsData = json.encode(accountsData)
                                MySQL.Async.execute('UPDATE users SET accounts=@accounts WHERE identifier=@identifier',
                                {
                                    ['@accounts'] = newAccountsData,
                                    ['@identifier'] = target
                                })
                               
                            end
    
                        end)
                    else
                        MySQL.Async.fetchAll('SELECT money from users WHERE identifier = @identifier', {
                            ['@identifier'] = target
                        },
                        function(result)
                            if #result > 0 then
    
                                MySQL.Async.execute('UPDATE users SET money=@money WHERE identifier=@identifier',
                                {
                                    ['@money'] = result[1].money + amount,
                                    ['@identifier'] = target
                                })
                               
                            end
    
                        end)
                    end
                end

            end
        end

    else
        TriggerClientEvent('myBills:msg', source, Translation[Config.Locale]['not_enough_money'])
    end

end)

Looks like a pretty old version.
I’ll send you instructions on how to update it!

Hey man, I bought the script lately but couldn’t figure out how to change the position of the menu. Any tips?

Hey,
There is a NativeUI.CreateMenu(name, desc, x, y) in client.lua and you have to insert values for x and y.

Best regards,
Luis

how can i make the esx_speedcamera script only accept and not accept and reject?


and for now, that’s all I have to solve

You can use the event: esx_billing:sendBillDirect for this