Skip to content

Commit

Permalink
AJout nom paiement amende
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedrihan committed Jul 11, 2024
1 parent d2cb866 commit d3344ba
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions resources/[soz]/soz-bank/server/invoices.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ local function PayInvoice(PlayerData, account, id, marked)
MySQL.update.await("UPDATE invoices SET payed = true WHERE id = ? AND payed = false AND refused = false", {
invoice.id,
})

TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Vous avez ~g~payé~s~ votre facture", "success", 10000)
local kindLabel = 'facture'
local messageForEmitter = "Votre facture ~b~%s~s~ a été ~g~payée"
if invoice.kind == 'fine' then
kindLabel = 'amende'
messageForEmitter = "Votre amende ~b~%s~s~ a été ~r~payée par " .. Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
end
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Vous avez ~g~payé~s~ votre " .. kindLabel, "success", 10000)
if Emitter then
TriggerClientEvent("soz-core:client:notification:draw", Emitter.PlayerData.source,
("Votre facture ~b~%s~s~ a été ~g~payée"):format(invoice.label))
(messageForEmitter):format(invoice.label))
end

exports["soz-core"]:Event("invoice_pay", {
Expand Down Expand Up @@ -173,11 +178,17 @@ local function RejectInvoice(PlayerData, account, id)

if PlayerData.charinfo.account == account then
local Player = QBCore.Functions.GetPlayerByCitizenId(invoice.citizenid)
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Vous avez ~r~refusé~s~ votre facture", "error", 10000)
local kindLabel = 'facture'
local messageForEmitter = "Votre facture ~b~%s~s~ a été ~r~refusée"
if invoice.kind == 'fine' then
kindLabel = 'amende'
messageForEmitter = "Votre amende ~b~%s~s~ a été ~r~refusée par " .. Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
end
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Vous avez ~r~refusé~s~ votre " .. kindLabel, "error", 10000)

if Emitter then
TriggerClientEvent("soz-core:client:notification:draw", Emitter.PlayerData.source,
("Votre facture ~b~%s~s~ a été ~r~refusée"):format(invoice.label))
(messageForEmitter):format(invoice.label))
end

exports["soz-core"]:Event("invoice_refuse", {
Expand Down Expand Up @@ -334,7 +345,11 @@ RegisterNetEvent("banking:server:sendInvoice", function(target, label, amount, k

if exports["soz-inventory"]:RemoveItem(Player.PlayerData.source, "paper", 1) then
if CreateInvoice(Player, Target, Player.PlayerData.job.id, Target.PlayerData.charinfo.account, label, tonumber(amount), kind) then
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Votre facture a bien été émise")
local kindLabel = 'facture'
if kind == 'fine' then
kindLabel = 'amende'
end
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Votre " .. kindLabel .. " a bien été émise")
end
else
TriggerClientEvent("soz-core:client:notification:draw", Player.PlayerData.source, "Vous n'avez pas de papier", "error")
Expand Down

0 comments on commit d3344ba

Please sign in to comment.