Attempting restricted payments outside of job

This commit is contained in:
jimathy
2022-05-05 21:34:34 +01:00
committed by GitHub
parent dbd3f33099
commit 9a14e004e9
2 changed files with 31 additions and 27 deletions

View File

@@ -10,7 +10,7 @@ AddEventHandler('onResourceStart', function(resource)
if GetCurrentResourceName() == resource then for k, v in pairs(Config.Jobs) do if not QBCore.Shared.Jobs[k] then print("Jim-Payments: Config.Jobs searched for job '"..k.."' and couldn't find it in the Shared") end end end
end)
--QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, true) end)
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
--Find the biller from their citizenid
@@ -20,13 +20,15 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
end
end
local duty = true
if biller.PlayerData.job.onduty then duty = true else duty = false end
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
if Config.Debug then print("QB-Management: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
if Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
end
-- If ticket system enabled, do this
if Config.TicketSystem then
if duty and Config.TicketSystem then
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
for k, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
@@ -84,7 +86,7 @@ QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb
cb(amount)
end)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside)
local src = source
local biller = QBCore.Functions.GetPlayer(src)
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))