v2.8.4 - Fix logic of the ticket systems

This commit is contained in:
Jim Shield
2022-10-08 19:43:57 +01:00
committed by GitHub
parent 61e2e6f32e
commit 89fa06507b

View File

@@ -45,25 +45,25 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.PlayerData.source)
end
local duty = true
if not biller.PlayerData.job.onduty or gang ~= nil then duty = false end
-- If ticket system enabled, do this
if duty and Config.TicketSystem then
if (biller.PlayerData.job.onduty or gang) and Config.TicketSystem then
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
if Config.TicketSystemAll then
for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil or Player ~= billed then
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
if gang then
if Player.PlayerData.gang.name == data.society then
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
end
else
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
end
end
end
if gang then
if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
end
end
else
if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
@@ -71,6 +71,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
end
end
end
-- Commission section, does each config option separately
local comm = tonumber(Config.Jobs[data.society].Commission)
if Config.Commission and comm ~= 0 then
@@ -231,4 +232,4 @@ QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source,
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname }
end
cb(onlineList)
end)
end)