mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Locale Support
This commit is contained in:
@@ -15,8 +15,8 @@ AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName(
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
QBCore.Commands.Add("polcharge", "Charge another person", {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
|
||||
QBCore.Commands.Add("cashregister", Loc[Config.Lan].command["cash_reg"], {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
QBCore.Commands.Add("polcharge", Loc[Config.Lan].command["charge"], {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
|
||||
@@ -40,7 +40,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||
end
|
||||
triggerNotify(nil, data.sender.." Paid their $"..data.amount.." invoice", "success", biller.PlayerData.source)
|
||||
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
|
||||
@@ -55,19 +55,19 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
if Player ~= nil or Player ~= billed then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
triggerNotify(nil, 'Receipt received', 'success', Player.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
|
||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
end
|
||||
end
|
||||
if gang then
|
||||
biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
triggerNotify(nil, 'Receipt received', 'success', biller.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
|
||||
TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
end
|
||||
end
|
||||
else
|
||||
biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
triggerNotify(nil, 'Receipt received', 'success', biller.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
|
||||
TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
end
|
||||
end
|
||||
@@ -78,9 +78,9 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.CommissionDouble then
|
||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success", biller.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * (comm *2))..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
|
||||
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success", biller.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
|
||||
end
|
||||
if Config.CommissionAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
@@ -88,7 +88,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
if Player ~= nil and Player ~= biller then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * comm))
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success", Player.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.PlayerData.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -98,14 +98,14 @@ end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if not Player.Functions.GetItemByName("payticket") then triggerNotify(nil, "No tickets to trade", 'error', source) return
|
||||
if not Player.Functions.GetItemByName("payticket") then triggerNotify(nil, Loc[Config.Lan].error["no_ticket_to"], 'error', source) return
|
||||
else
|
||||
tickets = Player.Functions.GetItemByName("payticket").amount
|
||||
Player.Functions.RemoveItem('payticket', tickets)
|
||||
pay = (tickets * Config.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
||||
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
|
||||
triggerNotify(nil, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success', source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', source)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -121,8 +121,8 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
local balance = billed.Functions.GetMoney(billtype)
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
triggerNotify(nil, "Customer doesn't have enough cash to pay", "error", src)
|
||||
triggerNotify(nil, "You don't have enough cash to pay", "error", tonumber(citizen))
|
||||
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
|
||||
return
|
||||
end
|
||||
local label = biller.PlayerData.job.label
|
||||
@@ -144,13 +144,13 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
['@sendercitizenid'] = biller.PlayerData.citizenid,
|
||||
['@label'] = biller.PlayerData.job.label,
|
||||
})
|
||||
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = 'Invoice Successfully Sent', img= '/html/static/img/icons/logo.png' })
|
||||
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = 'New Invoice Recieved', img= '/html/static/img/icons/logo.png' })
|
||||
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = Loc[Config.Lan].success["inv_succ"], img= '/html/static/img/icons/logo.png' })
|
||||
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = Loc[Config.Lan].success["inv_recieved"], img= '/html/static/img/icons/logo.png' })
|
||||
end
|
||||
triggerNotify(nil, 'Invoice Successfully Sent', 'success', src)
|
||||
triggerNotify(nil, 'New Invoice Received', nil, billed.PlayerData.source)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.PlayerData.source)
|
||||
end
|
||||
else triggerNotify(nil, "You can't charge $0", 'error', source) return end
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
@@ -162,10 +162,10 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
if data.accept == true then
|
||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success", data.biller)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
|
||||
elseif data.accept == false then
|
||||
triggerNotify(nil, "You declined the payment", nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error", data.biller)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["declined"], nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -186,12 +186,12 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success", src)
|
||||
triggerNotify(nil, 'You were charged for $'..(price - commission), nil, billed.PlayerData.source)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.PlayerData.source)
|
||||
else
|
||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label)
|
||||
end
|
||||
else triggerNotify(nil, "You can't charge $0", 'error', source) return end
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
@@ -202,7 +202,7 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||
if data.accept == true then
|
||||
if billed.Functions.RemoveMoney("bank", data.amount) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..data.amount.."^7") end end
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success", data.biller)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["charge_end"], "success", data.biller)
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
@@ -212,8 +212,8 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^6$^7"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
else
|
||||
triggerNotify(nil, "You declined the payment", nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error", data.biller)
|
||||
triggerNotify(nil, Loc[Config.Lan].error["declined_payment"], nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..Loc[Config.Lan].success["charge_end"], "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user