mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 14:56:02 +01:00
Update 3.0 beta
This commit is contained in:
@@ -7,13 +7,13 @@ if Config.ATMs.enable then
|
||||
for _, v in pairs(GetGamePool('CObject')) do
|
||||
for _, model in pairs(Config.ATMs.ATMModels) do
|
||||
if GetEntityModel(v) == model then
|
||||
local name, entCoords = GetCurrentResourceName()..":ATMLocation:"..v, GetEntityCoords(v)
|
||||
local name, entCoords = getScript()..":ATMLocation:"..v, GetEntityCoords(v)
|
||||
if #(pedCoords - entCoords) <= 150 then
|
||||
if not Targets[name] then
|
||||
Targets[name] =
|
||||
createCircleTarget({name, vec3(entCoords.x, entCoords.y, entCoords.z+1.03), 0.5, { name=name, debugPoly=Config.System.Debug, useZ=true, },},
|
||||
{ { action = function() lookEnt(v) TriggerEvent("jim-payments:Client:ATM") end,
|
||||
icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"],
|
||||
createCircleTarget({name, vec3(entCoords.x, entCoords.y, entCoords.z+1.03), 0.5, { name=name, debugPoly = debugMode, useZ=true, },},
|
||||
{ { action = function() lookEnt(v) TriggerEvent(getScript()..":Client:ATM") end,
|
||||
icon = "fas fa-money-check-alt", label = locale("target", "atm"),
|
||||
}, }, 1.5)
|
||||
end
|
||||
if Config.ATMs.showBlips then
|
||||
@@ -34,64 +34,65 @@ if Config.ATMs.enable then
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('jim-payments:Client:ATM', function() local setheader = nil
|
||||
RegisterNetEvent(getScript()..":Client:ATM", function() local setheader = nil
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local info = triggerCallback("jim-payments:GetInfo")
|
||||
local info = triggerCallback(getScript()..":GetInfo")
|
||||
|
||||
playAnim("amb@prop_human_atm@male@enter", "enter", 2000, 1)
|
||||
|
||||
if progressBar({ label = Loc[Config.Lan].menu["acc_atm"], time = 3000 }) then
|
||||
if progressBar({ label = locale("menu", "acc_atm"), time = 3000 }) then
|
||||
local Menu = {}
|
||||
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = Loc[Config.Lan].menu["welcome"]..info.name,
|
||||
header = locale("menu", "welcome")..info.name,
|
||||
txt = info.cid,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = Loc[Config.Lan].menu["header_balance"],
|
||||
txt = Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
||||
header = locale("menu", "header_balance"),
|
||||
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].menu["withdraw"],
|
||||
header = locale("menu", "withdraw"),
|
||||
onSelect = function()
|
||||
atmWithdrawl(info)
|
||||
end,
|
||||
}
|
||||
local header = Loc[Config.Lan].menu["header_atm"]
|
||||
if Config.System.Menu == "qb" then header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then header = ''
|
||||
local header = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then
|
||||
header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then
|
||||
header = ''
|
||||
end
|
||||
openMenu(Menu, { header = header, canClose = true, onExit = function() playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1) end, })
|
||||
else
|
||||
triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
|
||||
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
function atmWithdrawl(info)
|
||||
local setimage = Loc[Config.Lan].menu["header_atm"]
|
||||
local setimage = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then setimage = ''
|
||||
end
|
||||
local dialog = createInput(Loc[Config.Lan].menu["header_atm"], {
|
||||
local dialog = createInput(locale("menu", "header_atm"), {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text =
|
||||
Config.System.Menu == "ox" and Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)..locale("menu", "cash_balance")..cv(info.cash)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
||||
Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
} },
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"],
|
||||
text = locale("menu", "header_trans_amount"),
|
||||
min = 0,
|
||||
max = info.bank,
|
||||
},
|
||||
@@ -104,7 +105,7 @@ function atmWithdrawl(info)
|
||||
if not dialog.amount then return end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, "atm", info.society, info.gsociety)
|
||||
TriggerServerEvent(getScript()..":server:ATM:use", dialog.amount, dialog.billtype, dialog.account, "atm", info.society, info.gsociety)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
292
client/banks.lua
292
client/banks.lua
@@ -1,321 +1,343 @@
|
||||
Peds = {}
|
||||
|
||||
onPlayerLoaded(function() Core.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
||||
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = GangInfo end)
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||
Core.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end)
|
||||
end)
|
||||
|
||||
if Config.Banks.enable then
|
||||
for k, v in pairs(BankLocations) do
|
||||
for i = 1, #v do
|
||||
local name = GetCurrentResourceName()..":BankLocation:"..k..i
|
||||
local name = getScript()..":BankLocation:"..k..i
|
||||
if Config.General.Peds then
|
||||
if not Config.Gabz then CreateModelHide(v[i].xyz, 1.0, `v_corp_bk_chair3`, true) end
|
||||
if not Peds[name] then
|
||||
Peds[name] = makePed(Config.General.PedPool[math.random(1, #Config.General.PedPool)], v[i], false, false)
|
||||
if GetResourceState("jim-talktonpc"):find("start") then
|
||||
if isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:createDistanceMessage("hi", Peds[name], 3.0, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
local jobroles = {} local gangroles = {}
|
||||
for k, v in pairs(Config.Receipts.Jobs) do if v.gang then gangroles[k] = 0 else jobroles[k] = 0 end end
|
||||
for k, v in pairs(Config.Receipts.Jobs) do
|
||||
if v.gang then
|
||||
gangroles[k] = 0
|
||||
else
|
||||
jobroles[k] = 0
|
||||
end
|
||||
end
|
||||
createCircleTarget(
|
||||
{ name, vector3(v[i].x, v[i].y, v[i].z+0.2), 2.0, { name = name, debugPoly = Config.System.Debug, useZ = true, }, }, {
|
||||
{ name, vec3(v[i].x, v[i].y, v[i].z+0.2), 2.0, { name = name, debugPoly = debugMode, useZ = true, }, }, {
|
||||
{ action = function()
|
||||
if Config.General.Peds and GetResourceState("jim-talktonpc"):find("start") then
|
||||
if Config.General.Peds and isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:createCam(Peds[name], true, "generic", true)
|
||||
end
|
||||
TriggerEvent("jim-payments:Client:Bank", { ped = Config.General.Peds and Peds[name] })
|
||||
TriggerEvent(getScript()..":Client:Bank", { ped = Config.General.Peds and Peds[name] })
|
||||
end,
|
||||
icon = "fas fa-piggy-bank", label = Loc[Config.Lan].target["bank"] },
|
||||
{ action = function() TriggerEvent("jim-payments:Tickets:Menu", { gang = false }) end,
|
||||
icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_boss"], job = jobroles,
|
||||
icon = "fas fa-piggy-bank", label = locale("target", "bank") },
|
||||
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = false }) end,
|
||||
icon = "fas fa-receipt", label = locale("target", "cashin_boss"), job = jobroles,
|
||||
},
|
||||
{ action = function() TriggerEvent("jim-payments:Tickets:Menu", { gang = true }) end,
|
||||
icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_gang"], gang = gangroles,
|
||||
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = true }) end,
|
||||
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
|
||||
},
|
||||
}, 2.5)
|
||||
if Config.Banks.showBlips then
|
||||
makeBlip({coords = v[i], sprite = 814, col = 2, scale = 0.7, disp = 6, name = Loc[Config.Lan].blip["blip_bank"] })
|
||||
makeBlip({coords = v[i], sprite = 814, col = 2, scale = 0.7, disp = 6, name = locale("blip", "blip_bank") })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('jim-payments:Client:Bank', function(data) local setheader = nil
|
||||
RegisterNetEvent(getScript()..":Client:Bank", function(data) local setheader = nil
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local info = triggerCallback("jim-payments:GetInfo")
|
||||
if Config.Banking == "qb" then -- Callbacks to get society cash info
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) info.society = Citizen.Await(p)
|
||||
local p2 = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) info.gsociety = Citizen.Await(p2)
|
||||
end
|
||||
local bankinfo = triggerCallback(getScript()..":GetInfo")
|
||||
local info = getPlayer()
|
||||
info.ped = data.ped or nil
|
||||
|
||||
playAnim("amb@prop_human_atm@male@enter", "enter", 2000, 1)
|
||||
if data.ped then info.ped = data.ped end
|
||||
if progressBar({ label = Loc[Config.Lan].menu["acc_bank"], time = 3000 }) then
|
||||
|
||||
if progressBar({ label = locale("menu", "acc_bank"), time = 3000 }) then
|
||||
local Menu = {}
|
||||
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = Loc[Config.Lan].menu["welcome"]..info.name,
|
||||
txt = Loc[Config.Lan].menu["header_acc"].." "..info.account..br..info.cid,
|
||||
header = locale("menu", "welcome")..info.name,
|
||||
txt = locale("menu", "header_acc").." "..info.account..br..info.citizenId,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = Loc[Config.Lan].menu["header_acc"]..Loc[Config.Lan].menu["header_balance"],
|
||||
txt = Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
||||
header = locale("menu", "header_acc")..locale("menu", "header_balance"),
|
||||
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].menu["deposit"].."/"..Loc[Config.Lan].menu["withdraw"],
|
||||
header = locale("menu", "deposit").."/"..locale("menu", "withdraw"),
|
||||
icon = "fas fa-piggy-bank",
|
||||
onSelect = function() info.id = "bank" bankTransaction(info) end,
|
||||
onSelect = function()
|
||||
info.id = "bank"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) then -- only supports qbcore account transfers
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "transfer"),
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "transfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["transfer"],
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function() info.id = "transfer" bankTransaction(info) end,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["saving"],
|
||||
header = locale("target", "saving"),
|
||||
icon = "fas fa-money-check-dollar",
|
||||
onSelect = function() info.id = "savings" bankTransaction(info) end,
|
||||
onSelect = function()
|
||||
info.id = "savings"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if PlayerJob.isboss then
|
||||
if info.jobBoss then
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["soc_saving"],
|
||||
txt = PlayerJob.label,
|
||||
header = locale("target", "soc_saving"),
|
||||
txt = Jobs[info.job].label or "Error",
|
||||
icon = "fas fa-building",
|
||||
onSelect = function() info.id = "society" bankTransaction(info) end,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["soc_trans"],
|
||||
txt = PlayerJob.label,
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function() info.id = "societytransfer" bankTransaction(info) end,
|
||||
onSelect = function()
|
||||
info.id = "society"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) then
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "soc_trans"),
|
||||
txt = Jobs[info.job].label or "Error",
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "societytransfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
if PlayerGang.isboss then
|
||||
if info.gangBoss then
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["gang_acct"],
|
||||
txt = PlayerGang.label,
|
||||
header = locale("target", "gang_acct"),
|
||||
txt = Gangs[info.gang].label or "Error",
|
||||
icon = "fas fa-building",
|
||||
onSelect = function() info.id = "gang" bankTransaction(info) end,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = Loc[Config.Lan].target["gang_trans"],
|
||||
txt = PlayerGang.label,
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function() info.id = "gangtransfer" bankTransaction(info) end,
|
||||
onSelect = function()
|
||||
info.id = "gang"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) then
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "gang_trans"),
|
||||
txt = Gangs[info.gang].label or "Error",
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "gangtransfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
local header = Loc[Config.Lan].menu["header_atm"]
|
||||
local header = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then header = ''
|
||||
end
|
||||
openMenu(Menu, { header = header, canClose = true, onExit = function()
|
||||
if Config.General.Peds and GetResourceState("jim-talktonpc"):find("start") then
|
||||
if Config.General.Peds and isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:stopCam()
|
||||
end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
end, })
|
||||
else
|
||||
triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
|
||||
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
function bankTransaction(info)
|
||||
local setimage = Loc[Config.Lan].menu["header_atm"]
|
||||
function bankTransaction(info, bankinfo)
|
||||
local setimage = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then setimage = ''
|
||||
end
|
||||
|
||||
playAnim("amb@prop_human_atm@male@idle_a", "idle_a", nil, 1)
|
||||
exports["jim-talktonpc"]:injectEmotion("thanks", info.ped)
|
||||
if isStarted("jim-talktonpc") then exports["jim-talktonpc"]:injectEmotion("thanks", info.ped) end
|
||||
local setinputs, setheader = {}, ""
|
||||
|
||||
if info.id == "bank" then
|
||||
setheader = Loc[Config.Lan].menu["header_bank"]
|
||||
setheader = locale("menu", "header_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)..locale("menu", "cash_balance")..cv(info.cash)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
||||
Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
},
|
||||
},
|
||||
{ type = 'number',
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "transfer" then
|
||||
setheader = Loc[Config.Lan].menu["header_trans"]
|
||||
setheader = locale("menu", "header_trans")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "transfer", text = Loc[Config.Lan].menu["transfer"] }
|
||||
{ value = "transfer", text = locale("menu", "transfer") }
|
||||
},
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = Loc[Config.Lan].menu["header_account_no"]
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"],
|
||||
text = locale("menu", "header_trans_amount"),
|
||||
min = 0,
|
||||
max = info.bank,
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "savings" then
|
||||
setheader = Loc[Config.Lan].menu["header_saving"]
|
||||
setheader = locale("menu", "header_saving")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and locale("menu", "saving_balance")..cv(bankinfo.savbal)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "saving_balance")..cv(bankinfo.savbal)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "society" then
|
||||
setheader = PlayerJob.label.." - "..Loc[Config.Lan].menu["header_soc_bank"]
|
||||
setheader = Jobs[info.job].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and Jobs[info.job].label.." - $"..cv(bankinfo.society)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
PlayerJob.label.." - $"..cv(info.society)..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "societytransfer" then
|
||||
setheader = PlayerJob.label.." - "..Loc[Config.Lan].menu["header_trans"]
|
||||
setheader =Jobs[info.job].label.." - "..locale("menu", "header_trans")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and Jobs[info.job].label.." - $"..cv(bankinfo.society)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
PlayerJob.label.." - $"..cv(info.society)..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
options = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
|
||||
locale("menu", "header_balance")..br..
|
||||
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = { { value = "transfer", text = locale("menu", "transfer") } }
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = Loc[Config.Lan].menu["header_account_no"]
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "gang" then
|
||||
setheader = PlayerGang.label.." - "..Loc[Config.Lan].menu["header_soc_bank"]
|
||||
setheader = Gangs[info.gang].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
PlayerGang.label.." - $"..cv(info.gsociety)..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "gangtransfer" then
|
||||
setheader = PlayerGang.label.." - "..Loc[Config.Lan].menu["header_soc_bank"]
|
||||
setheader = Gangs[info.gang].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
text = Config.System.Menu == "ox" and Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
Loc[Config.Lan].menu["header_balance"]..br..
|
||||
PlayerGang.label.." - $"..cv(info.gsociety)..br..
|
||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
||||
Loc[Config.Lan].menu["header_option"],
|
||||
locale("menu", "header_balance")..br..
|
||||
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "transfer", text = Loc[Config.Lan].menu["transfer"] }
|
||||
{ value = "transfer", text = locale("menu", "transfer") }
|
||||
}
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = Loc[Config.Lan].menu["header_account_no"]
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
end
|
||||
@@ -327,14 +349,14 @@ function bankTransaction(info)
|
||||
dialog.amount = dialog[2] or 1
|
||||
end
|
||||
if not dialog.amount then
|
||||
TriggerEvent("jim-payments:Client:Bank", { ped = info.ped })
|
||||
TriggerEvent(getScript()..":Client:Bank", { ped = info.ped })
|
||||
return
|
||||
end
|
||||
if Config.General.Peds and GetResourceState("jim-talktonpc"):find("start") then
|
||||
if Config.General.Peds and isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:stopCam()
|
||||
end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, info.id, info.society, info.gsociety)
|
||||
TriggerServerEvent(getScript()..":server:ATM:use", dialog.amount, dialog.billtype, dialog.account, info.id, bankinfo.society, bankinfo.gsociety)
|
||||
end
|
||||
end
|
||||
@@ -6,21 +6,17 @@ function spawnCustomRegisters()
|
||||
for i = 1, #v do
|
||||
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
|
||||
createBoxTarget({"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}}, {
|
||||
{ onSelect = function() TriggerEvent("jim-payments:client:Charge", { job = job, gang = gang, img = ""}) end, icon = "fas fa-credit-card", label = Loc[Config.Lan].target["charge"], }
|
||||
{ onSelect = function() TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""}) end, icon = "fas fa-credit-card", label = Loc[Config.Lan].target["charge"], }
|
||||
}, 2.0)
|
||||
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
||||
end
|
||||
end
|
||||
end
|
||||
onPlayerLoaded(function() spawnCustomRegisters() end)
|
||||
|
||||
--Keeps track of duty on script restarts
|
||||
AddEventHandler('onResourceStart', function(r) if GetCurrentResourceName() ~= r then return end
|
||||
spawnCustomRegisters()
|
||||
end)
|
||||
onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
||||
|
||||
local billPrev = "cash"
|
||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
--Check if player is using /cashregister command
|
||||
local dialog
|
||||
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "error") return end
|
||||
@@ -28,13 +24,13 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
local nearbyList = {}
|
||||
if Config.General.List then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
local onlineList = triggerCallback("jim-payments:MakePlayerList")
|
||||
local onlineList = triggerCallback(getScript()..":MakePlayerList")
|
||||
--Convert list of players nearby into one qb-input understands + add distance info
|
||||
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or Config.System.Debug then
|
||||
if v ~= PlayerId() or debugMode then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)', text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
@@ -75,11 +71,11 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
dialog.price = dialog[3]
|
||||
end
|
||||
billPrev = dialog.billtype
|
||||
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||
TriggerServerEvent(getScript()..":server:Charge", dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
local setimage = ""
|
||||
if Config.System.Menu == "qb" then
|
||||
setimage = "<center><img src="..(img and img or "").." width=200px></center>"
|
||||
@@ -103,7 +99,7 @@ RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billty
|
||||
header = Loc[Config.Lan].menu["yes"],
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
@@ -116,7 +112,7 @@ RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billty
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = Loc[Config.Lan].menu["no"],
|
||||
onSelect = function()
|
||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
@@ -128,7 +124,7 @@ RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billty
|
||||
openMenu(Menu, {
|
||||
header = setimage,
|
||||
onExit = function()
|
||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.PolCharge.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
||||
@@ -8,13 +8,13 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
local nearbyList = {}
|
||||
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
local onlineList = triggerCallback("jim-payments:MakePlayerList")
|
||||
local onlineList = triggerCallback(getScript()..":MakePlayerList")
|
||||
--Convert list of players nearby into one qb-input understands + add distance info
|
||||
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or Config.System.Debug then
|
||||
if v ~= PlayerId() or debugMode then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)', text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
@@ -37,11 +37,11 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.price = dialog[2]
|
||||
end
|
||||
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
|
||||
TriggerServerEvent(getScript()..":server:PolCharge", dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount }
|
||||
Menu[#Menu+1] = {
|
||||
@@ -49,7 +49,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
||||
header = Loc[Config.Lan].menu["yes"],
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
@@ -60,7 +60,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = Loc[Config.Lan].menu["no"],
|
||||
onSelect = function()
|
||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
@@ -71,7 +71,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
||||
header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"],
|
||||
headertxt = Loc[Config.Lan].menu["accept_payment"],
|
||||
onExit = function()
|
||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
RegisterNetEvent(getScript()..":Tickets:Menu", function(data)
|
||||
local hasItem, hasTable = hasItem("payticket", 1)
|
||||
if not hasItem then triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error") return end
|
||||
if not hasItem then
|
||||
triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error")
|
||||
return
|
||||
end
|
||||
local amount, sellable, name, label = hasTable["payticket"].count, false, "", ""
|
||||
for k, v in pairs(Config.Receipts.Jobs) do
|
||||
sellable = (data.gang and v.gang and k == PlayerGang.name) or (not data.gang and not v.gang and k == PlayerJob.name)
|
||||
@@ -13,7 +16,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"],
|
||||
onSelect = function() TriggerServerEvent('jim-payments:Tickets:Sell') end,
|
||||
onSelect = function() TriggerServerEvent(getScript()..":Tickets:Sell") end,
|
||||
}
|
||||
openMenu(Menu, { header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], headertxt = Loc[Config.Lan].menu["trade_confirm"], canClose = true, })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user