mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Update 3.0 beta
This commit is contained in:
@@ -52,7 +52,7 @@ Stream the prop and add the emote that is provided to rpemotes or dpemotes
|
|||||||
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
|
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
|
||||||
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
|
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
|
||||||
```lua
|
```lua
|
||||||
["payticket"] = {["name"] = "payticket", ["label"] = "Receipt", ["weight"] = 150, ["type"] = "item", ["image"] = "ticket.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "Cash these in at the bank!"},
|
payticket = { name = "payticket", label = "Receipt", weight = 10, type = "item", image = "ticket.png", unique = false, useable = false, shouldClose = false, description = "Cash these in at the bank!" },
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add the ticket image to your inventory script:
|
- Add the ticket image to your inventory script:
|
||||||
@@ -199,10 +199,6 @@ FineJobList = true, -- "true" to use nearby player list feature in the cash regi
|
|||||||
- `ATMBlips` Enable this if you are a pyscho and need every ATM to be on the map too
|
- `ATMBlips` Enable this if you are a pyscho and need every ATM to be on the map too
|
||||||
- `Gabz` Enable to change to Gabz Bank locations, this corrects the ATM/Bank Cashier + Ticket Cash in
|
- `Gabz` Enable to change to Gabz Bank locations, this corrects the ATM/Bank Cashier + Ticket Cash in
|
||||||
---
|
---
|
||||||
## Support for other scripts
|
|
||||||
### Renewed-Banking
|
|
||||||
- Support for renewed banking added
|
|
||||||
- Toggle `RenewedBanking` in the config.lua to enable this
|
|
||||||
|
|
||||||
### Renewed's qb-phone
|
### Renewed's qb-phone
|
||||||
- Simply leave the Config.PhoneType as `"qb"`
|
- Simply leave the Config.PhoneType as `"qb"`
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ if Config.ATMs.enable then
|
|||||||
for _, v in pairs(GetGamePool('CObject')) do
|
for _, v in pairs(GetGamePool('CObject')) do
|
||||||
for _, model in pairs(Config.ATMs.ATMModels) do
|
for _, model in pairs(Config.ATMs.ATMModels) do
|
||||||
if GetEntityModel(v) == model then
|
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 #(pedCoords - entCoords) <= 150 then
|
||||||
if not Targets[name] then
|
if not Targets[name] then
|
||||||
Targets[name] =
|
Targets[name] =
|
||||||
createCircleTarget({name, vec3(entCoords.x, entCoords.y, entCoords.z+1.03), 0.5, { name=name, debugPoly=Config.System.Debug, useZ=true, },},
|
createCircleTarget({name, vec3(entCoords.x, entCoords.y, entCoords.z+1.03), 0.5, { name=name, debugPoly = debugMode, useZ=true, },},
|
||||||
{ { action = function() lookEnt(v) TriggerEvent("jim-payments:Client:ATM") end,
|
{ { action = function() lookEnt(v) TriggerEvent(getScript()..":Client:ATM") end,
|
||||||
icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"],
|
icon = "fas fa-money-check-alt", label = locale("target", "atm"),
|
||||||
}, }, 1.5)
|
}, }, 1.5)
|
||||||
end
|
end
|
||||||
if Config.ATMs.showBlips then
|
if Config.ATMs.showBlips then
|
||||||
@@ -34,64 +34,65 @@ if Config.ATMs.enable then
|
|||||||
end)
|
end)
|
||||||
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
|
--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)
|
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 = {}
|
local Menu = {}
|
||||||
|
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
isMenuHeader = true,
|
isMenuHeader = true,
|
||||||
header = Loc[Config.Lan].menu["welcome"]..info.name,
|
header = locale("menu", "welcome")..info.name,
|
||||||
txt = info.cid,
|
txt = info.cid,
|
||||||
}
|
}
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
isMenuHeader = true,
|
isMenuHeader = true,
|
||||||
header = Loc[Config.Lan].menu["header_balance"],
|
header = locale("menu", "header_balance"),
|
||||||
txt = Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||||
}
|
}
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].menu["withdraw"],
|
header = locale("menu", "withdraw"),
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
atmWithdrawl(info)
|
atmWithdrawl(info)
|
||||||
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>"
|
if Config.System.Menu == "qb" then
|
||||||
elseif Config.System.Menu == "ox" then header = ''
|
header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||||
|
elseif Config.System.Menu == "ox" then
|
||||||
|
header = ''
|
||||||
end
|
end
|
||||||
openMenu(Menu, { header = header, canClose = true, onExit = function() playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1) end, })
|
openMenu(Menu, { header = header, canClose = true, onExit = function() playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1) end, })
|
||||||
else
|
else
|
||||||
triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
|
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function atmWithdrawl(info)
|
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>"
|
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||||
elseif Config.System.Menu == "ox" then setimage = ''
|
elseif Config.System.Menu == "ox" then setimage = ''
|
||||||
end
|
end
|
||||||
local dialog = createInput(Loc[Config.Lan].menu["header_atm"], {
|
local dialog = createInput(locale("menu", "header_atm"), {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
name = 'billtype',
|
||||||
text =
|
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)..locale("menu", "cash_balance")..cv(info.cash)
|
||||||
Config.System.Menu == "ox" and Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
|
||||||
or
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||||
Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..br..br..
|
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||||
} },
|
} },
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"],
|
text = locale("menu", "header_trans_amount"),
|
||||||
min = 0,
|
min = 0,
|
||||||
max = info.bank,
|
max = info.bank,
|
||||||
},
|
},
|
||||||
@@ -104,7 +105,7 @@ function atmWithdrawl(info)
|
|||||||
if not dialog.amount then return end
|
if not dialog.amount then return end
|
||||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||||
Wait(1000)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
270
client/banks.lua
270
client/banks.lua
@@ -1,321 +1,343 @@
|
|||||||
Peds = {}
|
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: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
|
if Config.Banks.enable then
|
||||||
for k, v in pairs(BankLocations) do
|
for k, v in pairs(BankLocations) do
|
||||||
for i = 1, #v do
|
for i = 1, #v do
|
||||||
local name = GetCurrentResourceName()..":BankLocation:"..k..i
|
local name = getScript()..":BankLocation:"..k..i
|
||||||
if Config.General.Peds then
|
if Config.General.Peds then
|
||||||
if not Config.Gabz then CreateModelHide(v[i].xyz, 1.0, `v_corp_bk_chair3`, true) end
|
if not Config.Gabz then CreateModelHide(v[i].xyz, 1.0, `v_corp_bk_chair3`, true) end
|
||||||
if not Peds[name] then
|
if not Peds[name] then
|
||||||
Peds[name] = makePed(Config.General.PedPool[math.random(1, #Config.General.PedPool)], v[i], false, false)
|
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)
|
exports["jim-talktonpc"]:createDistanceMessage("hi", Peds[name], 3.0, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local jobroles = {} local gangroles = {}
|
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(
|
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()
|
{ 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)
|
exports["jim-talktonpc"]:createCam(Peds[name], true, "generic", true)
|
||||||
end
|
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,
|
end,
|
||||||
icon = "fas fa-piggy-bank", label = Loc[Config.Lan].target["bank"] },
|
icon = "fas fa-piggy-bank", label = locale("target", "bank") },
|
||||||
{ action = function() TriggerEvent("jim-payments:Tickets:Menu", { gang = false }) end,
|
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = false }) end,
|
||||||
icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_boss"], job = jobroles,
|
icon = "fas fa-receipt", label = locale("target", "cashin_boss"), job = jobroles,
|
||||||
},
|
},
|
||||||
{ action = function() TriggerEvent("jim-payments:Tickets:Menu", { gang = true }) end,
|
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = true }) end,
|
||||||
icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_gang"], gang = gangroles,
|
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
|
||||||
},
|
},
|
||||||
}, 2.5)
|
}, 2.5)
|
||||||
if Config.Banks.showBlips then
|
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
|
||||||
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
|
--this grabs all the info from names to savings account numbers in the databases
|
||||||
local info = triggerCallback("jim-payments:GetInfo")
|
local bankinfo = triggerCallback(getScript()..":GetInfo")
|
||||||
if Config.Banking == "qb" then -- Callbacks to get society cash info
|
local info = getPlayer()
|
||||||
local p = promise.new()
|
info.ped = data.ped or nil
|
||||||
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
|
|
||||||
|
|
||||||
playAnim("amb@prop_human_atm@male@enter", "enter", 2000, 1)
|
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 = {}
|
local Menu = {}
|
||||||
|
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
isMenuHeader = true,
|
isMenuHeader = true,
|
||||||
header = Loc[Config.Lan].menu["welcome"]..info.name,
|
header = locale("menu", "welcome")..info.name,
|
||||||
txt = Loc[Config.Lan].menu["header_acc"].." "..info.account..br..info.cid,
|
txt = locale("menu", "header_acc").." "..info.account..br..info.citizenId,
|
||||||
}
|
}
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
isMenuHeader = true,
|
isMenuHeader = true,
|
||||||
header = Loc[Config.Lan].menu["header_acc"]..Loc[Config.Lan].menu["header_balance"],
|
header = locale("menu", "header_acc")..locale("menu", "header_balance"),
|
||||||
txt = Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)
|
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||||
}
|
}
|
||||||
Menu[#Menu+1] = {
|
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",
|
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] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["transfer"],
|
header = locale("target", "transfer"),
|
||||||
icon = "fas fa-arrow-right-arrow-left",
|
icon = "fas fa-arrow-right-arrow-left",
|
||||||
onSelect = function() info.id = "transfer" bankTransaction(info) end,
|
onSelect = function()
|
||||||
|
info.id = "transfer"
|
||||||
|
bankTransaction(info, bankinfo)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
end
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["saving"],
|
header = locale("target", "saving"),
|
||||||
icon = "fas fa-money-check-dollar",
|
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] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["soc_saving"],
|
header = locale("target", "soc_saving"),
|
||||||
txt = PlayerJob.label,
|
txt = Jobs[info.job].label or "Error",
|
||||||
icon = "fas fa-building",
|
icon = "fas fa-building",
|
||||||
onSelect = function() info.id = "society" bankTransaction(info) end,
|
onSelect = function()
|
||||||
|
info.id = "society"
|
||||||
|
bankTransaction(info, bankinfo)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
if isStarted(QBExport) then
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["soc_trans"],
|
header = locale("target", "soc_trans"),
|
||||||
txt = PlayerJob.label,
|
txt = Jobs[info.job].label or "Error",
|
||||||
icon = "fas fa-arrow-right-arrow-left",
|
icon = "fas fa-arrow-right-arrow-left",
|
||||||
onSelect = function() info.id = "societytransfer" bankTransaction(info) end,
|
onSelect = function()
|
||||||
|
info.id = "societytransfer"
|
||||||
|
bankTransaction(info, bankinfo)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if PlayerGang.isboss then
|
end
|
||||||
|
if info.gangBoss then
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["gang_acct"],
|
header = locale("target", "gang_acct"),
|
||||||
txt = PlayerGang.label,
|
txt = Gangs[info.gang].label or "Error",
|
||||||
icon = "fas fa-building",
|
icon = "fas fa-building",
|
||||||
onSelect = function() info.id = "gang" bankTransaction(info) end,
|
onSelect = function()
|
||||||
|
info.id = "gang"
|
||||||
|
bankTransaction(info, bankinfo)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
if isStarted(QBExport) then
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
header = Loc[Config.Lan].target["gang_trans"],
|
header = locale("target", "gang_trans"),
|
||||||
txt = PlayerGang.label,
|
txt = Gangs[info.gang].label or "Error",
|
||||||
icon = "fas fa-arrow-right-arrow-left",
|
icon = "fas fa-arrow-right-arrow-left",
|
||||||
onSelect = function() info.id = "gangtransfer" bankTransaction(info) end,
|
onSelect = function()
|
||||||
|
info.id = "gangtransfer"
|
||||||
|
bankTransaction(info, bankinfo)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local header = Loc[Config.Lan].menu["header_atm"]
|
end
|
||||||
|
local header = locale("menu", "header_atm")
|
||||||
if Config.System.Menu == "qb" then header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
if Config.System.Menu == "qb" then header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||||
elseif Config.System.Menu == "ox" then header = ''
|
elseif Config.System.Menu == "ox" then header = ''
|
||||||
end
|
end
|
||||||
openMenu(Menu, { header = header, canClose = true, onExit = function()
|
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()
|
exports["jim-talktonpc"]:stopCam()
|
||||||
end
|
end
|
||||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||||
end, })
|
end, })
|
||||||
else
|
else
|
||||||
triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
|
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function bankTransaction(info)
|
function bankTransaction(info, bankinfo)
|
||||||
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>"
|
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||||
elseif Config.System.Menu == "ox" then setimage = ''
|
elseif Config.System.Menu == "ox" then setimage = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
playAnim("amb@prop_human_atm@male@idle_a", "idle_a", nil, 1)
|
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 = {}, ""
|
local setinputs, setheader = {}, ""
|
||||||
|
|
||||||
if info.id == "bank" then
|
if info.id == "bank" then
|
||||||
setheader = Loc[Config.Lan].menu["header_bank"]
|
setheader = locale("menu", "header_bank")
|
||||||
setinputs = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||||
Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..br..br..
|
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
{ value = "deposit", text = locale("menu", "deposit") }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "transfer" then
|
elseif info.id == "transfer" then
|
||||||
setheader = Loc[Config.Lan].menu["header_trans"]
|
setheader = locale("menu", "header_trans")
|
||||||
setinputs = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "transfer", text = Loc[Config.Lan].menu["transfer"] }
|
{ value = "transfer", text = locale("menu", "transfer") }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type = 'text',
|
{ type = 'text',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'account',
|
name = 'account',
|
||||||
text = Loc[Config.Lan].menu["header_account_no"]
|
text = locale("menu", "header_account_no")
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"],
|
text = locale("menu", "header_trans_amount"),
|
||||||
min = 0,
|
min = 0,
|
||||||
max = info.bank,
|
max = info.bank,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "savings" then
|
elseif info.id == "savings" then
|
||||||
setheader = Loc[Config.Lan].menu["header_saving"]
|
setheader = locale("menu", "header_saving")
|
||||||
setinputs = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..br..
|
locale("menu", "saving_balance")..cv(bankinfo.savbal)..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
{ value = "deposit", text = locale("menu", "deposit") }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "society" then
|
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 = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
PlayerJob.label.." - $"..cv(info.society)..br..
|
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
{ value = "deposit", text = locale("menu", "deposit") }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "societytransfer" then
|
elseif info.id == "societytransfer" then
|
||||||
setheader = PlayerJob.label.." - "..Loc[Config.Lan].menu["header_trans"]
|
setheader =Jobs[info.job].label.." - "..locale("menu", "header_trans")
|
||||||
setinputs = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
PlayerJob.label.." - $"..cv(info.society)..br..
|
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
|
options = { { value = "transfer", text = locale("menu", "transfer") } }
|
||||||
},
|
},
|
||||||
{ type = 'text',
|
{ type = 'text',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'account',
|
name = 'account',
|
||||||
text = Loc[Config.Lan].menu["header_account_no"]
|
text = locale("menu", "header_account_no")
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "gang" then
|
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 = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
PlayerGang.label.." - $"..cv(info.gsociety)..br..
|
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] },
|
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||||
{ value = "deposit", text = Loc[Config.Lan].menu["deposit"] }
|
{ value = "deposit", text = locale("menu", "deposit") }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif info.id == "gangtransfer" then
|
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 = {
|
setinputs = {
|
||||||
{ type = 'radio',
|
{ type = 'radio',
|
||||||
name = 'billtype',
|
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
|
or
|
||||||
setimage..
|
setimage..
|
||||||
Loc[Config.Lan].menu["header_balance"]..br..
|
locale("menu", "header_balance")..br..
|
||||||
PlayerGang.label.." - $"..cv(info.gsociety)..br..
|
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||||
Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..br..br..
|
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||||
Loc[Config.Lan].menu["header_option"],
|
locale("menu", "header_option"),
|
||||||
options = {
|
options = {
|
||||||
{ value = "transfer", text = Loc[Config.Lan].menu["transfer"] }
|
{ value = "transfer", text = locale("menu", "transfer") }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type = 'text',
|
{ type = 'text',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'account',
|
name = 'account',
|
||||||
text = Loc[Config.Lan].menu["header_account_no"]
|
text = locale("menu", "header_account_no")
|
||||||
},
|
},
|
||||||
{ type = 'number',
|
{ type = 'number',
|
||||||
isRequired = true,
|
isRequired = true,
|
||||||
name = 'amount',
|
name = 'amount',
|
||||||
text = Loc[Config.Lan].menu["header_trans_amount"]
|
text = locale("menu", "header_trans_amount")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -327,14 +349,14 @@ function bankTransaction(info)
|
|||||||
dialog.amount = dialog[2] or 1
|
dialog.amount = dialog[2] or 1
|
||||||
end
|
end
|
||||||
if not dialog.amount then
|
if not dialog.amount then
|
||||||
TriggerEvent("jim-payments:Client:Bank", { ped = info.ped })
|
TriggerEvent(getScript()..":Client:Bank", { ped = info.ped })
|
||||||
return
|
return
|
||||||
end
|
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()
|
exports["jim-talktonpc"]:stopCam()
|
||||||
end
|
end
|
||||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||||
Wait(1000)
|
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
|
||||||
end
|
end
|
||||||
@@ -6,21 +6,17 @@ function spawnCustomRegisters()
|
|||||||
for i = 1, #v do
|
for i = 1, #v do
|
||||||
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
|
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}}, {
|
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)
|
}, 2.0)
|
||||||
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
onPlayerLoaded(function() spawnCustomRegisters() end)
|
|
||||||
|
|
||||||
--Keeps track of duty on script restarts
|
onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
||||||
AddEventHandler('onResourceStart', function(r) if GetCurrentResourceName() ~= r then return end
|
|
||||||
spawnCustomRegisters()
|
|
||||||
end)
|
|
||||||
|
|
||||||
local billPrev = "cash"
|
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
|
--Check if player is using /cashregister command
|
||||||
local dialog
|
local dialog
|
||||||
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "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
|
||||||
@@ -28,13 +24,13 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
|||||||
local nearbyList = {}
|
local nearbyList = {}
|
||||||
if Config.General.List then -- If nearby player list is wanted:
|
if Config.General.List then -- If nearby player list is wanted:
|
||||||
--Retrieve a list of nearby players from server
|
--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
|
--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
|
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||||
for i = 1, #onlineList do
|
for i = 1, #onlineList do
|
||||||
if onlineList[i].value == GetPlayerServerId(v) then
|
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)' }
|
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
|
||||||
end
|
end
|
||||||
@@ -75,11 +71,11 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
|||||||
dialog.price = dialog[3]
|
dialog.price = dialog[3]
|
||||||
end
|
end
|
||||||
billPrev = dialog.billtype
|
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
|
||||||
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 = ""
|
local setimage = ""
|
||||||
if Config.System.Menu == "qb" then
|
if Config.System.Menu == "qb" then
|
||||||
setimage = "<center><img src="..(img and img or "").." width=200px></center>"
|
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"],
|
header = Loc[Config.Lan].menu["yes"],
|
||||||
txt = "",
|
txt = "",
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||||
accept = true,
|
accept = true,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
biller = biller,
|
||||||
@@ -116,7 +112,7 @@ RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billty
|
|||||||
icon = "fas fa-circle-xmark",
|
icon = "fas fa-circle-xmark",
|
||||||
header = Loc[Config.Lan].menu["no"],
|
header = Loc[Config.Lan].menu["no"],
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||||
accept = false,
|
accept = false,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
biller = biller,
|
||||||
@@ -128,7 +124,7 @@ RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billty
|
|||||||
openMenu(Menu, {
|
openMenu(Menu, {
|
||||||
header = setimage,
|
header = setimage,
|
||||||
onExit = function()
|
onExit = function()
|
||||||
TriggerServerEvent("jim-payments:server:PayPopup", {
|
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||||
accept = false,
|
accept = false,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
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
|
--Check if player is allowed to use /cashregister command
|
||||||
local allowed = false
|
local allowed = false
|
||||||
for k in pairs(Config.PolCharge.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
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 = {}
|
local nearbyList = {}
|
||||||
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
||||||
--Retrieve a list of nearby players from server
|
--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
|
--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
|
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||||
for i = 1, #onlineList do
|
for i = 1, #onlineList do
|
||||||
if onlineList[i].value == GetPlayerServerId(v) then
|
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)' }
|
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
|
||||||
end
|
end
|
||||||
@@ -37,11 +37,11 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
|||||||
dialog.citizen = dialog[1]
|
dialog.citizen = dialog[1]
|
||||||
dialog.price = dialog[2]
|
dialog.price = dialog[2]
|
||||||
end
|
end
|
||||||
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
|
TriggerServerEvent(getScript()..":server:PolCharge", dialog.citizen, dialog.price)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
|
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
||||||
local Menu = {}
|
local Menu = {}
|
||||||
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount }
|
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount }
|
||||||
Menu[#Menu+1] = {
|
Menu[#Menu+1] = {
|
||||||
@@ -49,7 +49,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
|||||||
header = Loc[Config.Lan].menu["yes"],
|
header = Loc[Config.Lan].menu["yes"],
|
||||||
txt = "",
|
txt = "",
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||||
accept = true,
|
accept = true,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
biller = biller,
|
||||||
@@ -60,7 +60,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
|||||||
icon = "fas fa-circle-xmark",
|
icon = "fas fa-circle-xmark",
|
||||||
header = Loc[Config.Lan].menu["no"],
|
header = Loc[Config.Lan].menu["no"],
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||||
accept = false,
|
accept = false,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
biller = biller,
|
||||||
@@ -71,7 +71,7 @@ RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, biller
|
|||||||
header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"],
|
header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"],
|
||||||
headertxt = Loc[Config.Lan].menu["accept_payment"],
|
headertxt = Loc[Config.Lan].menu["accept_payment"],
|
||||||
onExit = function()
|
onExit = function()
|
||||||
TriggerServerEvent("jim-payments:server:PolPopup", {
|
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||||
accept = false,
|
accept = false,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
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)
|
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, "", ""
|
local amount, sellable, name, label = hasTable["payticket"].count, false, "", ""
|
||||||
for k, v in pairs(Config.Receipts.Jobs) do
|
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)
|
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] = {
|
Menu[#Menu+1] = {
|
||||||
icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"],
|
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, })
|
openMenu(Menu, { header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], headertxt = Loc[Config.Lan].menu["trade_confirm"], canClose = true, })
|
||||||
end
|
end
|
||||||
|
|||||||
42
config.lua
42
config.lua
@@ -7,21 +7,22 @@ print("^2Jim^7-^2Payments ^7v^4"..GetResourceMetadata(GetCurrentResourceName(),
|
|||||||
Config = {
|
Config = {
|
||||||
Lan = "en",
|
Lan = "en",
|
||||||
System = {
|
System = {
|
||||||
Debug = true,
|
Debug = false,
|
||||||
|
EventDebug = false,
|
||||||
|
|
||||||
Menu = "qb", -- "qb", "ox", "gta"
|
Menu = "qb", -- "qb", "ox", "gta"
|
||||||
Notify = "gta", -- "qb", "ox", "gta", "esx"
|
Notify = "qb", -- "qb", "ox", "gta", "esx"
|
||||||
ProgressBar = "gta", -- "qb", "ox", "gta", "esx"
|
ProgressBar = "qb", -- "qb", "ox", "gta", "esx"
|
||||||
|
},
|
||||||
|
|
||||||
|
Crafting = {
|
||||||
|
craftCam = true,
|
||||||
|
MultiCraft = true,
|
||||||
|
MultiCraftAmounts = { [1], [5], [10] },
|
||||||
|
showItemBox = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
General = {
|
General = {
|
||||||
Banking = "qb-banking",
|
|
||||||
-- "qb-management" -- This is for the older version of QBCore
|
|
||||||
-- "qb-banking" -- This is for the latest QBCore updates
|
|
||||||
-- "renewed"
|
|
||||||
-- "fd" -- currently default supported
|
|
||||||
-- "okok" -- make sure to add societies to Config.Societies in okokBanking, This is for the latest QBCore updates
|
|
||||||
|
|
||||||
ApGov = false, -- Toggle support for AP-Goverment Tax
|
ApGov = false, -- Toggle support for AP-Goverment Tax
|
||||||
|
|
||||||
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||||
@@ -57,11 +58,8 @@ Config = {
|
|||||||
-- "qb" for qb-phone
|
-- "qb" for qb-phone
|
||||||
-- "gks" for GKSPhone
|
-- "gks" for GKSPhone
|
||||||
|
|
||||||
useBanks = false, -- Enable this to use my banking stuff
|
|
||||||
|
|
||||||
BankBlips = false, -- Enable this if you disabled qb-banking and need bank locations
|
Gabz = false, -- "true" to enable Gabz Bank locations
|
||||||
|
|
||||||
Gabz = true, -- "true" to enable Gabz Bank locations
|
|
||||||
-- this corrects the ATM/Bank Cashier + Ticket Cash in locations
|
-- this corrects the ATM/Bank Cashier + Ticket Cash in locations
|
||||||
|
|
||||||
menuLogo = "https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png",
|
menuLogo = "https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png",
|
||||||
@@ -69,7 +67,7 @@ Config = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
ATMs = {
|
ATMs = {
|
||||||
enable = true,
|
enable = true, -- Enable this if wanting to use jim-payments atm systems
|
||||||
showBlips = true,
|
showBlips = true,
|
||||||
|
|
||||||
ATMModels = { `prop_atm_01`, `prop_atm_02`, `prop_atm_03`, `prop_fleeca_atm`, `gabz_sm_pb_atmframe` },
|
ATMModels = { `prop_atm_01`, `prop_atm_02`, `prop_atm_03`, `prop_fleeca_atm`, `gabz_sm_pb_atmframe` },
|
||||||
@@ -77,7 +75,7 @@ Config = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Banks = {
|
Banks = {
|
||||||
enable = true,
|
enable = true, -- Enable this if wanting to use jim-payments banking systems
|
||||||
showBlips = true,
|
showBlips = true,
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -103,7 +101,7 @@ Config = {
|
|||||||
vec4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
|
vec4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
|
||||||
},
|
},
|
||||||
|
|
||||||
CashInAnywhere = true,
|
CashInAnywhere = true, -- enable this to add cash ticket option to any banking location
|
||||||
|
|
||||||
-- MinAmountforTicket should be your cheapest item
|
-- MinAmountforTicket should be your cheapest item
|
||||||
-- PayPerTicket should never be higher than MinAmountforTicket
|
-- PayPerTicket should never be higher than MinAmountforTicket
|
||||||
@@ -156,3 +154,13 @@ Config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerGang, PlayerJob, onDuty = {}, {}, nil
|
PlayerGang, PlayerJob, onDuty = {}, {}, nil
|
||||||
|
|
||||||
|
-- Test function for locales
|
||||||
|
function locale(section, string)
|
||||||
|
if not Config.Lan or Config.Lan == "" then return print("Error, no langauge set") end
|
||||||
|
local localTable = Loc[Config.Lan]
|
||||||
|
if not localTable then return "Locale Table Not Found" end
|
||||||
|
if not localTable[section] then return "["..section.."] Invalid" end
|
||||||
|
if not localTable[section][string] then return "["..string.."] Invalid" end
|
||||||
|
return localTable[section][string]
|
||||||
|
end
|
||||||
@@ -14,15 +14,14 @@ shared_scripts {
|
|||||||
|
|
||||||
-- Required core scripts
|
-- Required core scripts
|
||||||
'@ox_lib/init.lua',
|
'@ox_lib/init.lua',
|
||||||
'@ox_core/imports/client.lua',
|
'@ox_core/lib/init.lua',
|
||||||
|
|
||||||
'@es_extended/imports.lua',
|
'@es_extended/imports.lua',
|
||||||
|
|
||||||
'@qbx_core/modules/playerdata.lua',
|
'@qbx_core/modules/playerdata.lua',
|
||||||
|
|
||||||
--Jim Bridge
|
--Jim Bridge
|
||||||
'@jim_bridge/exports.lua',
|
'@jim_bridge/starter.lua',
|
||||||
'@jim_bridge/functions.lua',
|
|
||||||
'@jim_bridge/wrapper.lua',
|
|
||||||
'@jim_bridge/crafting.lua',
|
|
||||||
'shared/*.lua',
|
'shared/*.lua',
|
||||||
}
|
}
|
||||||
client_scripts {
|
client_scripts {
|
||||||
|
|||||||
@@ -1,49 +1,60 @@
|
|||||||
RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, baccount, account, society, gsociety)
|
Core.Commands.Add("cashgive",
|
||||||
|
Loc[Config.Lan].command["pay_user"], {}, false, function(source) TriggerClientEvent(getScript()..":client:ATM:give", source) end)
|
||||||
|
|
||||||
|
registerCommand("polcharge", {
|
||||||
|
Loc[Config.Lan].command["pay_user"], {}, false,
|
||||||
|
function(source)
|
||||||
|
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, baccount, account, society, gsociety)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = Core.Functions.GetPlayer(src)
|
local Player = getPlayer(src)
|
||||||
local cashB = Player.Functions.GetMoney("cash")
|
|
||||||
local bankB = Player.Functions.GetMoney("bank")
|
|
||||||
local amount = tonumber(amount)
|
local amount = tonumber(amount)
|
||||||
|
local bankScript, newAmount = "", 0
|
||||||
|
|
||||||
--Simple transfers from bank to wallet --
|
--Simple transfers from bank to wallet --
|
||||||
if account == "bank" or account == "atm" then
|
if account == "bank" or account == "atm" then
|
||||||
if billtype == "withdraw" then
|
if billtype == "withdraw" then
|
||||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
if Player.bank < amount then
|
||||||
elseif bankB >= tonumber(amount) then
|
triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
||||||
|
elseif Player.bank >= tonumber(amount) then
|
||||||
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
|
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)
|
chargePlayer(amount, "bank", src) Wait(1500)
|
||||||
Player.Functions.AddMoney('cash', amount)
|
fundPlayer(amount, "cash", src)
|
||||||
end
|
end
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if cashB < amount then triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
|
if Player.cash < amount then
|
||||||
elseif cashB >= amount then
|
triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
|
||||||
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
|
elseif Player.cash >= amount then
|
||||||
Player.Functions.AddMoney('bank', amount)
|
chargePlayer(amount, "cash", src) Wait(1500)
|
||||||
|
fundPlayer(amount, "bank", src)
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into_bank"], "success", src)
|
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into_bank"], "success", src)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Transfers from bank to savings account --
|
-- Transfers from bank to savings account --
|
||||||
elseif account == "savings" then
|
elseif account == "savings" then
|
||||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.PlayerData.citizenid, 'Savings_'..Player.PlayerData.citizenid, })
|
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||||
if getSavingsAccount[1] ~= nil then savbal = tonumber(getSavingsAccount[1].account_balance) aid = getSavingsAccount[1].citizenid end
|
if getSavingsAccount[1] ~= nil then savbal = tonumber(getSavingsAccount[1].account_balance) aid = getSavingsAccount[1].citizenid end
|
||||||
|
|
||||||
if billtype == "withdraw" then
|
if billtype == "withdraw" then
|
||||||
if savbal >= amount then
|
if savbal >= amount then
|
||||||
savbal -= amount
|
savbal -= amount
|
||||||
Player.Functions.AddMoney('bank', amount)
|
fundPlayer(amount, "cash", src)
|
||||||
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
|
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
|
||||||
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.PlayerData.citizenid}, function(success)
|
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId}, function(success)
|
||||||
if success then return true else return false end
|
if success then return true else return false end
|
||||||
end)
|
end)
|
||||||
elseif savbal < amount then
|
elseif savbal < amount then
|
||||||
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
|
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
|
||||||
end
|
end
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if amount < bankB then
|
if amount < Player.bank then
|
||||||
savbal += amount
|
savbal += amount
|
||||||
Player.Functions.RemoveMoney('bank', amount)
|
chargePlayer(amount, "bank", src)
|
||||||
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
|
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
|
||||||
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.PlayerData.citizenid}, function(success)
|
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId}, function(success)
|
||||||
if success then return true else return false end
|
if success then return true else return false end
|
||||||
end)
|
end)
|
||||||
else triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
else triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
||||||
@@ -52,27 +63,60 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
--Simple transfers from society account to bank --
|
--Simple transfers from society account to bank --
|
||||||
elseif account == "society" then
|
elseif account == "society" then
|
||||||
if billtype == "withdraw" then
|
if billtype == "withdraw" then
|
||||||
if tonumber(society) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
if tonumber(society) < amount then
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
||||||
elseif tonumber(society) >= amount then
|
elseif tonumber(society) >= amount then
|
||||||
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 isStarted("Renewed-Banking") then
|
||||||
if Config.Banking == "renewed" then exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
bankScript = "Renewed-Banking"
|
||||||
elseif Config.Banking == "qb-management" then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
exports['Renewed-Banking']:removeAccountMoney(Player.job, amount)
|
||||||
elseif Config.Banking == "qb-banking" then exports["qb-banking"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
newAmount = exports["Renewed-Banking"]:getAccountMoney(Player.job)
|
||||||
elseif Config.Banking == "fd" then exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount) end
|
elseif isStarted("qb-banking") then
|
||||||
|
bankScript = "qb-banking"
|
||||||
|
exports["qb-banking"]:RemoveMoney(Player.job, amount)
|
||||||
|
newAmount = exports["qb-banking"]:GetAccountBalance(Player.job)
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
bankScript = "fd_banking"
|
||||||
|
exports["fd_banking"]:RemoveMoney(Player.job, amount)
|
||||||
|
newAmount = exports["fd_banking"]:GetAccount(Player.job)
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
bankScript = "okokBanking"
|
||||||
|
exports['okokBanking']:RemoveMoney(Player.job, amount)
|
||||||
|
newAmount = exports['okokBanking']:GetAccount(Player.job)
|
||||||
|
end
|
||||||
|
|
||||||
|
fundPlayer(amount, "bank", src)
|
||||||
|
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Removing ^7$"..amount.." ^2from account ^7'^6"..Player.job.."^7' ($"..newAmount..")")
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Jobs[Player.job].label..Loc[Config.Lan].success["account"], "success", src)
|
||||||
end
|
end
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
if Player.bank < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
||||||
elseif bankB >= amount then
|
elseif Player.bank >= amount then
|
||||||
if Config.Banking == "renewed" then exports['Renewed-Banking']:addAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
if isStarted("Renewed-Banking") then
|
||||||
elseif Config.Banking == "qb-management" then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
bankScript = "Renewed-Banking"
|
||||||
elseif Config.Banking == "qb-banking" then exports["qb-banking"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
exports['Renewed-Banking']:addAccountMoney(Player.job, amount)
|
||||||
elseif Config.Banking == "fd" then exports.fd_banking:AddMoney(tostring(Player.PlayerData.job.name), amount) end
|
newAmount = exports["Renewed-Banking"]:getAccountMoney(Player.job)
|
||||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
|
||||||
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)
|
elseif isStarted("qb-banking") then
|
||||||
|
bankScript = "qb-banking"
|
||||||
|
exports["qb-banking"]:AddMoney(Player.job, amount)
|
||||||
|
newAmount = exports["qb-banking"]:GetAccountBalance(Player.job)
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
bankScript = "fd_banking"
|
||||||
|
exports.fd_banking:AddMoney(Player.job, amount)
|
||||||
|
newAmount = exports["fd_banking"]:GetAccount(Player.job)
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
bankScript = "okokBanking"
|
||||||
|
exports['okokBanking']:AddMoney(Player.job, amount)
|
||||||
|
newAmount = exports['okokBanking']:GetAccount(Player.job)
|
||||||
|
end
|
||||||
|
chargePlayer(amount, "bank", src) Wait(1500)
|
||||||
|
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Adding ^7$"..amount.." ^2to account ^7'^6"..Player.job.."^7' ($"..newAmount..")")
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Jobs[Player.job].label..Loc[Config.Lan].success["account"], "success", src)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Transfer from boss account to players --
|
-- Transfer from boss account to players --
|
||||||
|
--[[ disabled until i work out a system for other frameworks
|
||||||
elseif account == "societytransfer" then
|
elseif account == "societytransfer" then
|
||||||
local bannedCharacters = {'%','$',';'}
|
local bannedCharacters = {'%','$',';'}
|
||||||
local newAmount = tostring(amount)
|
local newAmount = tostring(amount)
|
||||||
@@ -90,10 +134,15 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||||
if result[1] then
|
if result[1] then
|
||||||
local Reciever = Core.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
local Reciever = Core.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||||
if Config.Banking == "renewed" then exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
if Config.Banking == "renewed" then
|
||||||
elseif Config.Banking == "qb-management" then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
elseif Config.Banking == "qb-banking" then exports["qb-banking"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
elseif Config.Banking == "qb-management" then
|
||||||
elseif Config.Banking == "fd" then exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount) end
|
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
elseif Config.Banking == "qb-banking" then
|
||||||
|
exports["qb-banking"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
elseif Config.Banking == "fd" then
|
||||||
|
exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
end
|
||||||
if Reciever then
|
if Reciever then
|
||||||
Reciever.Functions.AddMoney('bank', amount)
|
Reciever.Functions.AddMoney('bank', amount)
|
||||||
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["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||||
@@ -105,29 +154,43 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
end
|
end
|
||||||
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "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
|
||||||
end
|
end]]
|
||||||
|
|
||||||
--Simple transfers from gang society account to bank --
|
--Simple transfers from gang society account to bank --
|
||||||
elseif account == "gang" then
|
elseif account == "gang" then
|
||||||
if billtype == "withdraw" then
|
if billtype == "withdraw" then
|
||||||
if tonumber(gsociety) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
if tonumber(gsociety) < amount then
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
||||||
elseif tonumber(gsociety) >= amount then
|
elseif tonumber(gsociety) >= amount then
|
||||||
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)
|
if isStarted("Renewed-Banking") then
|
||||||
Player.Functions.AddMoney('bank', amount)
|
exports['Renewed-Banking']:removeAccountMoney(Player.gang, amount)
|
||||||
if Config.Banking == "renewed" then exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.gang.name), amount)
|
elseif isStarted("qb-banking") then
|
||||||
elseif Config.Banking == "qb-management" then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
exports["qb-banking"]:RemoveMoney(Player.gang, amount)
|
||||||
elseif Config.Banking == "qb-banking" then exports["qb-banking"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
elseif isStarted("fd_banking") then
|
||||||
elseif Config.Banking == "fd" then exports.fd_banking:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount) end
|
exports["fd_banking"]:RemoveGangMoney(Player.gang, amount)
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
exports["okokBanking"]:RemoveMoney(Player.gang, amount)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
fundPlayer(amount, "bank", src)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Gangs[Player.gang].label..Loc[Config.Lan].success["account"], "success", src)
|
||||||
|
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
if Player.bank < amount then
|
||||||
elseif bankB >= amount then
|
triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
||||||
if Config.Banking == "rewnewed" then exports['Renewed-Banking']:addAccountMoney(tostring(Player.PlayerData.gang.name), amount)
|
elseif Player.bank >= amount then
|
||||||
elseif Config.Banking == "qb-management" then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
if isStarted("Renewed-Banking") then
|
||||||
elseif Config.Banking == "qb-banking" then exports["qb-banking"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
exports['Renewed-Banking']:addAccountMoney(Player.gang, amount)
|
||||||
elseif Config.Banking == "fd" then exports.fd_banking:AddGangMoney(tostring(Player.PlayerData.gang.name), amount) end
|
elseif isStarted("qb-banking") then
|
||||||
|
exports["qb-banking"]:AddGangMoney(Player.gang, amount)
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
exports["fd_banking"]:AddGangMoney(Player.gang, amount)
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
exports["okokBanking"]:AddMoney(Player.gang, amount)
|
||||||
|
end
|
||||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||||
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)
|
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Gangs[Player.gang].label..Loc[Config.Lan].success["account"], "success", src)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Transfer from gang account to players --
|
-- Transfer from gang account to players --
|
||||||
@@ -200,68 +263,69 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
createCallback('jim-payments:GetInfo', function(source, cb)
|
createCallback(getScript()..":GetInfo", function(source)
|
||||||
local Player = Core.Functions.GetPlayer(source)
|
local Player = getPlayer(source)
|
||||||
local name = Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname
|
local society, gsociety = 0, 0
|
||||||
local cid = Player.PlayerData.citizenid.." ["..source.."]"
|
|
||||||
local cash = Player.Functions.GetMoney("cash")
|
|
||||||
local bank = Player.Functions.GetMoney("bank")
|
|
||||||
local account = Player.PlayerData.charinfo.account
|
|
||||||
local society = 0
|
|
||||||
local gsociety = 0
|
|
||||||
|
|
||||||
if Config.General.Banking == "qb-banking" then
|
if isStarted("Renewed-Banking") then
|
||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts')
|
society = exports["Renewed-Banking"]:getAccountMoney(Player.job)
|
||||||
for _, v in pairs(result) do
|
if Player.gang ~= "none" then
|
||||||
if Player.PlayerData.job.name == v.account_name then society = v.account_balance end
|
gsociety = exports["Renewed-Banking"]:getAccountMoney(Player.gang)
|
||||||
end
|
end
|
||||||
if Player.PlayerData.gang.name ~= "none" then
|
|
||||||
for _, v in pairs(result) do
|
elseif isStarted("qb-banking") then
|
||||||
if Player.PlayerData.gang.name == v.account_name then gsociety = v.account_balance end
|
if not exports["qb-banking"]:GetAccount(Player.job) then
|
||||||
|
print("Making new bank account in qb-banking for "..Player.job)
|
||||||
|
exports["qb-banking"]:CreateJobAccount(Player.job, 0) Wait(150) -- make new account if return "null"
|
||||||
|
end
|
||||||
|
society = exports["qb-banking"]:GetAccountBalance(Player.job)
|
||||||
|
if Player.gang ~= "none" then
|
||||||
|
if not exports["qb-banking"]:GetAccount(Player.gang) then
|
||||||
|
print("Making new bank account in qb-banking for "..Player.gang)
|
||||||
|
exports["qb-banking"]:CreateGangAccount(Player.gang, 0) Wait(150) -- make new account if return "null"
|
||||||
|
society = exports["qb-banking"]:GetAccountBalance(Player.gang)
|
||||||
|
end
|
||||||
|
society = exports["qb-banking"]:GetAccountBalance(Player.gang)
|
||||||
|
end
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
society = exports["fd_banking"]:GetAccount(Player.job)
|
||||||
|
if Player.gang ~= "none" then
|
||||||
|
gsociety = exports["fd_banking"]:GetGangAccount(Player.gang)
|
||||||
|
end
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
society = exports["okokBanking"]:GetAccount(Player.job)
|
||||||
|
if Player.gang ~= "none" then
|
||||||
|
gsociety = exports["okokBanking"]:GetAccount(Player.gang)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If qb-management, grab info directly from database
|
|
||||||
elseif not Config.General.Banking == "renewed" then
|
|
||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM management_funds')
|
|
||||||
for _, v in pairs(result) do
|
|
||||||
if Player.PlayerData.job.name == v.job_name then society = v.amount end
|
|
||||||
end
|
|
||||||
if Player.PlayerData.gang.name ~= "none" then
|
|
||||||
for _, v in pairs(result) do
|
|
||||||
if Player.PlayerData.gang.name == v.job_name then gsociety = v.amount end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
|
|
||||||
end
|
|
||||||
-- Grab Savings account info
|
-- Grab Savings account info
|
||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.PlayerData.citizenid, 'Savings_'..Player.PlayerData.citizenid, })
|
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||||
if result[1] then
|
if result[1] then
|
||||||
accountID = result[1].citizenid
|
accountID = result[1].citizenid
|
||||||
savingBalance = result[1].account_balance
|
savingBalance = result[1].account_balance
|
||||||
else
|
else
|
||||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.PlayerData.citizenid, 'Savings_'..Player.PlayerData.citizenid, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.citizenId, 'Savings_'..Player.citizenId, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.PlayerData.citizenid, 'Savings_'..Player.PlayerData.citizenid, })
|
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||||
accountID = result[1].citizenid
|
accountID = result[1].citizenid
|
||||||
savingBalance = result[1].account_balance
|
savingBalance = result[1].account_balance
|
||||||
end
|
end
|
||||||
local retTable = {name = name,
|
local retTable = {
|
||||||
cash = cash,
|
name = Player.firstname..' '..Player.lastname,
|
||||||
bank = bank,
|
cash = Player.cash,
|
||||||
account = account,
|
bank = Player.bank,
|
||||||
cid = cid,
|
account = Player.account,
|
||||||
|
cid = Player.citizenId.." ["..source.."]",
|
||||||
savbal = savingBalance,
|
savbal = savingBalance,
|
||||||
aid = accountID,
|
aid = accountID,
|
||||||
society = society,
|
society = society,
|
||||||
gsociety = gsociety}
|
gsociety = gsociety
|
||||||
if GetResourceState(OXLibExport):find("start") then return retTable
|
}
|
||||||
else return cb(retTable) end
|
|
||||||
|
return retTable
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Core.Commands.Add("cashgive", Loc[Config.Lan].command["pay_user"], {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
|
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
|
||||||
local Player = Core.Functions.GetPlayer(source)
|
local Player = Core.Functions.GetPlayer(source)
|
||||||
local Reciever = Core.Functions.GetPlayer(tonumber(citizen))
|
local Reciever = Core.Functions.GetPlayer(tonumber(citizen))
|
||||||
local amount = tonumber(price)
|
local amount = tonumber(price)
|
||||||
|
|||||||
@@ -1,214 +1,104 @@
|
|||||||
AddEventHandler('onResourceStart', function(r) if GetCurrentResourceName() ~= r then return end
|
onResourceStart(function()
|
||||||
for k in pairs(Config.Receipts.Jobs) do
|
for k in pairs(Config.Receipts.Jobs) do
|
||||||
|
while not Jobs do Wait(10) end
|
||||||
if not Jobs[k] and not Gangs[k] then
|
if not Jobs[k] and not Gangs[k] then
|
||||||
print("Jim-Payments: Config.Receipts.Jobs searched for job/gang '"..k.."' and couldn't find it in the Shared")
|
debugPrint("^1Error^7: ^5Config^7.^5Receipts^7.^5Jobs ^2searched for job/gang ^7'^3"..k.."^7' ^2and couldn't find it in the Shared^7")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
registerCommand("cashregister", { Loc[Config.Lan].command["cash_reg"], {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end })
|
if Items and not Items["payticket"] then
|
||||||
|
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
|
||||||
|
end
|
||||||
|
end, true)
|
||||||
|
|
||||||
createCallback('jim-payments:MakePlayerList', function(source, cb)
|
registerCommand("cashregister", {
|
||||||
|
Loc[Config.Lan].command["cash_reg"], {}, false,
|
||||||
|
function(source)
|
||||||
|
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
createCallback(getScript()..":MakePlayerList", function(source)
|
||||||
local onlineList = {}
|
local onlineList = {}
|
||||||
for _, v in pairs(Core.Functions.GetPlayers()) do
|
for _, v in pairs(GetPlayers()) do
|
||||||
local Player = getPlayer(v)
|
local Player = getPlayer(v)
|
||||||
onlineList[#onlineList+1] = {
|
onlineList[#onlineList+1] = {
|
||||||
value = tonumber(v),
|
value = tonumber(v),
|
||||||
text = "["..v.."] - "..Player.name
|
text = "["..v.."] - "..Player.name
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if GetResourceState(OXLibExport):find("start") then return onlineList
|
return onlineList
|
||||||
else cb(onlineList) end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
|
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||||
print(citizen, price, billtype, img, outside, gang)
|
|
||||||
local src = source
|
local src = source
|
||||||
local biller = Core.Functions.GetPlayer(src)
|
local biller = getPlayer(src)
|
||||||
local billed = Core.Functions.GetPlayer(tonumber(citizen))
|
local billed = getPlayer(tonumber(citizen))
|
||||||
local amount = tonumber(price)
|
local amount = tonumber(price)
|
||||||
local balance = billed.Functions.GetMoney(billtype)
|
local balance = billed[billtype]
|
||||||
if amount and amount > 0 then
|
if amount and amount > 0 then
|
||||||
if balance < amount then
|
if balance < amount then
|
||||||
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
|
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
|
||||||
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
|
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local label = biller.PlayerData.job.label
|
local label = gang == true and Gangs[biller.gang].label or Jobs[biller.job].label
|
||||||
if gang == true then label = biller.PlayerData.gang.label end
|
|
||||||
if Config.General.PhoneBank == false or gang == true or billtype == "cash" then
|
if Config.General.PhoneBank == false or gang == true or billtype == "cash" then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang, outside)
|
TriggerClientEvent(getScript()..":client:PayPopup", billed.source, amount, src, billtype, img, label, gang, outside)
|
||||||
else
|
else
|
||||||
if Config.General.PhoneType == "qb" then
|
if Config.General.PhoneType == "qb" then
|
||||||
MySQL.Async.insert(
|
MySQL.Async.insert(
|
||||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
||||||
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid}, function(id)
|
{billed.citizenid, amount, biller.job, biller.firstname, biller.citizenid}, function(id)
|
||||||
if id then
|
if id then
|
||||||
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.PlayerData.source, id, biller.PlayerData.charinfo.firstname, biller.PlayerData.job.name, biller.PlayerData.citizenid, amount, GetInvokingResource())
|
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.source, id, biller.firstname, biller.job, biller.citizenid, amount, GetInvokingResource())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
TriggerClientEvent('qb-phone:RefreshPhone', billed.source)
|
||||||
elseif Config.General.PhoneType == "gks" then
|
elseif Config.General.PhoneType == "gks" then
|
||||||
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
|
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
|
||||||
['@citizenid'] = billed.PlayerData.citizenid,
|
['@citizenid'] = billed.citizenid,
|
||||||
['@amount'] = amount,
|
['@amount'] = amount,
|
||||||
['@society'] = biller.PlayerData.job.name,
|
['@society'] = biller.job,
|
||||||
['@sender'] = biller.PlayerData.charinfo.firstname,
|
['@sender'] = biller.firstname,
|
||||||
['@sendercitizenid'] = biller.PlayerData.citizenid,
|
['@sendercitizenid'] = biller.citizenid,
|
||||||
['@label'] = biller.PlayerData.job.label,
|
['@label'] = label,
|
||||||
})
|
})
|
||||||
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = Loc[Config.Lan].success["inv_succ"], 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' })
|
TriggerClientEvent('gksphone:notifi', billed.source, {title = 'Billing', message = Loc[Config.Lan].success["inv_recieved"], img= '/html/static/img/icons/logo.png' })
|
||||||
end
|
end
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
|
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.PlayerData.source)
|
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.source)
|
||||||
end
|
end
|
||||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
RegisterServerEvent(getScript()..":server:PayPopup", function(data)
|
||||||
local src = source
|
local src = source
|
||||||
local billed = Core.Functions.GetPlayer(src)
|
local billed = getPlayer(src)
|
||||||
local biller = Core.Functions.GetPlayer(tonumber(data.biller))
|
local biller = getPlayer(tonumber(data.biller))
|
||||||
local newdata = {
|
local newdata = {
|
||||||
senderCitizenId = biller.PlayerData.citizenid,
|
senderCitizenId = biller.citizenid,
|
||||||
society = data.gang and biller.PlayerData.gang.name or biller.PlayerData.job.name,
|
society = data.gang and biller.gang or biller.job,
|
||||||
amount = data.amount
|
amount = data.amount
|
||||||
}
|
}
|
||||||
if data.accept then
|
if data.accept then
|
||||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
chargePlayer(data.amount, data.billtype, src)
|
||||||
if Config.General.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
|
if Config.General.ApGov then
|
||||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
exports['ap-government']:chargeCityTax(billed.source, "Item", data.amount)
|
||||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
|
end
|
||||||
|
TriggerEvent(getScript()..":Tickets:Give", newdata, biller, data.gang)
|
||||||
|
triggerNotify(nil, billed.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
|
||||||
elseif not data.accept then
|
elseif not data.accept then
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["declined"], "error", src)
|
triggerNotify(nil, Loc[Config.Lan].success["declined"], "error", src)
|
||||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
|
triggerNotify(nil, billed.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang) local src = source
|
|
||||||
local billed = Core.Functions.GetPlayer(src) -- This should always be from the person who accepted the payment
|
|
||||||
local takecomm = math.floor(data.amount * Config.Receipts.Jobs[data.society].Commission)
|
|
||||||
if biller ~= nil then -- If this is found, it ISN'T a phone payment, so add money to society here
|
|
||||||
local billerGang, billerJob, amountChange, newAmount = tostring(biller.PlayerData.gang.name), tostring(biller.PlayerData.job.name), (data.amount - takecomm), 0
|
|
||||||
|
|
||||||
if gang then
|
|
||||||
if Config.General.Banking == "renewed" then
|
|
||||||
exports['Renewed-Banking']:addAccountMoney(billerGang, amountChange)
|
|
||||||
newAmount = exports['Renewed-Banking']:getAccountMoney(billerGang)
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "qb-management" or Config.General.Banking == "qb-banking" then
|
|
||||||
exports[Config.General.Banking]:AddGangMoney(billerGang, amountChange)
|
|
||||||
newAmount = exports[Config.General.Banking]:AddGangMoney(billerGang, amountChange)
|
|
||||||
if Config.General.Banking == "qb-banking" then newAmount = newAmount["account_balance"] end
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "fd" then
|
|
||||||
exports["fd_banking"]:AddGangMoney(billerGang, amountChange)
|
|
||||||
newAmount = exports["fd_banking"]:GetGangAccount(billerGang)
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "okok" then
|
|
||||||
exports['okokBanking']:AddMoney(billerGang, amountChange)
|
|
||||||
newAmount = exports['okokBanking']:GetAccount(billerGang)
|
|
||||||
end
|
|
||||||
elseif not gang then
|
|
||||||
if Config.General.Banking == "renewed" then
|
|
||||||
exports['Renewed-Banking']:addAccountMoney(billerJob, amountChange)
|
|
||||||
newAmount = exports['Renewed-Banking']:getAccountMoney(billerJob)
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "qb-management" or Config.General.Banking == "qb-banking" then
|
|
||||||
exports[Config.General.Banking]:AddMoney(billerJob, amountChange)
|
|
||||||
newAmount = exports[Config.General.Banking]:GetAccount(billerJob, amountChange)
|
|
||||||
if Config.General.Banking == "qb-banking" then newAmount = newAmount["account_balance"] end
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "fd" then
|
|
||||||
exports["fd_banking"]:AddMoney(billerJob, amountChange)
|
|
||||||
newAmount = exports["fd_banking"]:GetAccount(billerJob)
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "okok" then
|
|
||||||
exports['okokBanking']:AddMoney(billerJob, amountChange)
|
|
||||||
newAmount = exports['okokBanking']:GetAccount(billerJob)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
print("^5Debug^7: ^3"..Config.General.Banking.."^7(^3"..(gang and "Gang" or "Job").."^7): ^2Adding ^7$"..amountChange.." ^2to account ^7'^6"..(gang and billerGang or billerJob).."^7' ($"..newAmount..")")
|
|
||||||
if Config.System.Debug then
|
|
||||||
end
|
|
||||||
elseif not biller then --Find the biller from their citizenid
|
|
||||||
for _, v in pairs(Core.Functions.GetPlayers()) do
|
|
||||||
local Player = Core.Functions.GetPlayer(v)
|
|
||||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
|
||||||
end
|
|
||||||
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.PlayerData.source)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If ticket system enabled, do this
|
|
||||||
if (biller.PlayerData.job.onduty or gang) and Config.Receipts.TicketSystem then
|
|
||||||
if data.amount >= Config.Receipts.Jobs[data.society].MinAmountforTicket then
|
|
||||||
if Config.Receipts.TicketSystemAll then
|
|
||||||
for _, v in pairs(Core.Functions.GetPlayers()) do
|
|
||||||
local Player = Core.Functions.GetPlayer(v)
|
|
||||||
if Player ~= nil or Player ~= billed then
|
|
||||||
if gang then
|
|
||||||
if Player.PlayerData.gang.name == data.society then
|
|
||||||
TriggerEvent(GetCurrentResourceName()..":server:toggleItem", true, "payticket", 1, Player.PlayerData.source)
|
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
|
||||||
TriggerEvent(GetCurrentResourceName()..":server:toggleItem", true, "payticket", 1, Player.PlayerData.source)
|
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
TriggerEvent(GetCurrentResourceName()..":server:toggleItem", true, "payticket", 1, biller.PlayerData.source)
|
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Commission section, does each config option separately
|
|
||||||
local comm = tonumber(Config.Receipts.Jobs[data.society].Commission)
|
|
||||||
if Config.Receipts.Commission and comm ~= 0 then
|
|
||||||
if Config.Receipts.CommissionLimit and data.amount < Config.Receipts.Jobs[data.society].MinAmountforTicket then return end
|
|
||||||
if Config.Receipts.CommissionDouble then
|
|
||||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
|
||||||
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, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
|
|
||||||
end
|
|
||||||
if Config.Receipts.CommissionAll then
|
|
||||||
for _, v in pairs(Core.Functions.GetPlayers()) do
|
|
||||||
local Player = Core.Functions.GetPlayer(v)
|
|
||||||
if Player 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, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.PlayerData.source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
|
||||||
local Player = Core.Functions.GetPlayer(source)
|
|
||||||
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.Receipts.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
|
||||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
|
||||||
TriggerClientEvent('inventory:client:ItemBox', source, Core.Shared.Items['payticket'], "remove", tickets)
|
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', source)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if Config.Usebzzz then
|
if Config.General.Usebzzz then
|
||||||
Core.Functions.CreateUseableItem('terminal', function(source, item)
|
createUseableItem('terminal', function(source, item)
|
||||||
TriggerClientEvent("jim-payments:client:Charge", source, {}, true)
|
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
registerCommand("polcharge", { Loc[Config.Lan].command["charge"], {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end })
|
registerCommand("polcharge", {
|
||||||
|
Loc[Config.Lan].command["charge"], {}, false,
|
||||||
|
function(source)
|
||||||
|
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||||
local src = source
|
local src = source
|
||||||
local biller = Core.Functions.GetPlayer(src)
|
local biller = getPlayer(src)
|
||||||
local billed = Core.Functions.GetPlayer(tonumber(citizen))
|
local billed = getPlayer(tonumber(citizen))
|
||||||
local price = math.floor(tonumber(price))
|
local price = math.floor(tonumber(price))
|
||||||
|
|
||||||
local commPercent = Config.PolCharge.FineJobs[biller.PlayerData.job.name] and Config.PolCharge.FineJobs[biller.PlayerData.job.name].Commission or 0.25
|
local commPercent = Config.PolCharge.FineJobs[biller.job] and Config.PolCharge.FineJobs[biller.job].Commission or 0.25
|
||||||
if Config.PolCharge.FineJobs[biller.PlayerData.job.name] then
|
if Config.PolCharge.FineJobs[biller.job] then
|
||||||
commPercent = Config.PolCharge.FineJobs[biller.PlayerData.job.name].Commission
|
commPercent = Config.PolCharge.FineJobs[biller.job].Commission
|
||||||
else
|
else
|
||||||
commPercent = 0.25
|
commPercent = 0.25
|
||||||
print("Can't find job in 'FineJobs', defaulting to 0.25 (25% commission)")
|
print("Can't find job in 'FineJobs', defaulting to 0.25 (25% commission)")
|
||||||
@@ -22,22 +27,22 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
|||||||
billed = billed,
|
billed = billed,
|
||||||
price = price,
|
price = price,
|
||||||
commission = commission,
|
commission = commission,
|
||||||
billerJob = tostring(biller.PlayerData.job.name),
|
billerJob = tostring(biller.job),
|
||||||
amountChange = (price - commission)
|
amountChange = (price - commission)
|
||||||
})
|
})
|
||||||
|
|
||||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
|
triggerNotify(nil, billed.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
|
||||||
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.PlayerData.source)
|
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.source)
|
||||||
else
|
else
|
||||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label, commPercent)
|
TriggerClientEvent(getScript()..":client:PolPopup", billed.source, price, src, biller.job, commPercent)
|
||||||
end
|
end
|
||||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
RegisterServerEvent(getScript()..":server:PolPopup", function(data)
|
||||||
local src = source
|
local src = source
|
||||||
local billed = Core.Functions.GetPlayer(src)
|
local billed = getPlayer(src)
|
||||||
local biller = Core.Functions.GetPlayer(tonumber(data.biller))
|
local biller = getPlayer(tonumber(data.biller))
|
||||||
local price = math.floor(data.amount)
|
local price = math.floor(data.amount)
|
||||||
local commission = math.floor(tonumber(data.amount) * data.commPercent)
|
local commission = math.floor(tonumber(data.amount) * data.commPercent)
|
||||||
if data.accept then
|
if data.accept then
|
||||||
@@ -46,7 +51,7 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
|||||||
billed = billed,
|
billed = billed,
|
||||||
price = price,
|
price = price,
|
||||||
commission = commission,
|
commission = commission,
|
||||||
billerJob = tostring(biller.PlayerData.job.name),
|
billerJob = tostring(biller.job),
|
||||||
amountChange = (price - commission)
|
amountChange = (price - commission)
|
||||||
})
|
})
|
||||||
elseif not data.accept then
|
elseif not data.accept then
|
||||||
@@ -56,36 +61,43 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function polCharge(data)
|
function polCharge(data)
|
||||||
local billedSource, billerSource, newAmount = data.billed.PlayerData.source, data.biller.PlayerData.source, 0
|
local billedSource, billerSource, newAmount = data.billed.source, data.biller.source, 0
|
||||||
if data.billed.Functions.RemoveMoney("bank", data.price) then
|
local bankScript = nil
|
||||||
if Config.System.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billedSource.."^7) ^2charged ^7$^6"..data.price.."^7") end
|
|
||||||
end
|
chargePlayer(data.price, "bank", billedSource)
|
||||||
if Config.ApGov then exports['ap-government']:chargeCityTax(billedSource, "Item", data.price) end
|
debugPrint("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billedSource.."^7) ^2charged ^7$^6"..data.price.."^7")
|
||||||
if data.biller.Functions.AddMoney("bank", data.commission) then
|
|
||||||
if Config.System.Debug then
|
if Config.ApGov then
|
||||||
print("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..data.commission.." ^2sent to Player^7(^6"..billerSource.."^7)")
|
exports['ap-government']:chargeCityTax(billedSource, "Item", data.price)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if Config.General.Banking == "renewed" then
|
fundPlayer(data.commission, "bank", billerSource)
|
||||||
exports['Renewed-Banking']:addAccountMoney(data.billerJob, data.amountChange)
|
debugPrint("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..data.commission.." ^2sent to Player^7(^6"..billerSource.."^7)")
|
||||||
newAmount = exports['Renewed-Banking']:getAccountMoney(data.billerJob)
|
|
||||||
|
|
||||||
elseif Config.General.Banking == "qb-management" or Config.General.Banking == "qb-banking" then
|
if isStarted("Renewed-Banking") then
|
||||||
exports[Config.General.Banking]:AddMoney(data.billerJob, data.amountChange)
|
bankScript = "Renewed-Banking"
|
||||||
newAmount = exports[Config.General.Banking]:GetAccount(data.billerJob)
|
exports["Renewed-Banking"]:addAccountMoney(data.billerJob, data.amountChange)
|
||||||
if Config.General.Banking == "qb-banking" then newAmount = newAmount.account_balance end
|
newAmount = exports["Renewed-Banking"]:getAccountMoney(data.billerJob)
|
||||||
|
|
||||||
elseif Config.General.Banking == "fd" then
|
elseif isStarted("qb-banking") then
|
||||||
|
bankScript = "qb-banking"
|
||||||
|
exports["qb-banking"]:AddMoney(data.billerJob, data.amountChange, "Cash Register Payment")
|
||||||
|
newAmount = exports["qb-banking"]:GetAccountBalance(data.billerJob)
|
||||||
|
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
bankScript = "fd_banking"
|
||||||
|
if gang then
|
||||||
|
exports["fd_banking"]:AddGangMoney(data.billerJob, data.amountChange)
|
||||||
|
newAmount = exports["fd_banking"]:GetGangAccount(data.billerJob)
|
||||||
|
else
|
||||||
exports["fd_banking"]:AddMoney(data.billerJob, data.amountChange)
|
exports["fd_banking"]:AddMoney(data.billerJob, data.amountChange)
|
||||||
newAmount = exports["fd_banking"]:GetAccount(data.billerJob)
|
newAmount = exports["fd_banking"]:GetAccount(data.billerJob)
|
||||||
|
end
|
||||||
elseif Config.General.Banking == "okok" then
|
elseif isStarted("okokBanking") then
|
||||||
|
bankScript = "okokBanking"
|
||||||
exports['okokBanking']:AddMoney(data.billerJob, data.amountChange)
|
exports['okokBanking']:AddMoney(data.billerJob, data.amountChange)
|
||||||
newAmount = exports['okokBanking']:GetAccount(data.billerJob)
|
newAmount = exports['okokBanking']:GetAccount(data.billerJob)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Adding ^7$"..data.amountChange.." ^2to account ^7'^6"..data.billerJob.."^7' ($"..newAmount..")")
|
||||||
if Config.System.Debug then
|
|
||||||
print("^5Debug^7: ^3"..Config.General.Banking.."^7(^3Job^7): ^2Adding ^7$"..data.amountChange.." ^2to account ^7'^6"..data.billerJob.."^7' ($"..newAmount..")")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
120
server/ticketserver.lua
Normal file
120
server/ticketserver.lua
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
|
||||||
|
local src = source
|
||||||
|
local activePlayers = GetPlayers()
|
||||||
|
local commPercent = 0
|
||||||
|
jsonPrint(data)
|
||||||
|
if Config.Receipts.Jobs[data.society] then
|
||||||
|
commPercent = Config.Receipts.Jobs[data.society].Commission
|
||||||
|
else commPercent = 0.25
|
||||||
|
print("^1Error^7: ^2Can't find job in ^7'^3Config^7.^3Receipts^7.^3Jobs^7', ^2defaulting to 0.25 (25% commission)^7")
|
||||||
|
end
|
||||||
|
local takecomm = math.floor(data.amount * commPercent)
|
||||||
|
|
||||||
|
if biller ~= nil then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||||
|
local amountChange, newAmount = (data.amount - takecomm), 0
|
||||||
|
local society = gang and tostring(biller.gang) or tostring(biller.job)
|
||||||
|
local bankScript = nil
|
||||||
|
if isStarted("Renewed-Banking") then
|
||||||
|
bankScript = "Renewed-Banking"
|
||||||
|
exports["Renewed-Banking"]:addAccountMoney(society, amountChange)
|
||||||
|
newAmount = exports["Renewed-Banking"]:getAccountMoney(society)
|
||||||
|
|
||||||
|
elseif isStarted("qb-banking") then
|
||||||
|
bankScript = "qb-banking"
|
||||||
|
exports["qb-banking"]:AddMoney(society, amountChange, "Cash Register Payment")
|
||||||
|
newAmount = exports["qb-banking"]:GetAccountBalance(society)
|
||||||
|
|
||||||
|
elseif isStarted("fd_banking") then
|
||||||
|
bankScript = "fd_banking"
|
||||||
|
if gang then
|
||||||
|
exports["fd_banking"]:AddGangMoney(society, amountChange)
|
||||||
|
newAmount = exports["fd_banking"]:GetGangAccount(society)
|
||||||
|
else
|
||||||
|
exports["fd_banking"]:AddMoney(society, amountChange)
|
||||||
|
newAmount = exports["fd_banking"]:GetAccount(society)
|
||||||
|
end
|
||||||
|
elseif isStarted("okokBanking") then
|
||||||
|
bankScript = "okokBanking"
|
||||||
|
exports['okokBanking']:AddMoney(society, amountChange)
|
||||||
|
newAmount = exports['okokBanking']:GetAccount(society)
|
||||||
|
end
|
||||||
|
|
||||||
|
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3"..(gang and "Gang" or "Job").."^7): ^2Adding ^7$"..amountChange.." ^2to account ^7'^6"..society.."^7' ($"..newAmount..")")
|
||||||
|
elseif not biller then --Find the biller from their citizenid
|
||||||
|
for _, v in pairs(activePlayers) do
|
||||||
|
local Player = getPlayer(v)
|
||||||
|
if Player.citizenid == data.senderCitizenId then
|
||||||
|
biller = Player
|
||||||
|
end
|
||||||
|
end
|
||||||
|
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.source)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If ticket system enabled, do this
|
||||||
|
if (biller.onDuty or gang) and Config.Receipts.TicketSystem then
|
||||||
|
if data.amount >= Config.Receipts.Jobs[data.society].MinAmountforTicket then
|
||||||
|
if Config.Receipts.TicketSystemAll then
|
||||||
|
for _, v in pairs(activePlayers) do
|
||||||
|
local Player = getPlayer(v)
|
||||||
|
if v ~= src then
|
||||||
|
if gang then
|
||||||
|
if Player.gang == data.society then
|
||||||
|
addItem("payticket", 1, nil, Player.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.source)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("player found")
|
||||||
|
if Player.job == data.society and Player.onDuty then
|
||||||
|
print("player on duty, giving tickets")
|
||||||
|
addItem("payticket", 1, nil, Player.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
addItem("payticket", 1, nil, biller.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Commission section, does each config option separately
|
||||||
|
local comm = tonumber(Config.Receipts.Jobs[data.society].Commission)
|
||||||
|
if Config.Receipts.Commission and comm ~= 0 then
|
||||||
|
if Config.Receipts.CommissionLimit and data.amount < Config.Receipts.Jobs[data.society].MinAmountforTicket then return end
|
||||||
|
if Config.Receipts.CommissionDouble then
|
||||||
|
fundPlayer(math.floor(tonumber(data.amount) * (comm *2)), "bank", biller.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * (comm *2))..Loc[Config.Lan].success["commission"], "success", biller.source)
|
||||||
|
else
|
||||||
|
fundPlayer(math.floor(tonumber(data.amount) *comm), "bank", biller.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.source)
|
||||||
|
end
|
||||||
|
if Config.Receipts.CommissionAll then
|
||||||
|
for _, v in pairs(activePlayers) do
|
||||||
|
local Player = getPlayer(v)
|
||||||
|
if v ~= biller.source then
|
||||||
|
if Player.job == data.society and Player.onDuty then
|
||||||
|
fundPlayer(math.floor(tonumber(data.amount) * comm), "bank", Player.source)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterServerEvent(getScript()..":Tickets:Sell", function() local src = source
|
||||||
|
local Player = getPlayer(src)
|
||||||
|
local hasItem, hasTable = hasItem("payticket", 1, src)
|
||||||
|
if not hasItem then
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].error["no_ticket_to"], 'error', src)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
local tickets = hasTable["payticket"].count
|
||||||
|
removeItem("payticket", tickets, src)
|
||||||
|
local pay = (tickets * Config.Receipts.Jobs[Player.job].PayPerTicket)
|
||||||
|
fundPlayer(pay, "bank", src)
|
||||||
|
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', src)
|
||||||
|
end
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user