diff --git a/atms.lua b/atms.lua
index c80bfd7..a33a9b5 100644
--- a/atms.lua
+++ b/atms.lua
@@ -21,10 +21,12 @@ local function cv(amount)
return formatted
end
+local function loadModel(model) if Config.Debug then print("Debug: Loading Model: '"..model.."'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end
+local function unloadModel(model) if Config.Debug then print("Debug: Removing Model: '"..model.."'") end SetModelAsNoLongerNeeded(model) end
+
local bossroles = {}
local gangroles = {}
CreateThread(function()
- if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
if Config.useATM then
if Config.ATMBlips then
for k, v in pairs(Config.WallATMLocations) do
@@ -38,7 +40,7 @@ CreateThread(function()
AddTextComponentString("ATM")
EndTextCommandSetBlipName(blip)
end
- for k, v in pairs(ATMLoc) do
+ for k, v in pairs(Config.ATMLocations) do
blip = AddBlipForCoord(v)
SetBlipSprite(blip, 108)
SetBlipDisplay(blip, 4)
@@ -53,7 +55,7 @@ CreateThread(function()
end
if Config.useBanks then
if Config.BankBlips then
- for k,v in pairs(BankLoc) do
+ for k,v in pairs(Config.BankLocations) do
for l, b in pairs(v) do
blip = AddBlipForCoord(b)
SetBlipSprite(blip, 108)
@@ -75,14 +77,14 @@ CreateThread(function()
for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss
if bossroles[tostring(k)] ~= nil then -- checks if the line exists
- if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the
+ if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the
else bossroles[tostring(k)] = tonumber(l)
end
end
end
end
end
- for k, v in pairs(QBCore.Shared.Gangs) do
+ for k, v in pairs(QBCore.Shared.Gangs) do
if QBCore.Shared.Gangs[tostring(k)] then
for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do
if tostring(k) ~= "none" then
@@ -92,7 +94,7 @@ CreateThread(function()
else gangroles[tostring(k)] = tonumber(l)
end
end
- end
+ end
end
end
end
@@ -101,38 +103,38 @@ CreateThread(function()
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
for k,v in pairs(Config.WallATMLocations) do
Targets["jimwallatm"..k] =
- exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
+ exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
}, distance = 1.5 })
end
- for k,v in pairs(ATMLoc) do
+ for k,v in pairs(Config.ATMLocations) do
Targets["jimatm"..k] =
- exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
+ exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
}, distance = 1.5 })
end
end
if Config.useBanks then
- for k,v in pairs(BankLoc) do
+ for k,v in pairs(Config.BankLocations) do
for l, b in pairs(v) do
Targets["jimbank"..k..l] =
- exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
+ exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" },
-
+
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Access Society Account", id = "society", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
-
+
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Gang Society Account", id = "gang", gang = gangroles },
- { event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
+ { event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
distance = 2.5 })
if Config.Peds then
local i = math.random(1, #Config.PedPool)
- RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
- if Peds["jimbank"..k..l] == nil then Peds["jimbank"..k..l] = CreatePed(0, Config.PedPool[i], vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)), b[4], false, false) end
+ loadModel(Config.PedPool[i])
+ if Peds["jimbank"..k..l] == nil then Peds["jimbank"..k..l] = CreatePed(0, Config.PedPool[i], vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)-1.03), b[4], false, false) end
if Config.Debug then print("Ped Created - 'jimbank"..k..l.."'") end
end
end
@@ -163,14 +165,14 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb) p:resolve(cb) end) local info = Citizen.Await(p)
local society local gsociety local cancelled = false
if Config.Manage then
- society = GrabAccount("GetAccount", PlayerJob.name)
+ society = GrabAccount("GetAccount", PlayerJob.name)
Wait(200)
gsociety = GrabAccount("GetGangAccount", PlayerGang.name)
else
local p = promise.new()
- QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) society = Citizen.Await(p)
+ QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) society = Citizen.Await(p)
local p2 = promise.new()
- QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) gsociety = Citizen.Await(p2)
+ QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) gsociety = Citizen.Await(p2)
end
local atmbartime = 2500
local setoptions = {}
@@ -211,8 +213,8 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
-
+ end, data.icon)
+
elseif data.id == "transfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."
- Account -
"..info.account.."
"..info.cid.."
- Balances -
🏦Bank - $"..cv(info.bank).."
- Options -"
@@ -225,21 +227,21 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
+ end, data.icon)
elseif data.id == "savings" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..info.name.."
- Account Info -
Savings ID: "..info.aid.."
"..info.cid.."
- Balances -
💰Savings - $"..cv(info.savbal).."
🏦Bank - $"..cv(info.bank).."
- Options -"
setheader = "💰 Savings 💰"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
- { type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
+ { type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
PlayATMAnimation('enter')
QBCore.Functions.Progressbar("accessing_atm", "Accessing Savings", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
-
+ end, data.icon)
+
elseif data.id == "society" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..info.name.."
- Society Account -
"..PlayerJob.label.."
- Balances -
🏢"..PlayerJob.label.." - $"..cv(society).."
🏦Bank - $"..cv(info.bank).."
- Options -"
@@ -251,8 +253,8 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
-
+ end, data.icon)
+
elseif data.id == "societytransfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."
- Society Account -
"..PlayerJob.label.."
- Balances -
🏢"..PlayerJob.label.." - $"..cv(society).."
- Options -"
@@ -265,8 +267,8 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
-
+ end, data.icon)
+
elseif data.id == "gang" then
setheader = "🏢 Society Banking 🏢"
setview = "Welcome back, "..info.name.."
- Society Account -
"..PlayerGang.label.."
- Balances -
🏢"..PlayerGang.label.." - $"..cv(gsociety).."
🏦Bank - $"..cv(info.bank).."
- Options -"
@@ -278,8 +280,8 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
-
+ end, data.icon)
+
elseif data.id == "gangtransfer" then
setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..info.name.."
- Society Account -
"..PlayerGang.label.."
- Balances -
🏢"..PlayerGang.label.." - $"..cv(gsociety).."
- Options -"
@@ -289,13 +291,13 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
PlayATMAnimation('enter')
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
-
+
end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
cancelled = true
- end, data.icon)
+ end, data.icon)
end
-
+
Wait(atmbartime+500)
if not cancelled then
cancelled = false
@@ -327,7 +329,7 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
inputs = {
- { text = " ", name = "citizen", type = "select", options = nearbyList },
+ { text = " ", name = "citizen", type = "select", options = nearbyList },
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Pay' }, }
})
if dialog then
@@ -338,6 +340,6 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
end)
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
- for k, v in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
- for k, v in pairs(Peds) do DeletePed(Peds[k]) end
+ for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
+ for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
end)
\ No newline at end of file
diff --git a/client.lua b/client.lua
index 4d27da3..527ae01 100644
--- a/client.lua
+++ b/client.lua
@@ -1,8 +1,11 @@
local QBCore = exports['qb-core']:GetCoreObject()
PlayerJob = {}
+PlayerGang = {}
+
local onDuty = false
-local BankPed = {}
+local BankPed = nil
+
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() QBCore.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)
@@ -10,53 +13,70 @@ RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = G
--Keeps track of duty on script restarts
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
- QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end)
+ QBCore.Functions.GetPlayerData(function(PlayerData)
+ PlayerJob = PlayerData.job
+ PlayerGang = PlayerData.gang
+ onDuty = PlayerJob.onduty
+ end)
end)
+local function loadModel(model) if Config.Debug then print("Debug: Loading Model: '"..model.."'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end
+local function unloadModel(model) if Config.Debug then print("Debug: Removing Model: '"..model.."'") end SetModelAsNoLongerNeeded(model) end
+
CreateThread(function()
- local jobroles = {}
- local gangroles = {}
+ local jobroles = {} local gangroles = {}
+ --Build Job/Gang Checks for cashin location
for k, v in pairs(Config.Jobs) do if v.gang then gangroles[tostring(k)] = 0 else jobroles[tostring(k)] = 0 end end
- exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
- { options = {
+ --Create Target at location
+ exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
+ { options = {
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Job Receipts", job = jobroles, },
- { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Gang Receipts", gang = gangroles, } },
+ { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Gang Receipts", gang = gangroles, } },
distance = 2.0 })
+ --Crete Ped at the location
if Config.Peds then
local i = math.random(1, #Config.PedPool)
- RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
- if not BankPed[1] then BankPed[1] = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
+ loadModel(Config.PedPool[i])
+ if not BankPed then BankPed = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
if Config.Debug then print("Ped Created for Ticket Trade") end
end
end)
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
- if outside == nil then outside = false end
- if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
- local onlineList = {}
- local nearbyList = {}
- local p = promise.new()
- QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
- onlineList = Citizen.Await(p)
- for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
- local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
- for i = 1, #onlineList do
- if onlineList[i].value == GetPlayerServerId(v) then
- if v ~= PlayerId() or Config.Debug then
- nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
+ --Check if player is using /cashregister command
+ if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
+ local newinputs = {} -- Begin qb-input creation here.
+ if Config.List then -- If nearby player list is wanted:
+ --Retrieve a list of nearby players from server
+ local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
+ local onlineList = Citizen.Await(p)
+ local nearbyList = {}
+ --Convert list of players nearby into one qb-input understands + add distance info
+ for _, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
+ local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
+ for i = 1, #onlineList do
+ if onlineList[i].value == GetPlayerServerId(v) then
+ if v ~= PlayerId() or Config.Debug then
+ nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
+ end
end
end
end
- dist = nil
+ --If list is empty(no one nearby) show error and stop
+ if not nearbyList[#nearbyList] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
+ newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
+ else -- If Config.List is false, create input text box for ID's
+ newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
end
- if not data.img then img = "" else img = data.img end
- if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
- local newinputs = {}
- if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
- if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
+ --Check if image was given when opening the regsiter
+ local img = data.img or ""
+ --Continue adding payment options to qb-input
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
- if data.job then label = PlayerJob.label gang = false elseif data.gang then label = PlayerGang.label gang = true end
+ --Grab Player Job name or Gang Name if needed
+ local label = PlayerJob.label
+ local gang = false
+ if data.gang then label = PlayerGang.label gang = true end
local dialog = exports['qb-input']:ShowInput({ header = img..label.." Cash Register", submitText = "Send", inputs = newinputs})
if dialog then
if not dialog.citizen or not dialog.price then return end
@@ -64,48 +84,91 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
end
end)
-RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
- local amount = 0
- local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
- if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
- local sellable = false
- local name = "" local label = ""
- for k, v in pairs(Config.Jobs) do
- if data.gang then
- if v.gang and k == PlayerGang.name then
- name = k
- label = PlayerGang.label
- sellable = true
- end
- else
- if not v.gang and k == PlayerJob.name then
- name = k
- label = PlayerJob.label
- sellable = true
+RegisterNetEvent('jim-payments:client:PolCharge', function()
+ --Check if player is allowed to use /cashregister command
+ local allowed = false
+ for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
+ if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
+
+ local newinputs = {} -- Begin qb-input creation here.
+ if Config.FineJobList then -- If nearby player list is wanted:
+ --Retrieve a list of nearby players from server
+ local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
+ local onlineList = Citizen.Await(p)
+ local nearbyList = {}
+ --Convert list of players nearby into one qb-input understands + add distance info
+ for _, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
+ local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
+ for i = 1, #onlineList do
+ if onlineList[i].value == GetPlayerServerId(v) then
+ if v ~= PlayerId() or Config.Debug then
+ nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
+ end
+ end
end
end
- if sellable then
+ --If list is empty(no one nearby) show error and stop
+ if not nearbyList[#nearbyList] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
+ newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
+ else -- If Config.List is false, create input text box for ID's
+ newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
+ end
+ --Continue adding payment options to qb-input
+ newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
+ --Grab Player Job name or Gang Name if needed
+ local label = PlayerJob.label
+ local gang = false
+ local dialog = exports['qb-input']:ShowInput({ header = label.." Charge", submitText = "Send", inputs = newinputs})
+ if dialog then
+ if not dialog.citizen or not dialog.price then return end
+ TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
+ end
+end)
+
+
+RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
+ --Get ticket info
+ local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
+ local amount = Citizen.Await(p)
+ if amount == 0 then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
+ local sellable = false
+ local name = "" local label = ""
+ --Check/adjust for job/gang names
+ for k, v in pairs(Config.Jobs) do
+ if data.gang then if v.gang and k == PlayerGang.name then name = k label = PlayerGang.label sellable = true end
+ else if not v.gang and k == PlayerJob.name then name = k label = PlayerJob.label sellable = true end
+ end
+ if sellable then -- if info is found then:
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."
Total Payment: $"..(Config.Jobs[name].PayPerTicket * amount) },
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
- { icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, })
+ { icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
+ })
end
end
end)
-RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang)
- if not img then img = "" end
+RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
+ local img = img or ""
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
- { icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang } } },
- { icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
+ { icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
+ { icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
+end)
+
+RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
+ exports['qb-menu']:openMenu({
+ { isMenuHeader = true, header = "🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the charge?" },
+ { isMenuHeader = true, header = "", txt = "Bank Charge: $"..amount },
+ { icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
+ { icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
end)
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
- exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed[1])
+ exports['qb-target']:RemoveZone("JimBank") unloadModel(GetEntityModel(BankPed)) DeletePed(BankPed)
end)
\ No newline at end of file
diff --git a/config.lua b/config.lua
index f277cb3..4d7ece2 100644
--- a/config.lua
+++ b/config.lua
@@ -1,223 +1,227 @@
-print("Jim-Payments v2.6 - Payments Script by Jimathy")
+print("Jim-Payments v2.7 - Payments Script by Jimathy")
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
-- https://discord.gg/xKgQZ6wZvS
-Config = {}
+Config = {
+ Debug = true,
+ Manage = true, -- "true" if using qb-management
+ -- "false" if using qb-bossmenu
+ TicketSystem = true, -- Enable this if you want to use the ticket system false
-Config.Debug = false
+ List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
+ PaymentRadius = 30, -- This is how far the playerlist will check for nearby players (based on the person charging)
-Config.Manage = true -- "true" if using qb-management
- -- "false" if using qb-bossmenu
-
-Config.TicketSystem = true -- Enable this if you want to use the ticket system false
+ Peds = true, -- "true" to enable peds spawning in banks
+ PedPool = {
+ `IG_Bankman`,
+ `U_M_M_BankMan`,
+ `S_F_M_Shop_HIGH`,
+ `S_M_M_HighSec_02`,
+ `S_M_M_HighSec_03`,
+ `S_M_M_HighSec_04`,
+ `A_F_Y_Business_01`,
+ `A_F_Y_Business_02`,
+ `A_F_Y_Business_03`,
+ `A_F_Y_Business_04`,
+ `A_M_M_Business_01`,
+ `A_M_Y_Business_02`,
+ `A_M_Y_Business_03`,
+ `U_F_M_CasinoShop_01`,
+ },
+ useATM = true, -- Enable this to use the scripts ATM's and controls
+ useBanks = true, -- Enable this to use my banking stuff
+ BankBlips = true, -- Enable this if you disabled qb-banking and need bank locations
+ ATMBlips = false, -- Enable this if you are a pyscho and need every ATM to be on the map too
-Config.List = true -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
-Config.PaymentRadius = 30 -- This is how far the playerlist will check for nearby players (based on the person charging)
-
-Config.Peds = true -- "true" to enable peds spawning in banks
-Config.PedPool = {
- [1] = `IG_Bankman`,
- [2] = `U_M_M_BankMan`,
- [3] = `S_F_M_Shop_HIGH`,
- [4] = `S_M_M_HighSec_02`,
- [5] = `S_M_M_HighSec_03`,
- [6] = `S_M_M_HighSec_04`,
- [7] = `A_F_Y_Business_01`,
- [8] = `A_F_Y_Business_02`,
- [9] = `A_F_Y_Business_03`,
- [10] = `A_F_Y_Business_04`,
- [11] = `A_M_M_Business_01`,
- [12] = `A_M_Y_Business_02`,
- [13] = `A_M_Y_Business_03`,
- [14] = `U_F_M_CasinoShop_01`,
-}
-
-Config.Gabz = true -- "true" to enable Gabz Banking locations
-Config.useATM = true -- Enable this to use my ATM's
-Config.useBanks = true -- Enable this to use my banking stuff
-Config.BankBlips = true -- Enable this if you disabled qb-banking and need bank locations
-Config.ATMBlips = false -- Enable this if you are a pyscho and need every ATM to be on the map too
-
-Config.PhoneBank = true -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
+ PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
-- This doesn't affect Cash payments as they by default use confirmation now
-- This is helpful for phones that don't support invoices well
-
-Config.PhoneType = "qb" -- Change this setting to make invoices work with your phone script [still testing this currently]
+
+ PhoneType = "qb", -- Change this setting to make invoices work with your phone script [still testing this currently]
-- "qb" for qb-phone
-- "gks"" for GKSPhone
-Config.Commission = true -- Set this to true to enable Commissions and give the person charging a percentage of the total
-Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
-Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
-Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
+ CashInLocation = vector4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
--- MinAmountforTicket should be your cheapest item
--- PayPerTicket should never be higher than MinAmountforTicket
--- Commission is a percentage eg "0.10" becomes 10%
+ Commission = true, -- Set this to true to enable Commissions and give the person charging a percentage of the total
+ CommissionAll = false, -- Set this to true to give commission to workers clocked in
+ CommissionDouble = false, -- Set this to true if you want the person charging to get double Commission
+ CommissionLimit = false, -- If true, this limits the Commission to only be given if over the "MinAmountForTicket".
+ -- If false, Commission will be given for any amount
-Config.CashInLocation = vector4(252.23, 223.11, 106.29, 159.2) -- Default Third Window along in Pacific Bank
-if Config.Gabz then Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0) end -- Middle along in Pacific Bank (Gabz)
+ Gabz = true, -- "true" to enable Gabz Bank locations
-Config.Jobs = {
- ['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10,},
- ['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['pizzathis'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['popsdiner'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
- ['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
- ['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true },
-}
-
-Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
-
-Config.GabzATMLocations = {
---PACIFIC BANK 12 ATMS (GABZ)
- vector3(239.02, 212.37, 106.28),
- vector3(239.46, 213.6, 106.28),
- vector3(239.9, 214.82, 106.28),
- vector3(240.35, 216.03, 106.28),
- vector3(241.42, 218.96, 106.28),
- vector3(241.86, 220.16, 106.28),
- vector3(242.3, 221.41, 106.28),
- vector3(242.76, 222.63, 106.28),
- vector3(263.46, 203.86, 106.28),
- vector3(263.96, 205.03, 106.28),
- vector3(264.37, 206.28, 106.28),
- vector3(264.77, 207.51, 106.28),
-}
-
-Config.VanATMLocations = {
---PACIFIC BANK 10 ATMS
- vector3(265.9, 213.86, 106.28),
- vector3(265.56, 212.98, 106.28),
- vector3(265.19, 211.91, 106.28),
- vector3(264.86, 211.03, 106.28),
- vector3(264.52, 210.06, 106.28),
- vector3(236.64, 219.72, 106.29),
- vector3(237.04, 218.72, 106.29),
- vector3(237.5, 217.87, 106.29),
- vector3(237.93, 216.94, 106.29),
- vector3(238.36, 216.03, 106.29),
-}
-
---QB-Target doesn't seem to like ALL ATM Props so need to manually add locations
-Config.WallATMLocations = {
- vector3(-386.54, 6046.29, 31.5),
- vector3(-282.82, 6226.24, 31.49),
- vector3(-132.74, 6366.79, 31.48),
- vector3(-95.76, 6457.41, 31.46),
- vector3(-97.52, 6455.65, 31.47),
- vector3(155.95, 6642.99, 31.6),
- vector3(173.92, 6638.16, 31.57),
- vector3(2558.65, 350.92, 108.62),
- vector3(1077.78, -776.64, 58.35),
- vector3(1138.14, -468.88, 66.73),
- vector3(1166.93, -455.96, 66.81),
- vector3(285.37, 143.07, 104.17),
- vector3(-165.43, 234.81, 94.92),
- vector3(-165.4, 232.73, 94.92),
- vector3(-1410.41, -98.76, 52.43),
- vector3(-1409.85, -100.51, 52.38),
- vector3(-1206.0, -324.94, 37.86),
- vector3(-1205.23, -326.55, 37.86),
- vector3(-2072.28, -317.27, 13.32),
- vector3(-2974.7, 380.15, 15.0),
- vector3(-2959.01, 487.45, 15.46),
- vector3(-2956.87, 487.36, 15.46),
- vector3(-3043.98, 594.32, 7.74),
- vector3(-3241.35, 997.74, 12.55),
- vector3(-1305.59, -706.64, 25.32),
- vector3(-537.85, -854.69, 29.28),
- vector3(-709.98, -818.71, 23.73),
- vector3(-712.87, -818.71, 23.73),
- vector3(-526.71, -1223.18, 18.45),
- vector3(-256.47, -715.94, 33.55),
- vector3(-259.13, -723.29, 33.54),
- vector3(-203.82, -861.3, 30.27),
- vector3(111.38, -774.96, 31.44),
- vector3(114.56, -776.13, 31.42),
- vector3(112.46, -819.65, 31.34),
- vector3(118.93, -883.68, 31.12),
- vector3(-846.97, -340.29, 38.68),
- vector3(-846.41, -341.41, 38.68),
- vector3(-262.21, -2012.17, 30.15),
- vector3(-273.23, -2024.32, 30.15),
- vector3(24.46, -945.94, 29.36),
- vector3(-254.48, -692.74, 33.61),
- vector3(-1569.95, -546.94, 34.96),
- vector3(-1570.91, -547.63, 34.96),
- vector3(289.14, -1282.29, 29.6),
- vector3(289.18, -1256.84, 29.44),
- vector3(296.04, -896.22, 29.24),
- vector3(296.74, -894.26, 29.24),
- vector3(-301.63, -829.73, 32.43),
- vector3(-303.23, -829.44, 32.43),
- vector3(5.27, -919.87, 29.56),
- vector3(-1200.61, -885.62, 13.26),
-}
-
-Config.VanBankLocations = {
- ["legion"] = {
- vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
+ -- MinAmountforTicket should be your cheapest item
+ -- PayPerTicket should never be higher than MinAmountforTicket
+ -- Commission is a percentage eg "0.10" becomes 10%
+ Jobs = {
+ ['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10, },
+ ['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['pizzathis'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['popsdiner'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
+ ['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
+ ['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true, },
},
- ["hawick"] = {
- vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
+
+ -- The /polcharge command requires specific jobs to be set
+ -- No tickets for these, it's just commission
+ FineJobs = {
+ ['police'] = { Commission = 0.25, },
+ ['ambulance'] = { Commission = 0.25, },
},
- ["vinewood"] = {
- vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
+ FineJobConfirmation = true, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
+ FineJobList = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
+
+ ATMModels = { "prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" },
+
+ ATMLocations = {
+ --PACIFIC BANK 10 ATMS
+ vector3(265.9, 213.86, 106.28),
+ vector3(265.56, 212.98, 106.28),
+ vector3(265.19, 211.91, 106.28),
+ vector3(264.86, 211.03, 106.28),
+ vector3(264.52, 210.06, 106.28),
+ vector3(236.64, 219.72, 106.29),
+ vector3(237.04, 218.72, 106.29),
+ vector3(237.5, 217.87, 106.29),
+ vector3(237.93, 216.94, 106.29),
+ vector3(238.36, 216.03, 106.29),
},
- ["delperro"] = {
- vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
+ --QB-Target doesn't seem to like ALL ATM Props so need to manually add locations
+ WallATMLocations = {
+ vector3(-386.54, 6046.29, 31.5),
+ vector3(-282.82, 6226.24, 31.49),
+ vector3(-132.74, 6366.79, 31.48),
+ vector3(-95.76, 6457.41, 31.46),
+ vector3(-97.52, 6455.65, 31.47),
+ vector3(155.95, 6642.99, 31.6),
+ vector3(173.92, 6638.16, 31.57),
+ vector3(2558.65, 350.92, 108.62),
+ vector3(1077.78, -776.64, 58.35),
+ vector3(1138.14, -468.88, 66.73),
+ vector3(1166.93, -455.96, 66.81),
+ vector3(285.37, 143.07, 104.17),
+ vector3(-165.43, 234.81, 94.92),
+ vector3(-165.4, 232.73, 94.92),
+ vector3(-1410.41, -98.76, 52.43),
+ vector3(-1409.85, -100.51, 52.38),
+ vector3(-1206.0, -324.94, 37.86),
+ vector3(-1205.23, -326.55, 37.86),
+ vector3(-2072.28, -317.27, 13.32),
+ vector3(-2974.7, 380.15, 15.0),
+ vector3(-2959.01, 487.45, 15.46),
+ vector3(-2956.87, 487.36, 15.46),
+ vector3(-3043.98, 594.32, 7.74),
+ vector3(-3241.35, 997.74, 12.55),
+ vector3(-1305.59, -706.64, 25.32),
+ vector3(-537.85, -854.69, 29.28),
+ vector3(-709.98, -818.71, 23.73),
+ vector3(-712.87, -818.71, 23.73),
+ vector3(-526.71, -1223.18, 18.45),
+ vector3(-256.47, -715.94, 33.55),
+ vector3(-259.13, -723.29, 33.54),
+ vector3(-203.82, -861.3, 30.27),
+ vector3(111.38, -774.96, 31.44),
+ vector3(114.56, -776.13, 31.42),
+ vector3(112.46, -819.65, 31.34),
+ vector3(118.93, -883.68, 31.12),
+ vector3(-846.97, -340.29, 38.68),
+ vector3(-846.41, -341.41, 38.68),
+ vector3(-262.21, -2012.17, 30.15),
+ vector3(-273.23, -2024.32, 30.15),
+ vector3(24.46, -945.94, 29.36),
+ vector3(-254.48, -692.74, 33.61),
+ vector3(-1569.95, -546.94, 34.96),
+ vector3(-1570.91, -547.63, 34.96),
+ vector3(289.14, -1282.29, 29.6),
+ vector3(289.18, -1256.84, 29.44),
+ vector3(296.04, -896.22, 29.24),
+ vector3(296.74, -894.26, 29.24),
+ vector3(-301.63, -829.73, 32.43),
+ vector3(-303.23, -829.44, 32.43),
+ vector3(5.27, -919.87, 29.56),
+ vector3(-1200.61, -885.62, 13.26),
},
- ["route1"] = {
- vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
- },
- ["route68"] = {
- vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
- },
- ["paleto"] = {
- vector4(-111.22, 6470.03, 31.63, 133.86), -- Paleto Bank
- },
- ["pacific"] = {
- vector4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
- vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
+ BankLocations = {
+ ["legion"] = {
+ vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
+ },
+ ["hawick"] = {
+ vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
+ },
+ ["vinewood"] = {
+ vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
+ },
+ ["delperro"] = {
+ vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
+ },
+ ["route1"] = {
+ vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
+ },
+ ["route68"] = {
+ vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
+ },
+ ["paleto"] = {
+ vector4(-111.22, 6470.03, 31.63, 133.86), -- Paleto Bank
+ },
+ ["pacific"] = {
+ vector4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
+ vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
+ },
},
}
-
-Config.GabzBankLocations = {
- ["legion"] = {
- vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
- },
- ["hawick"] = {
- vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
- },
- ["vinewood"] = {
- vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
- },
- ["delperro"] = {
- vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
- },
- ["route1"] = {
- vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
- },
- ["route68"] = {
- vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
- },
- ["paleto"] = {
- vector4(-110.72, 6469.82, 31.63, 222.94), -- Paleto Bank (GABZ) - 1
- vector4(-108.98, 6471.56, 31.63, 222.92), -- Paleto Bank (GABZ) - 2
- },
- ["pacific"] = {
- vector4(258.55, 227.63, 106.28, 160.96), -- Pacficic Gabz 1+2
- vector4(263.21, 225.93, 106.28, 158.25), -- Pacficic Gabz 3+4
- vector4(267.95, 224.24, 106.28, 158.5), -- Pacficic Gabz 5+6
- vector4(263.71, 212.63, 106.28, 337.53), -- Pacficic Gabz 7+8
- vector4(259.02, 214.32, 106.28, 337.82), -- Pacficic Gabz 9+10
- vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
- },
-}
\ No newline at end of file
+if Config.Gabz then -- If Gabz banks enabled, load these locations instead
+ Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0)
+ Config.BankLocations = {
+ ["legion"] = {
+ vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
+ },
+ ["hawick"] = {
+ vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
+ },
+ ["vinewood"] = {
+ vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
+ },
+ ["delperro"] = {
+ vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
+ },
+ ["route1"] = {
+ vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
+ },
+ ["route68"] = {
+ vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
+ },
+ ["paleto"] = {
+ vector4(-110.72, 6469.82, 31.63, 222.94), -- Paleto Bank (GABZ) - 1
+ vector4(-108.98, 6471.56, 31.63, 222.92), -- Paleto Bank (GABZ) - 2
+ },
+ ["pacific"] = {
+ vector4(258.55, 227.63, 106.28, 160.96), -- Pacficic Gabz 1+2
+ vector4(263.21, 225.93, 106.28, 158.25), -- Pacficic Gabz 3+4
+ vector4(267.95, 224.24, 106.28, 158.5), -- Pacficic Gabz 5+6
+ vector4(263.71, 212.63, 106.28, 337.53), -- Pacficic Gabz 7+8
+ vector4(259.02, 214.32, 106.28, 337.82), -- Pacficic Gabz 9+10
+ vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
+ },
+ }
+ Config.ATMLocations = {
+ vector3(239.02, 212.37, 106.28),
+ vector3(239.46, 213.6, 106.28),
+ vector3(239.9, 214.82, 106.28),
+ vector3(240.35, 216.03, 106.28),
+ vector3(241.42, 218.96, 106.28),
+ vector3(241.86, 220.16, 106.28),
+ vector3(242.3, 221.41, 106.28),
+ vector3(242.76, 222.63, 106.28),
+ vector3(263.46, 203.86, 106.28),
+ vector3(263.96, 205.03, 106.28),
+ vector3(264.37, 206.28, 106.28),
+ vector3(264.77, 207.51, 106.28),
+ }
+end
diff --git a/fxmanifest.lua b/fxmanifest.lua
index ce8b4b1..9fe3474 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -1,6 +1,6 @@
name "Jim-Payments"
author "Jimathy"
-version "v2.6"
+version "v2.7"
description "Payment Script By Jimathy"
fx_version "cerulean"
game "gta5"
diff --git a/server.lua b/server.lua
index 5e1f8aa..7d9d05b 100644
--- a/server.lua
+++ b/server.lua
@@ -7,7 +7,7 @@ local function cv(amount)
end
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
- for k, v in pairs(Config.Jobs) do
+ for k in pairs(Config.Jobs) do
if not QBCore.Shared.Jobs[k] and not QBCore.Shared.Gangs[k] then
print("Jim-Payments: Config.Jobs searched for job/gang '"..k.."' and couldn't find it in the Shared")
end
@@ -15,25 +15,26 @@ AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName(
end)
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
+QBCore.Commands.Add("polcharge", "Charge another person", {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
if gang then
- if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
+ if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
if Config.Debug then print("QB-Management(Gang): Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
- else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
+ else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
if Config.Debug then print("QB-GangMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
- end
+ end
elseif not gang then
- if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
+ if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
if Config.Debug then print("QB-Management(Job): Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
- else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
+ else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
if Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
end
end
elseif not biller then --Find the biller from their citizenid
- for k, v in pairs(QBCore.Functions.GetPlayers()) do
+ for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
end
@@ -46,19 +47,19 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
-- If ticket system enabled, do this
if duty and Config.TicketSystem then
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
- for k, v in pairs(QBCore.Functions.GetPlayers()) do
+ for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil or Player ~= billed then
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
- TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
+ TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
end
end
if gang then
biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, 'Receipt received', 'success')
- TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
+ TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
end
end
end
@@ -67,14 +68,14 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
local comm = tonumber(Config.Jobs[data.society].Commission)
if Config.Commission and comm ~= 0 then
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
- if Config.CommissionDouble then
+ if Config.CommissionDouble then
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success")
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
end
if Config.CommissionAll then
- for k, v in pairs(QBCore.Functions.GetPlayers()) do
+ for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil and Player ~= biller then
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
@@ -100,10 +101,10 @@ RegisterServerEvent('jim-payments:Tickets:Sell', function()
end
end)
-QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb)
+QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb)
if QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket') == nil then amount = 0
- else amount = QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket').amount end
- cb(amount)
+ else amount = QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket').amount end
+ cb(amount)
end)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
@@ -121,7 +122,7 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
local label = biller.PlayerData.job.label
if gang == true then label = biller.PlayerData.gang.label end
if Config.PhoneBank == false or gang == true or billtype == "cash" then
- TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang)
+ TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang, outside)
else
if Config.PhoneType == "qb" then
MySQL.Async.insert(
@@ -162,11 +163,47 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
end
end)
+RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
+ local src = source
+ local biller = QBCore.Functions.GetPlayer(src)
+ local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
+ if tonumber(price) and tonumber(price) > 0 then
+ if not Config.FineJobConfirmation then
+ billed.Functions.RemoveMoney("bank", math.floor(tonumber(price)))
+ local commission = (tonumber(price) * Config.FineJobs[biller.PlayerData.job.name].Commission)
+ biller.Functions.AddMoney("bank", math.floor(commission))
+ if Config.Manage then
+ if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), price)
+ if Config.Debug then print("QB-Management(Job): Adding $"..price.." to account '"..tostring(biller.PlayerData.job.name).."'") end
+ else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), price)
+ if Config.Debug then print("QB-BossMenu: Adding $"..price.." to account '"..tostring(biller.PlayerData.job.name).."'") end
+ end
+ end
+ TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..tonumber(price), "success")
+ TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..tonumber(price))
+ else
+ TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, tonumber(price), src, biller.PlayerData.job.label)
+ end
+ else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
+end)
+RegisterServerEvent("jim-payments:server:PolPopup", function(data)
+ local src = source
+ local billed = QBCore.Functions.GetPlayer(src)
+ local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
+ if data.accept == true then
+ billed.Functions.RemoveMoney("bank", data.amount)
+ TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
+ else
+ TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
+ TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error")
+ end
+end)
+
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
local onlineList = {}
for k, v in pairs(QBCore.Functions.GetPlayers()) do
local P = QBCore.Functions.GetPlayer(v)
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname }
end
- cb(onlineList)
+ cb(onlineList)
end)