Skip to content

Commit

Permalink
Merge pull request #785 from bitpredator/dev
Browse files Browse the repository at this point in the history
fix:  invoices were not sent and recorded
  • Loading branch information
bitpredator authored Aug 11, 2024
2 parents 8bb83dd + 997a90e commit c9d870a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local function billPlayerByIdentifier(targetIdentifier, senderIdentifier, shared
end

if string.match(sharedAccountName, "society_") then
return TriggerEvent("esx_addonaccount:getSharedAccount", sharedAccountName, function(account)
return TriggerEvent("bpt_addonaccount:getSharedAccount", sharedAccountName, function(account)
if not account then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(senderIdentifier, sharedAccountName))
end
Expand Down Expand Up @@ -53,7 +53,7 @@ RegisterNetEvent("bpt_billing:sendBill", function(targetId, sharedAccountName, l
end)
exports("BillPlayer", billPlayer)

RegisterNetEvent("bpt_billing_billing:sendBillToIdentifier", function(targetIdentifier, sharedAccountName, label, amount)
RegisterNetEvent("bpt_billing:sendBillToIdentifier", function(targetIdentifier, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local jobName = string.gsub(sharedAccountName, "society_", "")

Expand Down Expand Up @@ -125,7 +125,7 @@ ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId)
return cb(true)
end

TriggerEvent("esx_addonaccount:getSharedAccount", result.target, function(account)
TriggerEvent("bpt_addonaccount:getSharedAccount", result.target, function(account)
local paymentAccount = "money"
if xPlayer.getMoney() < amount then
paymentAccount = "bank"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AddEventHandler("bpt_taxijob:getStockItem", function(itemName, count)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.job.name == "taxi" then
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
local item = inventory.getItem(itemName)

-- is there enough in the society?
Expand All @@ -91,7 +91,7 @@ AddEventHandler("bpt_taxijob:getStockItem", function(itemName, count)
end)

ESX.RegisterServerCallback("bpt_taxijob:getStockItems", function(source, cb)
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
cb(inventory.items)
end)
end)
Expand All @@ -102,7 +102,7 @@ AddEventHandler("bpt_taxijob:putStockItems", function(itemName, count)
local sourceItem = xPlayer.getInventoryItem(itemName)

if xPlayer.job.name == "taxi" then
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
local item = inventory.getItem(itemName)

if sourceItem.count >= count and count > 0 then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function StartPayCheck()
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)
TriggerEvent("bpt_addonaccount:getSharedAccount", society.account, function(account)
if account.money >= salary then -- does the society money to pay its employees?
xPlayer.addAccountMoney("bank", salary, "Paycheck")
account.removeMoney(salary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ESX.RegisterServerCallback("esx_property:attemptSellToPlayer", function(source,
if PM.Enabled then
local PlayerPrice = Price * PM.SalePercentage
local SocietyPrice = Price - PlayerPrice
TriggerEvent('esx_addonaccount:getSharedAccount', PM.society, function(account)
TriggerEvent('bpt_addonaccount:getSharedAccount', PM.society, function(account)
account.addMoney(SocietyPrice)
end)
xPlayer.addAccountMoney("bank", PlayerPrice, "Sold Property")
Expand Down

0 comments on commit c9d870a

Please sign in to comment.