RegisterNetEvent('esx_billing:sendBill', function(playerId, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local xTarget = ESX.GetPlayerFromId(playerId)
amount = ESX.Math.Round(amount)
if amount > 0 and xTarget then
if string.match(sharedAccountName, "society_") then
local jobName = string.gsub(sharedAccountName, 'society_', '')
if xPlayer.job.name ~= jobName then
print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
return
end
TriggerEvent('esx_addonaccount:getSharedAccount', sharedAccountName, function(account)
if account then
MySQL.insert('INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)', {xTarget.identifier, xPlayer.identifier, 'society', sharedAccountName, label, amount},
function(rowsChanged)
xTarget.showNotification(TranslateCap('received_invoice'))
end)
else
print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(xPlayer.source, sharedAccountName))
end
end)
else
MySQL.insert('INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)', {xTarget.identifier, xPlayer.identifier, 'player', xPlayer.identifier, label, amount},
function(rowsChanged)
xTarget.showNotification(TranslateCap('received_invoice'))
end)
end
end
end)
As we can see here, esx_billing reads the player source of the issuer to bill the player, which is obviously not possible on server-side.
Would be nice if there would be a possibility for that 👋
Hey there! 👋
I'm trying to bill a player through esx_billing as a server, but the current implementation of the script seems to deny this:
https://github.com/esx-framework/esx_billing/blob/main/server/main.lua
As we can see here, esx_billing reads the player source of the issuer to bill the player, which is obviously not possible on server-side.
Would be nice if there would be a possibility for that 👋