Buying cars with negative bank balance, [ESX] [esx_billing, esx_vehicleshop]


People on my server can buy cars even though they dont have money at all, it just makes their money balance negative there is no limit. For example some people can buy most expensive cars and make their balance go -1,250,000$. Does anyone know a fix for this so you cant buy cars unless you have money?

I am using esx_billing and esx_vehicleshop so basically all bills via esx_billing can go to negative balance.


Let me try to replicate the issue, and I’ll let you know what I come up with


So I just set my money to $0 and couldn’t purchase. Said I didn’t have enough money. You mention esx_billing. Do you use the playermanangenent for the vehicleshops?


Yes i do use playermanagement for vehicleshops


Does anyone know a fix for this?


I don’t use player management for the vehicle shop, but I’m assuming a player gets the invoice for the vehicle and has to pay the bill? If so, you may need to edit the esx_billing script to check if the player paying the bill has enough money. Similar to how it is done in the esx_vehicleshop script. I’ll mess around with it in a few hours when I wake up and see if I can help you out. Starting point can be for you to see how it’s done in the vehicle shop script and incorporate something similar into the billing script


Ok thanks ill wait for your response.

I looked into esx_billing and esx_vehicleshop and both of them according to these lines should pay bills only if players has enough money but i dont know whats wrong still:

(from esx_billing)
if xPlayer.get(‘money’) >= amount then

(from esx_vehicleshop)
if xPlayer.get(‘money’) >= vehicleData.price then


Looking at the script real quick, starting on line 385 and down, there isn’t anything about checking if the target player has enough money and it also triggers esx billing. In the billing script it may be an oversight where it just allows the player to pay the amount. But if a check is added in the script to prevent them from paying, it may fix it. I’ll check it out in a bit and get back to you.


Any news on that?
Having the same problem.

there is a general problem with esx_billing:

  • People can pay invoices/tickets/fines even they dont have enough money. so they will get negative money.
  • But if they respawn they will spawn with 0 money again (if its active, that they lose everything on death)

So this is quite abused, for example at cop tickets, or inbetween mafia members, or at a cardealer. People go there with 0 money, just buy whatever car they want. Respawn and they have a free car.

Anyone knows how to fix esx_billing, so it will NOT let you pay invoices if you have not enough money?
I mean i see, in the server.lua that it should be kind of there, but its not working


Yea guys, shit. This repo has seemed to fix the issue, i"ll try this once i’m home. The bug is with esx_billing and not the car dealer script - we need working checks in esx_billing:payBill - lets fix this!!


Ok everyone I’ve fixed the issue, use my repo over at which has this fix. Don’t forget to change the language in config.lua tho

Edit: there is no need to use my repo, just update the original version