From ecec448d3077875eb80c3d5bbb6700866f926913 Mon Sep 17 00:00:00 2001 From: Vosscat <63515989+vosscat@users.noreply.github.com> Date: Fri, 2 Sep 2022 19:25:19 +0800 Subject: [PATCH] Locale Support --- client/atms.lua | 133 +++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 69 deletions(-) diff --git a/client/atms.lua b/client/atms.lua index da716c7..d07f644 100644 --- a/client/atms.lua +++ b/client/atms.lua @@ -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 = "

Welcome back, "..info.name.."

- Citizen ID -
"..info.cid.."

- Balances -
🏦Bank - $"..cv(info.bank).."
πŸ’΅Cash - $"..cv(info.cash)..'

- Options -' - setheader = "πŸ’΅ ATM Banking πŸ’΅" + setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, } + setview = "

"..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.."

- Account -
"..info.account.."
"..info.cid.."

- Balances -
🏦Bank - $"..cv(info.bank).."
πŸ’΅Cash - $"..cv(info.cash).."

- 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.."
"..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.."

- Account -
"..info.account.."
"..info.cid.."

- Balances -
🏦Bank - $"..cv(info.bank).."

- 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.."
"..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.."

- Account Info -
Savings ID: "..info.aid.."
"..info.cid.."

- Balances -
πŸ’°Savings - $"..cv(info.savbal).."
🏦Bank - $"..cv(info.bank).."

- 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.."
"..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.. - "

- Society Account -
".. - PlayerJob.label.. - "

- Balances -
🏒".. - PlayerJob.label.." - $"..cv(info.society).. - "
🏦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.."

- Society Account -
"..PlayerJob.label.."

- Balances -
🏒"..PlayerJob.label.." - $"..cv(info.society).."

- 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.."

- Society Account -
"..PlayerGang.label.."

- Balances -
🏒"..PlayerGang.label.." - $"..cv(info.gsociety).."
🏦Bank - $"..cv(info.bank).."

- 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.."

- Society Account -
"..PlayerGang.label.."

- Balances -
🏒"..PlayerGang.label.." - $"..cv(info.gsociety).."

- 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) \ No newline at end of file +end)