mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 14:56:02 +01:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c63fbc7144 | ||
|
|
c3d6425476 | ||
|
|
eb31c78bc6 | ||
|
|
d78fdf85df | ||
|
|
05d4dfc984 | ||
|
|
100323927e | ||
|
|
35e166d049 | ||
|
|
9a14e004e9 | ||
|
|
dbd3f33099 | ||
|
|
89b0549090 | ||
|
|
0afbee61e0 | ||
|
|
d1ee4dbf8c | ||
|
|
8af82e6d13 | ||
|
|
2e4fcff333 | ||
|
|
a1fd2d5974 | ||
|
|
a256b5e2f9 | ||
|
|
7a24a8836d | ||
|
|
d32b191689 | ||
|
|
41c8e3698e | ||
|
|
695b968ff7 | ||
|
|
8acacd2cd1 |
32
README.md
32
README.md
@@ -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,33 @@ 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
|
||||||
|
local data = { society = id.society, amount = amount }
|
||||||
|
TriggerServerEvent('jim-payments:Tickets:Give', data)
|
||||||
|
```
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
133
atms.lua
133
atms.lua
@@ -21,7 +21,9 @@ local function cv(amount)
|
|||||||
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.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
|
||||||
@@ -67,33 +69,28 @@ local function createBlips()
|
|||||||
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
|
||||||
@@ -162,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' }, }
|
||||||
@@ -184,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)
|
||||||
@@ -194,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' }, }
|
||||||
@@ -209,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.' },
|
||||||
@@ -223,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' }, }
|
||||||
@@ -236,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' }, }
|
||||||
@@ -249,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.' },
|
||||||
@@ -263,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' }, }
|
||||||
@@ -276,32 +277,34 @@ 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
|
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
|
||||||
if not dialog.amount then return end
|
if dialog then
|
||||||
PlayATMAnimation('exit') Citizen.Wait(1000)
|
if not dialog.amount then return end
|
||||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, society, gsociety)
|
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)
|
||||||
|
|
||||||
|
|
||||||
@@ -333,9 +336,7 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(resource)
|
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||||
if resource == GetCurrentResourceName() then
|
for k, v in pairs(Targets) do exports['qb-target']:RemoveZone(k) 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, v in pairs(Peds) do DeletePed(Peds[k]) end
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
@@ -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
|
||||||
@@ -230,8 +228,15 @@ QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
|
|||||||
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)
|
||||||
|
|||||||
86
client.lua
86
client.lua
@@ -2,85 +2,89 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
|||||||
|
|
||||||
PlayerJob = {}
|
PlayerJob = {}
|
||||||
local onDuty = false
|
local onDuty = false
|
||||||
local BankPed = nil
|
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)
|
||||||
|
end)
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
CreateThread(function()
|
||||||
local jobroles = {}
|
local jobroles = {}
|
||||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
||||||
--exports['qb-target']:AddBoxZone("JimBank", Config.CashInLocation, 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=Config.Debug, minZ = 105.75, maxZ = 107.29, },
|
|
||||||
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
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 Receipts", job = jobroles } }, distance = 2.0 })
|
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
|
||||||
if Config.Peds then
|
if Config.Peds then
|
||||||
local i = math.random(1, #Config.PedPool)
|
local i = math.random(1, #Config.PedPool)
|
||||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
||||||
if BankPed == nil then BankPed = CreatePed(0, Config.PedPool[i], Config.CashInLocation, Config.CashInLocation[4], false, false) 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
|
if Config.Debug then print("Ped Created for Ticket Trade") end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:client:Charge', function(data)
|
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||||
if not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
|
if outside == nil then outside = false end
|
||||||
|
if not outside and not onDuty 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() 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 newinputs = {}
|
if not data.img then img = "" else img = data.img end
|
||||||
if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
|
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||||
if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
|
local newinputs = {}
|
||||||
newinputs[#newinputs+1] = { 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
|
||||||
newinputs[#newinputs+1] = { 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
|
||||||
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send", inputs = newinputs})
|
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
|
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send", inputs = newinputs})
|
||||||
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img)
|
if dialog then
|
||||||
end
|
if not dialog.citizen or not dialog.price then return end
|
||||||
end)
|
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
||||||
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)
|
||||||
|
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
||||||
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
||||||
else exports['qb-menu']:openMenu({
|
else exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
|
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
|
||||||
{ header = "✅ Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
||||||
{ 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
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
||||||
if img == nil then img = "" end
|
if not img then img = "" end
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." 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 } } },
|
||||||
{ 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)
|
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||||
if resource == GetCurrentResourceName() then exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed) end
|
exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed[1])
|
||||||
end)
|
end)
|
||||||
21
config.lua
21
config.lua
@@ -1,4 +1,4 @@
|
|||||||
print("Jim-Payments v2.4 - Payments Script by Jimathy")
|
print("Jim-Payments v2.5 - 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.
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ Config = {}
|
|||||||
|
|
||||||
Config.Debug = false
|
Config.Debug = false
|
||||||
|
|
||||||
Config.Manage = true -- "true" if using qb-management
|
Config.Manage = false -- "true" if using qb-management
|
||||||
-- "false" if using qb-bossmenu
|
-- "false" if using qb-bossmenu
|
||||||
|
|
||||||
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
||||||
@@ -34,7 +34,7 @@ Config.PedPool = {
|
|||||||
[14] = `U_F_M_CasinoShop_01`,
|
[14] = `U_F_M_CasinoShop_01`,
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.Gabz = false -- "true" to enable Gabz Banking locations
|
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
|
||||||
@@ -44,6 +44,10 @@ Config.PhoneBank = true -- Set this to false to use the popup payment system FOR
|
|||||||
-- 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 = false -- 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
|
||||||
@@ -54,7 +58,7 @@ Config.CommissionLimit = false -- If true, this limits the Commission to only be
|
|||||||
-- 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
|
Config.CashInLocation = vector4(252.23, 223.11, 106.29, 159.2) -- Default Third Window along in Pacific Bank
|
||||||
if Config.Gabz then Config.CashInLocation = vector3(269.28, 217.24, 106.28, 69.0) end -- Middle along in Pacific Bank (Gabz)
|
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, },
|
||||||
@@ -71,7 +75,7 @@ Config.Jobs = {
|
|||||||
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
||||||
|
|
||||||
Config.GabzATMLocations = {
|
Config.GabzATMLocations = {
|
||||||
--PACIFIC BANK 8 ATMS (GABZ)
|
--PACIFIC BANK 12 ATMS (GABZ)
|
||||||
vector3(239.02, 212.37, 106.28),
|
vector3(239.02, 212.37, 106.28),
|
||||||
vector3(239.46, 213.6, 106.28),
|
vector3(239.46, 213.6, 106.28),
|
||||||
vector3(239.9, 214.82, 106.28),
|
vector3(239.9, 214.82, 106.28),
|
||||||
@@ -80,6 +84,10 @@ Config.GabzATMLocations = {
|
|||||||
vector3(241.86, 220.16, 106.28),
|
vector3(241.86, 220.16, 106.28),
|
||||||
vector3(242.3, 221.41, 106.28),
|
vector3(242.3, 221.41, 106.28),
|
||||||
vector3(242.76, 222.63, 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 = {
|
Config.VanATMLocations = {
|
||||||
@@ -179,6 +187,7 @@ Config.VanBankLocations = {
|
|||||||
vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.GabzBankLocations = {
|
Config.GabzBankLocations = {
|
||||||
["legion"] = {
|
["legion"] = {
|
||||||
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||||
@@ -209,5 +218,5 @@ Config.GabzBankLocations = {
|
|||||||
vector4(263.71, 212.63, 106.28, 337.53), -- Pacficic Gabz 7+8
|
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(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
|
vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "v2.4"
|
version "v2.5"
|
||||||
description "Payment Script By Jimathy"
|
description "Payment Script By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
52
server.lua
52
server.lua
@@ -2,27 +2,34 @@ 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 if not QBCore.Shared.Jobs[k] then print("Jim-Payments: Config.Jobs searched for job '"..k.."' and couldn't find it in the Shared") end end
|
||||||
|
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)
|
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
||||||
--Find the biller from their citizenid
|
--Find the biller from their citizenid
|
||||||
if biller == nil then
|
if not biller 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)
|
||||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||||
end
|
end
|
||||||
|
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||||
|
end
|
||||||
|
local duty = true
|
||||||
|
if biller.PlayerData.job.onduty then duty = true else duty = false end
|
||||||
|
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
||||||
|
if Config.Debug then print("QB-Management: 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
|
||||||
-- If ticket system enabled, do this
|
-- If ticket system enabled, do this
|
||||||
if Config.TicketSystem then
|
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)
|
||||||
@@ -58,6 +65,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||||
@@ -79,7 +87,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)
|
||||||
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))
|
||||||
@@ -97,10 +105,20 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
|||||||
if Config.PhoneBank == false then
|
if Config.PhoneBank == false then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
||||||
else
|
else
|
||||||
MySQL.Async.insert(
|
if Config.PhoneType == "qb" then
|
||||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
MySQL.Async.insert(
|
||||||
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
|
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
||||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
|
||||||
|
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
||||||
|
elseif Config.PhoneType == "gks" then
|
||||||
|
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid)', {
|
||||||
|
['@citizenid'] = billed.PlayerData.citizenid,
|
||||||
|
['@amount'] = amount,
|
||||||
|
['@society'] = biller.PlayerData.job.name,
|
||||||
|
['@sender'] = biller.PlayerData.charinfo.firstname,
|
||||||
|
['@sendercitizenid'] = biller.PlayerData.citizenid
|
||||||
|
})
|
||||||
|
end
|
||||||
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
||||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
||||||
end
|
end
|
||||||
@@ -115,13 +133,11 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
|||||||
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.accept == true then
|
if data.accept == true then
|
||||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
|
||||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount) end
|
|
||||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
||||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the payment", "success")
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." 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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user