Added esx_billing:getTargetBills callback event, final commit v1.1.0

This commit is contained in:
ElPumpo
2018-07-14 00:20:12 +02:00
parent f61ea60ca8
commit 8493c3a69c
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ Citizen.CreateThread(function()
end
end)
AddEventHandler('esx:onPlayerDeath', function()
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
end)
+31
View File
@@ -86,6 +86,37 @@ ESX.RegisterServerCallback('esx_billing:getBills', function(source, cb)
end)
ESX.RegisterServerCallback('esx_billing:getTargetBills', function(source, cb, target)
local xPlayer = ESX.GetPlayerFromId(target)
MySQL.Async.fetchAll(
'SELECT * FROM billing WHERE identifier = @identifier',
{
['@identifier'] = xPlayer.identifier
},
function(result)
local bills = {}
for i=1, #result, 1 do
table.insert(bills, {
id = result[i].id,
identifier = result[i].identifier,
sender = result[i].sender,
targetType = result[i].target_type,
target = result[i].target,
label = result[i].label,
amount = result[i].amount
})
end
cb(bills)
end
)
end)
ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id)
local xPlayer = ESX.GetPlayerFromId(source)