Merge pull request #9 from vosscat/main

Locale Support
This commit is contained in:
Jim Shield
2022-09-03 20:32:25 +01:00
committed by GitHub
7 changed files with 292 additions and 157 deletions

View File

@@ -17,10 +17,10 @@ CreateThread(function()
if Config.useATM then
if Config.ATMBlips then
for _, v in pairs(Config.WallATMLocations) do
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = "ATM" })
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
end
for _, v in pairs(Config.ATMLocations) do
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = "ATM" })
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
end
end
end
@@ -28,7 +28,7 @@ CreateThread(function()
if Config.BankBlips then
for _, v in pairs(Config.BankLocations) do
for _, b in pairs(v) do
makeBlip({coords = b, sprite = 108, col = 2, scale = 0.55, disp = 6, name = "Bank" })
makeBlip({coords = b, sprite = 108, col = 2, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_bank"] })
break
end
end
@@ -63,19 +63,19 @@ CreateThread(function()
end
end
if Config.useATM then
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"], id = "atm" },}, distance = 1.5, })
for k,v in pairs(Config.WallATMLocations) do
Targets["jimwallatm"..k] =
exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(v.x, v.y, v.z+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"], id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
}, distance = 1.5 })
end
for k,v in pairs(Config.ATMLocations) do
Targets["jimatm"..k] =
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(v.x, v.y, v.z+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"], id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
}, distance = 1.5 })
end
end
@@ -84,15 +84,15 @@ CreateThread(function()
for l, b in pairs(v) do
Targets["jimbank"..k..l] =
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(b.x, b.y, b.z+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = Loc[Config.Lan].target["bank"], id = "bank" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer"], id = "transfer" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = Loc[Config.Lan].target["saving"], id = "savings" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Access Society Account", id = "society", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["soc_saving"], id = "society", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["soc_trans"], id = "societytransfer", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Gang Society Account", id = "gang", gang = gangroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["gang_acct"], id = "gang", gang = gangroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["gang_trans"], id = "gangtransfer", gang = gangroles }, },
distance = 2.5 })
if Config.Peds then
local i = math.random(1, #Config.PedPool)
@@ -130,87 +130,82 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
local setoptions = {}
if data.id == "atm" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, }
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>Welcome back, "..info.name.."<br><br>- Citizen ID -<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash)..'<br><br>- Options -'
setheader = "💵 ATM Banking 💵"
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, }
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>"..Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["citizenid"]..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_atm"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
for k, v in pairs(Config.ATMModels) do
if IsObjectNearPoint(v, GetEntityCoords(PlayerPedId()), 1.6) then
local obj = GetClosestObjectOfType(GetEntityCoords(PlayerPedId()), 1.6, v, false, false, false)
local atmCoords = GetEntityCoords(obj)
lookEnt(obj)
bartext = "Accessing ATM"
bartext = Loc[Config.Lan].menu["acc_atm"]
end
end
elseif data.id == "bank" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash).."<br><br>- Options -"
setheader = "🏦 Banking 🏦"
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_bank"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
bartext = "Accessing Bank"
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_bank"]
elseif data.id == "transfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀"
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = "Accessing Transfers"
bartext = Loc[Config.Lan].menu["acc_trans"]
elseif data.id == "savings" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..info.name.."<br><br>- Account Info -<br>Savings ID: "..info.aid.."<br>"..info.cid.."<br><br>- Balances -<br>💰Savings - $"..cv(info.savbal).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setheader = "💰 Savings 💰"
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_info"]..info.aid.."<br>"..info.cid..Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_saving"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
bartext = "Accessing Savings"
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_saving"]
elseif data.id == "society" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..info.name..
"<br><br>- Society Account -<br>"..
PlayerJob.label..
"<br><br>- Balances -<br>🏢"..
PlayerJob.label.." - $"..cv(info.society)..
"<br>🏦Bank - $"..cv(info.bank)
setheader = "🏢 Society Banking 🏢"
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
setheader = Loc[Config.Lan].menu["header_soc_bank"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
bartext = "Accessing Society Account"
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_boss"]
elseif data.id == "societytransfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(info.society).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀"
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
bartext = "Accessing Society Transfers"
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_boss_trans"]
elseif data.id == "gang" then
setheader = "🏢 Society Banking 🏢"
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setheader = Loc[Config.Lan].menu["header_soc_bank"]
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
bartext = "Accessing Gang Society Account"
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_gang"]
elseif data.id == "gangtransfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀"
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
bartext = "Accessing Gang Transfers"
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_gang_trans"]
end
@@ -218,7 +213,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@enter', "enter", 1.0,-1.0, 1500, 1, 1, true, true, true)
unloadAnimDict('amb@prop_human_atm@male@enter')
QBCore.Functions.Progressbar("accessing_atm", bartext, atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function()
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = Loc[Config.Lan].menu["transfer"], inputs = setinputs })
if dialog then
if not dialog.amount then return end
loadAnimDict('amb@prop_human_atm@male@exit')
@@ -227,7 +222,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
Wait(1000)
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, info.society, info.gsociety)
end
end, function() triggerNotify(nil, "Cancelled!", "error")
end, function() triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
end, data.icon)
end)
@@ -246,11 +241,11 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
end
dist = nil
end
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
local dialog = exports['qb-input']:ShowInput({ header = Loc[Config.Lan].menu["give_cash"], submitText = Loc[Config.Lan].menu["give"],
inputs = {
{ text = " ", name = "citizen", type = "select", options = nearbyList },
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Pay' }, }
{ type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_pay"] }, }
})
if dialog then
if not dialog.citizen or not dialog.price then return end
@@ -262,4 +257,4 @@ end)
AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
end)
end)

View File

@@ -31,8 +31,8 @@ CreateThread(function()
Targets["JimBank"] =
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
{ options = {
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Job Receipts", job = jobroles, },
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Gang Receipts", gang = gangroles, } },
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_boss"], job = jobroles, },
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_gang"], gang = gangroles, } },
distance = 2.0 })
--Crete Ped at the location
if Config.Peds then
@@ -48,7 +48,7 @@ CreateThread(function()
if v[i].gang then job = nil gang = k end
Targets["CustomRegister: "..k..i] =
exports['qb-target']:AddBoxZone("CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=Config.Debug, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4 },
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = job, gang = gang, img = "" }, },
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = Loc[Config.Lan].target["charge"], job = job, gang = gang, img = "" }, },
distance = 2.0 })
if v[i].prop then
Till[#Till+1] = makeProp({prop = `prop_till_03`, coords = v[i].coords}, 1, false)
@@ -59,7 +59,7 @@ end)
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
--Check if player is using /cashregister command
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, "Not Clocked in!", "error") return end
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.List then -- If nearby player list is wanted:
--Retrieve a list of nearby players from server
@@ -78,21 +78,21 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
end
end
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["cus_id"] }
end
--Check if image was given when opening the regsiter
local img = data.img or ""
--Continue adding payment options to qb-input
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = Loc[Config.Lan].menu["type"], options = { { value = "cash", text = Loc[Config.Lan].menu["cash"] }, { value = "bank", text = Loc[Config.Lan].menu["Card"] } } }
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
--Grab Player Job name or Gang Name if needed
local label = PlayerJob.label
local gang = false
if data.gang then label = PlayerGang.label gang = true end
local dialog = exports['qb-input']:ShowInput({ header = img..label.." Cash Register", submitText = "Send", inputs = newinputs})
local dialog = exports['qb-input']:ShowInput({ header = img..label..Loc[Config.Lan].menu["cash_reg"], submitText = Loc[Config.Lan].menu["send"], inputs = newinputs})
if dialog then
if not dialog.citizen or not dialog.price then return end
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
@@ -103,7 +103,7 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
--Check if player is allowed to use /cashregister command
local allowed = false
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
if not allowed then triggerNotify(nil, "You don't have the required job", "error") return end
if not allowed then triggerNotify(nil, Loc[Config.Lan].error["no_job"], "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.FineJobList then -- If nearby player list is wanted:
@@ -123,17 +123,17 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
end
end
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["person_id"] }
end
--Continue adding payment options to qb-input
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
--Grab Player Job name or Gang Name if needed
local label = PlayerJob.label
local gang = false
local dialog = exports['qb-input']:ShowInput({ header = label.." Charge", submitText = "Send", inputs = newinputs})
local dialog = exports['qb-input']:ShowInput({ header = label..Loc[Config.Lan].menu["charge"], submitText = Loc[Config.Lan].menu["send"], inputs = newinputs})
if dialog then
if not dialog.citizen or not dialog.price then return end
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
@@ -144,7 +144,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
--Get ticket info
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
local amount = Citizen.Await(p)
if not amount then triggerNotify(nil, "You don't have any tickets to trade", "error") amount = 0 return else amount = amount.amount end
if not amount then triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error") amount = 0 return else amount = amount.amount end
local sellable = false
local name = "" local label = ""
--Check/adjust for job/gang names
@@ -154,10 +154,10 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
end
if sellable then -- if info is found then:
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[name].PayPerTicket * amount) },
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
{ isMenuHeader = true, header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], txt = Loc[Config.Lan].menu["trade_confirm"] },
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["ticket_amount"]..amount..Loc[Config.Lan].menu["total_pay"]..(Config.Jobs[name].PayPerTicket * amount) },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
})
end
end
@@ -166,18 +166,18 @@ end)
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
local img = img or ""
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
{ isMenuHeader = true, header = img.."🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_payment"] },
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper)..Loc[Config.Lan].menu["payment_amount"]..amount },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
end)
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the charge?" },
{ isMenuHeader = true, header = "", txt = "Bank Charge: $"..amount },
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
{ isMenuHeader = true, header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_charge"] },
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
end)
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)

View File

@@ -1,10 +1,11 @@
print("^2Jim^7-^2Payments v^42^7.^47 ^7- ^2Payments Script by ^1Jimathy^7")
print("^2Jim^7-^2Payments v^42^7.^48 ^7- ^2Payments Script by ^1Jimathy^7")
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
-- https://discord.gg/xKgQZ6wZvS
Config = {
Lan = "en",
Debug = false,
Notify = "qb",
---------------------------------
@@ -87,6 +88,7 @@ Config = {
FineJobConfirmation = false, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
FineJobList = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
ApGov = false, -- Add support for AP-Goverment Tax
---------------------
-- Banking Systems --
---------------------
@@ -246,3 +248,5 @@ if Config.Gabz then
vector3(264.77, 207.51, 106.28),
}
end
Loc = {}

View File

@@ -6,6 +6,6 @@ fx_version "cerulean"
game "gta5"
dependencies { 'qb-input', 'qb-target', }
client_scripts { 'client/*.lua' }
client_scripts { 'client/*.lua', 'locales/*.lua' }
server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' }
shared_scripts { 'config.lua', 'shared/*.lua' }
shared_scripts { 'config.lua', 'shared/*.lua', 'locales/*.lua' }

133
locales/en.lua Normal file
View File

@@ -0,0 +1,133 @@
Loc["en"] = {
error = {
["cancel"] = "Cancelled",
["no_one"] = "No one near by to charge",
["not_onduty"] = "Not Clocked in!",
["no_job"] = "You don't have the required job",
["no_ticket"] = "You don't have any tickets to trade",
["bank_low"] = "Bank Balance too low",
["no_cash"] = "Not enough cash",
["saving_low"] = "Savings Balance too low",
["soc_low"] = "Society balance too low",
["nomoney_bank"] = "Not enough money in your bank",
["error_start"] = "Error: Account '",
["error_end"] = "' not found",
["not_enough"] = "You don't have enough cash to give",
["zero"] = "You can't give $0",
["charge_zero"] = "You can't charge $0",
["no_ticket_to"] = "No tickets to trade",
["customer_nocash"] = "Customer doesn't have enough cash to pay",
["you_nocash"] = "You don't have enough cash to pay",
["decline_pay"] = " declined the $",
["declined_payment"] = "You declined the payment",
},
success = {
["draw"] = "Withdrew $",
["from_bank"] = " from the bank",
["deposited"] = "Deposited $",
["into_bank"] = " into the Bank",
["draw_save"] = " Withdrawn from savings into bank account",
["depos_save"] = " Deposited from bank account into savings",
["fromthe"] = " from the ",
["into"] = " into the ",
["account"] = " account",
["sent"] = "Sent $",
["recieved"] = "Recieved $",
["to"] = " to ",
["from"] = " from ",
["you_gave"] = "You gave ",
["you_got"] = "You got $",
["invoice_start"] = " Paid their $",
["invoice_end"] = " invoice",
["rec_rec"] = "Receipt received",
["commission"] = " in Commission",
["trade_ticket_start"] = "Tickets traded: ",
["trade_ticket_end"] = " Total: $",
["inv_succ"] = "Invoice Successfully Sent",
["inv_recieved"] = "New Invoice Received",
["declined"] = "You declined the payment",
["accepted_pay"] = " accepted the $",
["payment"] = " payment",
["charged"] = " was charged for $",
["you_charged"] = "You were charged for $",
["charge_end"] = " charge",
},
blip = {
["blip_atm"] = "ATM",
["blip_bank"] = "Bank",
},
command = {
["pay_user"] = "Pay a user nearby",
["cash_reg"] = "Use mobile cash register",
["charge"] = "Charge another person",
},
target = {
["atm"] = "Use ATM",
["bank"] = "Use Bank",
["transfer"] = "Transfer Money",
["saving"] = "Access Savings",
["soc_saving"] = "Access Society Account",
["soc_trans"] = "Society Money Transfer",
["gang_acct"] = "Gang Society Account",
["gang_trans"] = "Gang Money Transfer",
["charge"] = "Charge Customer",
["cashin_boss"] = "Cash in Job Receipts",
["cashin_gang"] = "Cash in Gang Receipts",
},
menu = {
["close"] = "Close",
["withdraw"] = "Withdrawl",
["deposit"] = "Deposit",
["transfer"] = "Transfer",
["transfer_money"] = "Transfer Money",
["header_atm"] = "💵 ATM Banking 💵",
["header_trans_amount"] = "💵 Amount to transfer",
["header_bank"] = "🏦 Banking 🏦",
["header_trans"] = "🔀 Transfer Services 🔀",
["header_account_no"] = "🏦 Account no.",
["header_saving"] = "💰 Savings 💰",
["acc_atm"] = "Accessing ATM",
["acc_bank"] = "Accessing Bank",
["acc_trans"] = "Accessing Transfers",
["acc_saving"] = "Accessing Savings",
["acc_boss"] = "Accessing Society Account",
["acc_boss_trans"] = "Accessing Society Transfers",
["acc_gang"] = "Accessing Gang Society Account",
["acc_gang_trans"] = "Accessing Gang Transfers",
["header_soc"] = "<br><br>- Society Account -<br>",
["header_balance"] = "<br><br>- Balances -<br>🏢",
["header_soc_bank"] = "🏢 Society Banking 🏢",
["amount_pay"] = "💵 Amount to Pay'",
["give_cash"] = "Give someone cash",
["give"] = "Give",
["welcome"] = "Welcome back, ",
["citizenid"] = "<br><br>- Citizen ID -<br>",
["header_acc"] = "<br><br>- Account -<br>",
["header_info"] = "<br><br>- Account Info -<br>Savings ID: ",
["header_balance_bank"] = "<br><br>- Balances -<br>🏦Bank - $",
["header_option"] = "<br><br>- Options -",
["cash_balance"] = "<br>💵Cash - $",
["bank_balance"] = "<br>🏦Bank - $",
["saving_balance"] = "<br><br>- Balances -<br>💰Savings - $",
["cus_id"] = "# Customer ID #",
["type"] = "Payment Type",
["amount_charge"] = "💵 Amount to Charge",
["cash_reg"] = " Cash Register",
["person_id"] = "# Person's ID #",
["charge"] = " Charge",
["send"] = "Send",
["receipt"] = " Receipts 🧾",
["payment"] = " Payment 🧾",
["trade_confirm"] = "Do you want trade your receipts for payment?",
["accept_payment"] = "Do you want accept the payment?",
["accept_charge"] = "Do you want accept the charge?",
["ticket_amount"] = "Amount of Tickets: ",
["total_pay"] = "<br>Total Payment: $",
["yes"] = "Yes",
["no"] = "No",
["cash"] = "Cash",
["card"] = "Card",
["payment_amount"] = " Payment: $",
["bank_charge"] = "Bank Charge: $",
},
}

View File

@@ -22,18 +22,18 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
--Simple transfers from bank to wallet --
if account == "bank" or account == "atm" then
if billtype == "withdraw" then
if bankB < amount then triggerNotify(nil, "Bank Balance too low", "error", src)
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
elseif bankB >= tonumber(amount) then
triggerNotify(nil, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["from_bank"], "success") -- Don't really need this as phone gets notified when money is withdrawn
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
Player.Functions.AddMoney('cash', amount)
end
elseif billtype == "deposit" then
if cashB < amount then triggerNotify(nil, "Not enough cash", "error", src)
if cashB < amount then triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
elseif cashB >= amount then
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
Player.Functions.AddMoney('bank', amount)
triggerNotify(nil, "Deposited $"..cv(amount).." into the Bank", "success", src)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into_bank"], "success", src)
end
end
-- Transfers from bank to savings account --
@@ -45,41 +45,41 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
if savbal >= amount then
savbal = savbal - amount
Player.Functions.AddMoney('bank', amount)
triggerNotify(nil, "$"..cv(amount).." Withdrawn from savings into bank account", "success", src)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
if success then return true else return false end
end)
elseif savbal < amount then
triggerNotify(nil, "Savings Balance too low", "error")
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
end
elseif billtype == "deposit" then
if amount < bankB then
savbal = savbal + amount
Player.Functions.RemoveMoney('bank', amount)
triggerNotify(nil, "$"..cv(amount).." Deposited from bank account into savings", "success", src)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
if success then return true else return false end
end)
else triggerNotify(nil, "Bank Balance too low", "error", src)
else triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
end
end
--Simple transfers from society account to bank --
elseif account == "society" then
if billtype == "withdraw" then
if tonumber(society) < amount then triggerNotify(nil, "Society balance too low", "error", src)
if tonumber(society) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
elseif tonumber(society) >= amount then
triggerNotify(nil, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success", src)
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
Player.Functions.AddMoney('bank', amount)
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
end
elseif billtype == "deposit" then
if bankB < amount then triggerNotify(nil, "Not enough money in your bank", "error", src)
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
elseif bankB >= amount then
if Config.Manage then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) end
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
triggerNotify(nil, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success", src)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
end
end
-- Transfer from boss account to players --
@@ -104,34 +104,34 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
if Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success", Reciever.PlayerData.source)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.job.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank = (RecieverMoney.bank + amount)
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
end
end
--Simple transfers from gang society account to bank --
elseif account == "gang" then
if billtype == "withdraw" then
if tonumber(gsociety) < amount then triggerNotify(nil, "Society balance too low", "error", src)
if tonumber(gsociety) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
elseif tonumber(gsociety) >= amount then
triggerNotify(nil, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success", src)
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.gang.label..Loc[Config.Lan].success["account"], "success", src)
Player.Functions.AddMoney('bank', amount)
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
end
elseif billtype == "deposit" then
if bankB < amount then triggerNotify(nil, "Not enough money in your bank", "error", src)
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
elseif bankB >= amount then
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
triggerNotify(nil, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success", src)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.gang.label..Loc[Config.Lan].success["account"], "success", src)
end
end
-- Transfer from gang account to players --
@@ -156,14 +156,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
if not Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success", Reciever.PlayerData.source)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Reciever.PlayerData.source, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.gang.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank = (RecieverMoney.bank + amount)
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
end
end
@@ -188,14 +188,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
Player.Functions.RemoveMoney('bank', amount)
if Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..cv(amount)..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank = (RecieverMoney.bank + amount)
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
end
end
@@ -248,7 +248,7 @@ QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
gsociety = gsociety})
end)
QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
QBCore.Commands.Add("cashgive", Loc[Config.Lan].command["pay_user"], {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
local Player = QBCore.Functions.GetPlayer(source)
@@ -259,11 +259,11 @@ RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
if amount and amount > 0 then
if balance >= amount then
Player.Functions.RemoveMoney('cash', amount)
triggerNotify(nil, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
triggerNotify(nil, Loc[Config.Lan].success["you_gave"]..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
Reciever.Functions.AddMoney('cash', amount)
triggerNotify(nil, "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
triggerNotify(nil, Loc[Config.Lan].success["you_got"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
elseif balance < amount then
triggerNotify(nil, "You don't have enough cash to give", "error", source)
triggerNotify(nil, Loc[Config.Lan].error["not_enough"], "error", source)
end
else triggerNotify(nil,"You can't give $0", 'error', source) end
end)
else triggerNotify(nil, Loc[Config.Lan].error["zero"], 'error', source) end
end)

View File

@@ -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)
@@ -161,11 +161,12 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
if data.gang == true then newdata.society = biller.PlayerData.gang.name end
if data.accept == true then
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
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)
@@ -178,6 +179,7 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
if price > 0 then
if not Config.FineJobConfirmation then
if billed.Functions.RemoveMoney("bank", price) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..price.."^7") end end
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", price) end
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission 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), (price - commission))
@@ -186,12 +188,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 +204,8 @@ 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)
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
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 +215,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)