Player money

hey my script uses the bossmenu to take money from threre when upgrading the car (is mechanic job)
i want to do the script that it will get the player money from cash that the player have and take the money from there but how do i get the current amount of player money?

> if exports['nv-bossmenu']:GetAccount("mechanic") >= price then
> 
>         TriggerEvent("nv-bossmenu:server:removeAccountMoney", "mechanic", price)
> 
>         TriggerClientEvent("nv-mechanic:purchaseSuccessful", src)
> 
>     else
> 
>         TriggerClientEvent("nv-mechanic:purchaseFailed", src)
> 
>     end
> 
> end)

If you want to get the current cash that a player has, you can use xPlayer.getMoney() assuming you’re using ESX ofcourse. This function will return the cash that the player has.

do you have soulotion to qbus?

Here you go, this should work with a bit of change.

local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.money.cash == price then
    Player.Functions.RemoveMoney("cash", price, "paid-mechanic")
else
    TriggerClientEvent("nv-mechanic:purchaseFailed", src)
end