39 Commits

Author SHA1 Message Date
Jim Shield
4b028d75b1 Gang Support in cash registers 2022-06-21 15:11:31 +01:00
Jim Shield
2302ff987b I hate github 2022-06-21 15:11:02 +01:00
Jim Shield
d29d2d6904 Gang support for cash regsiters 2022-06-21 15:10:35 +01:00
Jim Shield
f535df6b9c Rollback code to fix notification breaking 2022-06-16 00:03:10 +01:00
Jim Shield
170f680ef8 Update/Fix gks install support info 2022-06-15 20:24:38 +01:00
Jim Shield
2fc3b56e22 Rollback 2022-06-10 14:35:46 +01:00
Jim Shield
a18db3d6b9 Trying to fix inventory space checks 2022-06-10 14:32:05 +01:00
Jim Shield
da5e4c604f Tiny optimization 2022-06-08 22:15:39 +01:00
Jim Shield
284700bafb Fix for double phone payments 2022-06-06 20:42:02 +01:00
Jim Shield
ee532d5e3e Improved support of gks-phone 2022-05-23 17:19:49 +01:00
Jim Shield
c63fbc7144 Version Bump + small formatting changes 2022-05-21 11:36:51 +01:00
Jim Shield
c3d6425476 Better account loading + ps-progressbar support 2022-05-21 11:23:36 +01:00
Jim Shield
eb31c78bc6 qb-menu icon support 2022-05-21 11:01:47 +01:00
jimathy
d78fdf85df Add notify for phone payments being accepted 2022-05-18 11:18:07 +01:00
jimathy
05d4dfc984 /cashregister command now usable for outside payments
Jimathy patch 1
2022-05-05 21:42:17 +01:00
jimathy
100323927e Explanation of new duty variables 2022-05-05 21:39:09 +01:00
jimathy
35e166d049 don't need the variable here 2022-05-05 21:37:45 +01:00
jimathy
9a14e004e9 Attempting restricted payments outside of job 2022-05-05 21:34:34 +01:00
jimathy
dbd3f33099 Update README.md 2022-05-05 10:50:10 +01:00
jimathy
89b0549090 Fix Bossmeny support for banking 2022-05-04 20:44:57 +01:00
jimathy
0afbee61e0 Fix Invoices not going to society accounts 2022-05-04 10:17:43 +01:00
jimathy
d1ee4dbf8c Merge pull request #6 from jimathy/jimathy-patch-2
Debug Missing Jobs
2022-04-25 10:06:03 +01:00
jimathy
8af82e6d13 Don't break if job isn't found 2022-04-25 10:04:56 +01:00
jimathy
2e4fcff333 Debug for missing jobs in config 2022-04-25 10:01:51 +01:00
jimathy
a1fd2d5974 Config.Gabz default false 2022-04-24 11:27:10 +01:00
jimathy
a256b5e2f9 Banking Ped spawn location on the floor 2022-04-24 11:15:24 +01:00
jimathy
7a24a8836d Debug default 2022-04-24 11:08:22 +01:00
jimathy
d32b191689 Bug Fixes 2022-04-24 11:06:12 +01:00
jimathy
41c8e3698e Beta GKSPhone invoice support 2022-04-21 19:53:48 +01:00
jimathy
695b968ff7 Update README.md 2022-04-21 19:51:22 +01:00
jimathy
8acacd2cd1 vector4 2022-04-20 20:48:11 +01:00
jimathy
abe360bc6b Ped Support and better Gabz Support in config 2022-04-20 13:52:32 +01:00
jimathy
3c3fe054e0 Merge pull request #5 from jimathy/jimathy-patch-2
Debug mode + Custom Ticket Cashin + Gabz Locations
2022-04-19 21:32:35 +01:00
jimathy
4da8c039e7 Disable debug mode 2022-04-19 21:32:12 +01:00
jimathy
a9f7ac5663 Default setting to vanilla location 2022-04-19 21:30:08 +01:00
jimathy
712096887b Debug mode + Custom Ticket Cashin + Gabz Locations 2022-04-19 21:26:43 +01:00
jimathy
892acf1283 Add toggles for bossmenu/management + nearbylist 2022-04-15 18:25:27 +01:00
jimathy
13d83a066a Fix job label on payment popup 2022-04-12 21:10:48 +01:00
jimathy
88765357b3 Fix job label on payment popup 2022-04-12 21:09:44 +01:00
7 changed files with 520 additions and 278 deletions

View File

@@ -18,16 +18,18 @@ To make use of this payment system you need trigger the event
```jim-payments:client:Charge``` ```jim-payments:client:Charge```
for example with qb-target for example with qb-target
``` ```lua
exports['qb-target']:AddBoxZone("Receipt", vector3(1589.14, 6458.26, 26.01), 0.6, 0.6, { name="Receipt", heading = 335.0, debugPoly=debugPoly, minZ = 26.01, maxZ = 26.81, }, exports['qb-target']:AddBoxZone("Receipt", vector3(1589.14, 6458.26, 26.01), 0.6, 0.6, { name="Receipt", heading = 335.0, debugPoly=debugPoly, minZ = 26.01, maxZ = 26.81, },
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = "popsdiner" } }, distance = 2.0 }) { options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = "popsdiner" } }, distance = 2.0 })
``` ```
It currently requires you to be on duty to charge someone It currently requires you to be on duty to charge someone
This does not need to be added to **MY** job scripts, they already have built in support
-------------- --------------
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:
``` ```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"] = 150, ["type"] = "item", ["image"] = "ticket.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "Cash these in at the bank!"},
``` ```
@@ -38,15 +40,32 @@ Add the ticket image to your inventory script
-------------- --------------
To get tickets from phone invoices you NEED to add it to the event when a payment is accepted: To get tickets from phone invoices you NEED to add it to the event when a payment is accepted:
For QB-Phone:
Go to [qb] > qb-phone > client > main.lua Go to [qb] > qb-phone > client > main.lua
- Around line 645 there should be the PayInvoice NUICallBack - Around line 645 there should be the PayInvoice NUICallBack
- Directly under this line: - Directly *above* this line:
```lua
```TriggerServerEvent('qb-phone:server:BillingEmail', data, true)``` TriggerServerEvent('qb-phone:server:BillingEmail', data, true)
```
- Add this line: - Add this line:
```lua
TriggerServerEvent('jim-payments:Tickets:Give', data)
```
```TriggerServerEvent('jim-payments:Tickets:Give', data)``` For GKSPhone:
Go to gks-phone > server > serverapi.lua
- Search for the event: ```gksphone:faturapayBill```
- Under this line:
```lua
Ply.Functions.RemoveMoney('bank', amount, "paid-invoice")
```
- Add these lines:
```lua
TriggerEvent('jim-payments:Tickets:Give', { senderCitizenId = id.sendercitizenid, society = id.society, amount = amount })
```
-------------- --------------

308
atms.lua
View File

@@ -4,88 +4,11 @@ local QBCore = exports['qb-core']:GetCoreObject()
-- It uses QB-Input and server callbacks to retreive info about accounts and cash -- It uses QB-Input and server callbacks to retreive info about accounts and cash
-- This requires QB-Target and has the location of every ATM, ATM prop and bank window -- This requires QB-Target and has the location of every ATM, ATM prop and bank window
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" } local Targets = {}
local Peds = {}
Config.ATMLocations = { local BankLoc = Config.VanBankLocations
--PACIFIC BANK 10 ATMS local ATMLoc = Config.VanATMLocations
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),
--WALL ATMS
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.BankLocations = {
vector3(149.9, -1040.46, 29.37),
vector3(314.23, -278.83, 54.17),
vector3(-350.8, -49.57, 49.04),
vector3(-1213.0, -330.39, 37.79),
vector3(-2962.71, 483.0, 15.7),
vector3(1175.07, 2706.41, 38.09),
vector3(247.44, 223.22, 106.29),
vector3(-113.22, 6470.03, 31.63),
vector3(242.25, 225.15, 106.29)
--vector3(252.41, 221.41, 106.29)
}
local function cv(amount) local function cv(amount)
local formatted = amount local formatted = amount
@@ -97,10 +20,25 @@ local function cv(amount)
end end
return formatted return formatted
end end
local function createBlips()
local bossroles = {}
local gangroles = {}
CreateThread(function()
if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
if Config.useATM then if Config.useATM then
if Config.ATMBlips then if Config.ATMBlips then
for k, v in pairs(Config.ATMLocations) do for k, v in pairs(Config.WallATMLocations) do
blip = AddBlipForCoord(v)
SetBlipSprite(blip, 108)
SetBlipDisplay(blip, 4)
SetBlipScale(blip, 0.55)
SetBlipColour(blip, 3)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("ATM")
EndTextCommandSetBlipName(blip)
end
for k, v in pairs(ATMLoc) do
blip = AddBlipForCoord(v) blip = AddBlipForCoord(v)
SetBlipSprite(blip, 108) SetBlipSprite(blip, 108)
SetBlipDisplay(blip, 4) SetBlipDisplay(blip, 4)
@@ -115,73 +53,89 @@ local function createBlips()
end end
if Config.useBanks then if Config.useBanks then
if Config.BankBlips then if Config.BankBlips then
for k, v in pairs(Config.BankLocations) do for k,v in pairs(BankLoc) do
blip = AddBlipForCoord(v) for l, b in pairs(v) do
SetBlipSprite(blip, 108) blip = AddBlipForCoord(b)
SetBlipDisplay(blip, 4) SetBlipSprite(blip, 108)
SetBlipScale(blip, 0.55) SetBlipDisplay(blip, 4)
SetBlipColour(blip, 2) SetBlipScale(blip, 0.55)
SetBlipAsShortRange(blip, true) SetBlipColour(blip, 2)
BeginTextCommandSetBlipName("STRING") SetBlipAsShortRange(blip, true)
AddTextComponentString("Bank") BeginTextCommandSetBlipName("STRING")
EndTextCommandSetBlipName(blip) AddTextComponentString("Bank")
EndTextCommandSetBlipName(blip)
break
end
end end
end end
end end
end
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then createBlips() end end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() createBlips() end)
local bossroles = {}
local gangroles = {}
Citizen.CreateThread(function()
if Config.useATM or Config.useBanks then if Config.useATM or Config.useBanks then
for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades if QBCore.Shared.Jobs[tostring(k)] then
if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
if bossroles[tostring(k)] ~= nil then -- checks if the line exists if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss
if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the if bossroles[tostring(k)] ~= nil then -- checks if the line exists
else bossroles[tostring(k)] = tonumber(l) 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
end end
end end
for k, v in pairs(QBCore.Shared.Gangs) do for k, v in pairs(QBCore.Shared.Gangs) do
for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do if QBCore.Shared.Gangs[tostring(k)] then
if tostring(k) ~= "none" then for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do
if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then if tostring(k) ~= "none" then
if gangroles[tostring(k)] ~= nil then if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then
if gangroles[tostring(k)] > tonumber(l) then gangroles[tostring(k)] = tonumber(l) end if gangroles[tostring(k)] ~= nil then
else gangroles[tostring(k)] = tonumber(l) if gangroles[tostring(k)] > tonumber(l) then gangroles[tostring(k)] = tonumber(l) end
else gangroles[tostring(k)] = tonumber(l)
end
end end
end end
end end
end
end end
end
end end
if Config.useATM then if Config.useATM then
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, }) exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
for k,v in pairs(Config.ATMLocations) do for k,v in pairs(Config.WallATMLocations) do
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=false, useZ=true, }, 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, },
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" }, { 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" },]] --{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
}, distance = 1.5 }) }, distance = 1.5 })
end
for k,v in pairs(ATMLoc) 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, },
{ 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
end end
if Config.useBanks then if Config.useBanks then
for k,v in pairs(Config.BankLocations) do for k,v in pairs(BankLoc) do
exports['qb-target']:AddCircleZone("jimbank"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)), 2.0, { name="jimbank"..k, debugPoly=false, useZ=true, }, for l, b in pairs(v) do
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" }, Targets["jimbank"..k..l] =
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" }, 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, },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" }, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "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-building", label = "Access Society Account", id = "society", job = bossroles }, { 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-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
{ 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-building", label = "Gang Society Account", id = "gang", gang = gangroles }, { 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-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, }, distance = 2.5 })
{ 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 }, },
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
if Config.Debug then print("Ped Created - 'jimbank"..k..l.."'") end
end
end
end end
end end
end) end)
@@ -205,21 +159,25 @@ end
RegisterNetEvent('jim-payments:Client:ATM:use', function(data) RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
--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
while name == nil do local p = promise.new()
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb1, cb2, cb3, cb4, cb5, cb6, cb7) name = cb1 cash = cb2 bank = cb3 account = cb4 cid = cb5 savbal = cb6 aid = cb7 end) QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb) p:resolve(cb) end) local info = Citizen.Await(p)
Citizen.Wait(100) local society local gsociety local cancelled = false
if Config.Manage then
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)
local p2 = promise.new()
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) gsociety = Citizen.Await(p2)
end end
society = GrabAccount("GetAccount", PlayerJob.name)
Wait(200)
gsociety = GrabAccount("GetGangAccount", PlayerGang.name)
local atmbartime = 2500 local atmbartime = 2500
local setoptions = {} local setoptions = {}
if data.id == "atm" then if data.id == "atm" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, } setoptions = { { value = "withdraw", text = "Withdrawl" }, }
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>Welcome back, "..name.."<br><br>- Citizen ID -<br>"..cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(bank).."<br>💵Cash - $"..cv(cash)..'<br><br>- Options -' setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>Welcome back, "..info.name.."<br><br>- Citizen ID -<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash)..'<br><br>- Options -'
setheader = "💵 ATM Banking 💵" setheader = "💵 ATM Banking 💵"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, 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' }, }
@@ -227,9 +185,9 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
local playerPed = PlayerPedId() local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed, true) local playerCoords = GetEntityCoords(playerPed, true)
local hash = GetHashKey(v) local hash = GetHashKey(v)
local atm = IsObjectNearPoint(hash, playerCoords.x, playerCoords.y, playerCoords.z, 1.5) local atm = IsObjectNearPoint(hash, playerCoords.x, playerCoords.y, playerCoords.z, 1.6)
if atm then if atm then
local obj = GetClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 1.5, v, false, false, false) local obj = GetClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 1.6, v, false, false, false)
local atmCoords = GetEntityCoords(obj, false) local atmCoords = GetEntityCoords(obj, false)
TaskTurnPedToFaceEntity(playerPed, obj, 1000) TaskTurnPedToFaceEntity(playerPed, obj, 1000)
Wait(1000) Wait(1000)
@@ -237,14 +195,14 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing ATM", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing ATM", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
end end
end end
elseif data.id == "bank" then elseif data.id == "bank" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } } setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..name.."<br><br>- Account -<br>"..account.."<br>"..cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(bank).."<br>💵Cash - $"..cv(cash).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash).."<br><br>- Options -"
setheader = "🏦 Banking 🏦" setheader = "🏦 Banking 🏦"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, 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' }, }
@@ -252,12 +210,12 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Bank", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Bank", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "transfer" then elseif data.id == "transfer" then
setoptions = { { value = "transfer", text = "Transfer" } } setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..name.."<br><br>- Account -<br>"..account.."<br>"..cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(bank).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀" setheader = "🔀 Transfer Services 🔀"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' }, { type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
@@ -266,12 +224,12 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "savings" then elseif data.id == "savings" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } } setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..name.."<br><br>- Account Info -<br>Savings ID: "..aid.."<br>"..cid.."<br><br>- Balances -<br>💰Savings - $"..cv(savbal).."<br>🏦Bank - $"..cv(bank).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Account Info -<br>Savings ID: "..info.aid.."<br>"..info.cid.."<br><br>- Balances -<br>💰Savings - $"..cv(info.savbal).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setheader = "💰 Savings 💰" setheader = "💰 Savings 💰"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, 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' }, }
@@ -279,12 +237,12 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Savings", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Savings", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "society" then elseif data.id == "society" then
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } } setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setview = "Welcome back, "..name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br>🏦Bank - $"..cv(bank).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setheader = "🏢 Society Banking 🏢" setheader = "🏢 Society Banking 🏢"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, 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' }, }
@@ -292,12 +250,12 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "societytransfer" then elseif data.id == "societytransfer" then
setoptions = { { value = "transfer", text = "Transfer" } } setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀" setheader = "🔀 Transfer Services 🔀"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' }, { type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
@@ -306,12 +264,12 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "gang" then elseif data.id == "gang" then
setheader = "🏢 Society Banking 🏢" setheader = "🏢 Society Banking 🏢"
setview = "Welcome back, "..name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br>🏦Bank - $"..cv(bank).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } } setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, 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' }, }
@@ -319,32 +277,35 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
elseif data.id == "gangtransfer" then elseif data.id == "gangtransfer" then
setoptions = { { value = "transfer", text = "Transfer" } } setoptions = { { value = "transfer", text = "Transfer" } }
setview = "Welcome back, "..name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br><br>- Options -" setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br><br>- Options -"
setheader = "🔀 Transfer Services 🔀" setheader = "🔀 Transfer Services 🔀"
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions }, setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' }, { type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, } { type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
PlayATMAnimation('enter') PlayATMAnimation('enter')
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
end, function() end, function()
TriggerEvent("QBCore:Notify", "Cancelled!", "error") TriggerEvent("QBCore:Notify", "Cancelled!", "error")
return cancelled = true
end) end, data.icon)
end end
Wait(atmbartime+500) Wait(atmbartime+500)
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs }) if not cancelled then
if dialog then cancelled = false
if not dialog.amount then return end local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
PlayATMAnimation('exit') Citizen.Wait(1000) if dialog then
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, society, gsociety) if not dialog.amount then return end
PlayATMAnimation('exit') Citizen.Wait(1000)
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, society, gsociety)
end
end end
gsociety, society, name = nil
end) end)
@@ -374,4 +335,9 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price) TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price)
end end
end) end)
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
end) end)

View File

@@ -11,7 +11,6 @@ local function cv(amount)
return formatted return formatted
end end
---- BANK STUFF ---- BANK STUFF
QBCore.Functions.CreateCallback('jim-payments:ManageWrapper', function(source, cb, type, account) QBCore.Functions.CreateCallback('jim-payments:ManageWrapper', function(source, cb, type, account)
local result = nil local result = nil
@@ -26,7 +25,6 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
local cashB = Player.Functions.GetMoney("cash") local cashB = Player.Functions.GetMoney("cash")
local bankB = Player.Functions.GetMoney("bank") local bankB = Player.Functions.GetMoney("bank")
local amount = tonumber(amount) local amount = tonumber(amount)
--TriggerClientEvent("QBCore:Notify", src, tostring(account), "error")
--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
@@ -79,14 +77,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
elseif tonumber(society) >= amount then elseif tonumber(society) >= amount then
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success") TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
Player.Functions.AddMoney('bank', amount) Player.Functions.AddMoney('bank', amount)
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount) if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
end end
elseif billtype == "deposit" then elseif billtype == "deposit" then
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error") if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
elseif bankB >= amount then elseif bankB >= amount then
exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount) if Config.Manage then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
--TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) end
Player.Functions.RemoveMoney('bank', amount) Wait(1500) Player.Functions.RemoveMoney('bank', amount) Wait(1500)
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success") TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
end end
@@ -109,8 +107,8 @@ 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] ~= nil then if result[1] ~= nil then
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid) local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount) if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
if Reciever ~= nil then if Reciever ~= nil then
Reciever.Functions.AddMoney('bank', amount) Reciever.Functions.AddMoney('bank', amount)
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success") TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
@@ -131,14 +129,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
elseif tonumber(gsociety) >= amount then elseif tonumber(gsociety) >= amount then
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success") TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
Player.Functions.AddMoney('bank', amount) Player.Functions.AddMoney('bank', amount)
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount) if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
--TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
end end
elseif billtype == "deposit" then elseif billtype == "deposit" then
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error") if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
elseif bankB >= amount then elseif bankB >= amount then
exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount) if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
--TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
Player.Functions.RemoveMoney('bank', amount) Wait(1500) Player.Functions.RemoveMoney('bank', amount) Wait(1500)
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success") TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
end end
@@ -161,8 +159,8 @@ 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] ~= nil then if result[1] ~= nil then
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid) local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount) if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
if Reciever ~= nil then if Reciever ~= nil then
Reciever.Functions.AddMoney('bank', amount) Reciever.Functions.AddMoney('bank', amount)
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success") TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
@@ -226,11 +224,19 @@ QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
savbal = getSavingsAccount[1].amount savbal = getSavingsAccount[1].amount
else else
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, amount, account_type) VALUES (?, ?, ?)', { Player.PlayerData.citizenid, 0, 'Savings' }, function() completed = true end) repeat Wait(0) until completed == true MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, amount, account_type) VALUES (?, ?, ?)', { Player.PlayerData.citizenid, 0, 'Savings' }, function() completed = true end) repeat Wait(0) until completed == true
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
aid = getSavingsAccount[1].record_id aid = getSavingsAccount[1].record_id
savbal = getSavingsAccount[1].amount savbal = getSavingsAccount[1].amount
end end
local data = {
cb(name, cash, bank, account, cid, savbal, aid) name = name,
cash = cash,
bank = bank,
account = account,
cid = cid,
savbal = savbal,
aid = aid }
cb(data)
end) end)
QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end) QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)

View File

@@ -2,74 +2,110 @@ local QBCore = exports['qb-core']:GetCoreObject()
PlayerJob = {} PlayerJob = {}
local onDuty = false local onDuty = false
local BankPed = {}
RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end) RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
RegisterNetEvent('QBCore:Client:OnJobUpdate') AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end) RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
RegisterNetEvent('QBCore:Client:SetDuty') AddEventHandler('QBCore:Client:SetDuty', function(duty) onDuty = duty end) RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
RegisterNetEvent('QBCore:Client:OnGangUpdate') AddEventHandler('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = GangInfo end) RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = GangInfo end)
--Keeps track of duty on script restarts --Keeps track of duty on script restarts
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end) end end) 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)
Citizen.CreateThread(function()
local jobroles = {}
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
exports['qb-target']:AddBoxZone("JimBank", vector3(251.75, 222.17, 106.2), 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=false, minZ = 105.75, maxZ = 107.29, },
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
end) end)
RegisterNetEvent('jim-payments:client:Charge', function(data) CreateThread(function()
if not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment local jobroles = {}
local gangroles = {}
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 = {
{ 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, } },
distance = 2.0 })
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
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 onlineList = {}
local nearbyList = {} local nearbyList = {}
QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) onlineList = cb if onlineList[1] == nil then Wait(200) end local p = promise.new()
for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId())) onlineList = Citizen.Await(p)
for i = 1, #onlineList do for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
if onlineList[i].value == GetPlayerServerId(v) then local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
if v ~= PlayerId() then for i = 1, #onlineList do
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' } if onlineList[i].value == GetPlayerServerId(v) then
end 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
end end
if data.img == nil then img = "" else img = data.img end dist = nil
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end end
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send", if not data.img then img = "" else img = data.img end
inputs = { if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
{ text = " ", name = "citizen", type = "select", options = nearbyList }, local newinputs = {}
{ type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }, if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' },} if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
}) newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
if dialog then newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
if not dialog.citizen or not dialog.price then return end if data.job then label = PlayerJob.label gang = false elseif data.gang then label = PlayerGang.label gang = true end
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img) local dialog = exports['qb-input']:ShowInput({ header = img..label.." Cash Register", submitText = "Send", inputs = newinputs})
end if dialog then
end) if not dialog.citizen or not dialog.price then return end
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
end
end) end)
RegisterNetEvent('jim-payments:Tickets:Menu', function() RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
local amount = nil local amount = 0
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p) local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
else exports['qb-menu']:openMenu({ local sellable = false
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" }, local name = "" local label = ""
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) }, for k, v in pairs(Config.Jobs) do
{ header = "✅ Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } }, if data.gang then
{ header = "❌ No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, }) 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
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[name].PayPerTicket * amount) },
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, })
end end
end end
end) end)
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img) RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang)
if img == nil then img = "" end if not img then img = "" end
exports['qb-menu']:openMenu({ exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = img.."🧾 "..PlayerJob.label.." Payment 🧾", txt = "Do you want accept the payment?" }, { isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount }, { isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
{ header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, 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 } } },
{ header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, }) { 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 } } }, })
end) end)
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') 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) 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])
end)

View File

@@ -1,4 +1,4 @@
print("Jim-Payments v2.2 - Payments Script by Jimathy") print("Jim-Payments v2.6 - 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. -- If you need support I now have a discord available, it helps me keep track of issues and give better support.
@@ -6,10 +6,35 @@ print("Jim-Payments v2.2 - Payments Script by Jimathy")
Config = {} Config = {}
Config.TicketSystem = true -- Enable this if you want to use the ticket system Config.Debug = false
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
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.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.useATM = true -- Enable this to use my ATM's
Config.useBanks = true -- Enable this to use my banking stuff 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.BankBlips = true -- Enable this if you disabled qb-banking and need bank locations
@@ -18,8 +43,12 @@ Config.ATMBlips = false -- Enable this if you are a pyscho and need every ATM to
Config.PhoneBank = true -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices Config.PhoneBank = true -- 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 doesn't affect Cash payments as they by default use confirmation now
-- This is helpful for phones that don't support invoices well -- 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]
-- "qb" for qb-phone
-- "gks"" for GKSPhone
Config.Commission = false -- Set this to true to enable Commissions and give the person charging a percentage of the total 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.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.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 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
@@ -28,6 +57,9 @@ Config.CommissionLimit = false -- If true, this limits the Commission to only be
-- PayPerTicket should never be higher than MinAmountforTicket -- PayPerTicket should never be higher than MinAmountforTicket
-- Commission is a percentage eg "0.10" becomes 10% -- Commission is a percentage eg "0.10" becomes 10%
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)
Config.Jobs = { Config.Jobs = {
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, }, ['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10,}, ['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10,},
@@ -38,4 +70,154 @@ Config.Jobs = {
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, }, ['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, }, ['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, 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
},
["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
},
} }

View File

@@ -1,6 +1,6 @@
name "Jim-Payments" name "Jim-Payments"
author "Jimathy" author "Jimathy"
version "v2.2" version "v2.6"
description "Payment Script By Jimathy" description "Payment Script By Jimathy"
fx_version "cerulean" fx_version "cerulean"
game "gta5" game "gta5"
@@ -8,7 +8,6 @@ game "gta5"
dependencies { dependencies {
'qb-input', 'qb-input',
'qb-target', 'qb-target',
'qb-management'
} }
client_scripts { client_scripts {

View File

@@ -2,26 +2,45 @@ local QBCore = exports['qb-core']:GetCoreObject()
local function cv(amount) local function cv(amount)
local formatted = amount local formatted = amount
while true do while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end Wait(0) end
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted return formatted
end end
--QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, true) end) AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
for k, v in pairs(Config.Jobs) do
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller) if not QBCore.Shared.Jobs[k] and not QBCore.Shared.Gangs[k] then
--Find the biller from their citizenid print("Jim-Payments: Config.Jobs searched for job/gang '"..k.."' and couldn't find it in the Shared")
if biller == nil then
for k, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
end end
end end
if Config.TicketSystem then end)
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
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.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)
if Config.Debug then print("QB-GangMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
end
elseif not gang then
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)
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
local biller = QBCore.Functions.GetPlayerByCitizenId(data.senderCitizenId)
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
end
local duty = true
if not biller.PlayerData.job.onduty or not gang then duty = false end
-- If ticket system enabled, do this
if duty and Config.TicketSystem then
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
for k, v in pairs(QBCore.Functions.GetPlayers()) do for k, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v) local Player = QBCore.Functions.GetPlayer(v)
@@ -32,6 +51,11 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
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
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)
end
end end
end end
end end
@@ -78,7 +102,7 @@ QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb
cb(amount) cb(amount)
end) end)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img) RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
local src = source local src = source
local biller = QBCore.Functions.GetPlayer(src) local biller = QBCore.Functions.GetPlayer(src)
local billed = QBCore.Functions.GetPlayer(tonumber(citizen)) local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
@@ -90,19 +114,30 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error") TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
return return
end end
if billtype == "cash" then local label = biller.PlayerData.job.label
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img) if gang == true then label = biller.PlayerData.gang.label end
elseif billtype == "bank" then if Config.PhoneBank == false or gang == true or billtype == "cash" then
if Config.PhoneBank == false 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) else
else if Config.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}) {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source) TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success') elseif Config.PhoneType == "gks" then
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received') MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
['@citizenid'] = billed.PlayerData.citizenid,
['@amount'] = amount,
['@society'] = biller.PlayerData.job.name,
['@sender'] = biller.PlayerData.charinfo.firstname,
['@sendercitizenid'] = biller.PlayerData.citizenid,
['@label'] = biller.PlayerData.job.label,
})
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = 'Invoice Successfully Sent', img= '/html/static/img/icons/logo.png' })
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = 'New Invoice Recieved', img= '/html/static/img/icons/logo.png' })
end end
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
end end
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
end) end)
@@ -112,15 +147,14 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
local billed = QBCore.Functions.GetPlayer(src) local billed = QBCore.Functions.GetPlayer(src)
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller)) local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
local newdata = { senderCitizenId = biller.PlayerData.citizenid, society = biller.PlayerData.job.name, amount = data.amount } local newdata = { senderCitizenId = biller.PlayerData.citizenid, society = biller.PlayerData.job.name, amount = data.amount }
if data.gang == true then newdata.society = biller.PlayerData.gang.name end
if data.accept == true then if data.accept == true then
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount) billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount) TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
--TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount) TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the payment", "success")
elseif data.accept == false then elseif data.accept == false then
TriggerClientEvent("QBCore:Notify", src, "You declined the payment") TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the payment", "error") TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error")
end end
end) end)