mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
763dd613a4 | ||
|
|
16515eceea | ||
|
|
c967159d2b | ||
|
|
7188e36881 | ||
|
|
34a1d0d504 | ||
|
|
92b55d9d2d | ||
|
|
d9dbbfa485 | ||
|
|
4ec75a90fa | ||
|
|
baca1add62 | ||
|
|
890d8d67b0 | ||
|
|
5a849f1028 | ||
|
|
42e3c7d2be | ||
|
|
28d80261a2 | ||
|
|
a61716db2d | ||
|
|
1c8942a107 | ||
|
|
bfc3a372d3 | ||
|
|
2aefb7fa3b | ||
|
|
1f109ee4c9 | ||
|
|
4f120d7276 | ||
|
|
71a6d4d7dd | ||
|
|
fc902b34e2 | ||
|
|
89fa06507b | ||
|
|
61e2e6f32e | ||
|
|
ec40bd5cf1 | ||
|
|
70f2ed8005 | ||
|
|
f0f5f19af8 | ||
|
|
939026fd68 | ||
|
|
de4e6ad312 | ||
|
|
492bd53593 | ||
|
|
10fde7e6da | ||
|
|
8888fcdd9e | ||
|
|
2a86032299 | ||
|
|
92ba44355a | ||
|
|
1012e12d1e | ||
|
|
97b54cd482 | ||
|
|
fadb40e66d | ||
|
|
2bebb0c11f | ||
|
|
cb358f55b0 | ||
|
|
eed7fae066 | ||
|
|
5a6faf8337 | ||
|
|
ecec448d30 | ||
|
|
e28975d40b | ||
|
|
235e3d187c | ||
|
|
47dfcca052 | ||
|
|
a07382cca3 | ||
|
|
7b0757214b | ||
|
|
42f80fae77 | ||
|
|
c9ac3e8bbd | ||
|
|
8fcde5867c | ||
|
|
6b4c6a6779 | ||
|
|
55a25b59ac | ||
|
|
c136af4244 | ||
|
|
858c865b8b | ||
|
|
2c25faf2af | ||
|
|
ee2bfaaeca | ||
|
|
ab1096f977 |
40
README.md
40
README.md
@@ -35,6 +35,15 @@ ensure [vehicles]
|
||||
ensure [jim]
|
||||
```
|
||||
|
||||
---
|
||||
## BZZ Terminal Instructions
|
||||
Free Package https://bzzz.tebex.io/package/5551076
|
||||
|
||||
Stream the prop and add the emote that is provided to rpemotes or dpemotes
|
||||
```lua
|
||||
['terminal'] = {['name'] = 'terminal', ['label'] = 'Wireless Terminal', ['weight'] = 5000, ["type"] = "item", ["image"] = 'terminal.png', ['unique'] = true, ['useable'] = true, ["shouldClose"] = true, ["combinable"] = nil, ['description'] = ''},
|
||||
```
|
||||
|
||||
---
|
||||
## Item installation
|
||||
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
|
||||
@@ -72,7 +81,7 @@ TriggerServerEvent('jim-payments:Tickets:Give', data)
|
||||
- Go to `gks-phone > server > serverapi.lua`
|
||||
- Search for the event: `gksphone:faturapayBill` and search for this line:
|
||||
```lua
|
||||
Ply.Functions.RemoveMoney('bank', amount, "paid-invoice")
|
||||
Ply.Functions.RemoveMoney('bank', data[1].amount, "paid-invoice")
|
||||
```
|
||||
|
||||
- Directly under this line add this event:
|
||||
@@ -81,9 +90,21 @@ TriggerEvent('jim-payments:Tickets:Give', { sender = Ply.PlayerData.charinfo.fir
|
||||
```
|
||||
- The phone should now be integrated with jim-payments
|
||||
|
||||
---
|
||||
#### Renewed QB-Phone:
|
||||
- Go to `qb-phone > server > invoices.lua`
|
||||
- Search for the event: `qb-phone:server:PayMyInvoice` and search for this line:
|
||||
```lua
|
||||
TriggerEvent("qb-phone:server:InvoiceHandler", true, amount, src, resource)
|
||||
```
|
||||
|
||||
- Directly under this line add this event:
|
||||
```lua
|
||||
TriggerEvent('jim-payments:Tickets:Give', { amount = amount, senderCitizenId = sendercitizenid, sender = SenderPly.PlayerData.charinfo.firstname, society = society }, SenderPly)
|
||||
```
|
||||
- When invoices are paid, they should now be integrated with jim-payments
|
||||
|
||||
# Setup/Config
|
||||
---
|
||||
|
||||
## Custom Locations
|
||||
|
||||
- You can make of this payment system for a job script that wasn't created by me
|
||||
@@ -174,4 +195,15 @@ FineJobList = true, -- "true" to use nearby player list feature in the cash regi
|
||||
- `BankBlips` Enable this if you disabled qb-banking and need bank locations
|
||||
- `ATMBlips` Enable this if you are a pyscho and need every ATM to be on the map too
|
||||
- `Gabz` Enable to change to Gabz Bank locations, this corrects the ATM/Bank Cashier + Ticket Cash in
|
||||
---
|
||||
---
|
||||
## Support for other scripts
|
||||
### Renewed-Banking
|
||||
- Support for renewed banking added
|
||||
- Toggle `RenewedBanking` in the config.lua to enable this
|
||||
|
||||
### Renewed's qb-phone
|
||||
- Simply leave the Config.PhoneType as `"qb"`
|
||||
|
||||
### AP-Goverment
|
||||
- Support for AP-Goverment Tax on payments
|
||||
- Toggle `ApGov` in the config.lua to enable this
|
||||
350
atms.lua
350
atms.lua
@@ -1,350 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- This script is a simple replacement for QB-Banking and QB-ATMs
|
||||
-- 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
|
||||
|
||||
local Targets = {}
|
||||
local Peds = {}
|
||||
|
||||
local BankLoc = Config.VanBankLocations
|
||||
local ATMLoc = Config.VanATMLocations
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do
|
||||
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
|
||||
if (k==0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
local function loadModel(model) if not HasModelLoaded(model) then if Config.Debug then print("^5Debug^7: ^2Loading Model^7: '^6"..model.."^7'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end end
|
||||
local function unloadModel(model) if Config.Debug then print("^5Debug^7: ^2Removing Model^7: '^6"..model.."^7'") end SetModelAsNoLongerNeeded(model) end
|
||||
local function loadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Loading Anim Dictionary^7: '^6"..dict.."^7'") end while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Wait(5) end end
|
||||
local function unloadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Anim Dictionary^7: '^6"..dict.."^7'") end RemoveAnimDict(dict) end
|
||||
|
||||
local bossroles = {}
|
||||
local gangroles = {}
|
||||
CreateThread(function()
|
||||
if Config.useATM then
|
||||
if Config.ATMBlips then
|
||||
for _, 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 _, v in pairs(Config.ATMLocations) 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
|
||||
end
|
||||
end
|
||||
if Config.useBanks then
|
||||
if Config.BankBlips then
|
||||
for _, v in pairs(Config.BankLocations) do
|
||||
for _, b in pairs(v) do
|
||||
blip = AddBlipForCoord(b)
|
||||
SetBlipSprite(blip, 108)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale(blip, 0.55)
|
||||
SetBlipColour(blip, 2)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("Bank")
|
||||
EndTextCommandSetBlipName(blip)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if Config.useATM or Config.useBanks then
|
||||
for k in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
|
||||
if QBCore.Shared.Jobs[tostring(k)] then
|
||||
for l in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
|
||||
if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss
|
||||
if bossroles[tostring(k)] ~= nil then -- checks if the line exists
|
||||
if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the
|
||||
else bossroles[tostring(k)] = tonumber(l)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for k in pairs(QBCore.Shared.Gangs) do
|
||||
if QBCore.Shared.Gangs[tostring(k)] then
|
||||
for l in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do
|
||||
if tostring(k) ~= "none" then
|
||||
if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then
|
||||
if gangroles[tostring(k)] ~= nil then
|
||||
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
|
||||
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, })
|
||||
for k,v in pairs(Config.WallATMLocations) do
|
||||
Targets["jimwallatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
for k,v in pairs(Config.ATMLocations) do
|
||||
Targets["jimatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
end
|
||||
if Config.useBanks then
|
||||
for k,v in pairs(Config.BankLocations) do
|
||||
for l, b in pairs(v) do
|
||||
Targets["jimbank"..k..l] =
|
||||
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Access Society Account", id = "society", job = bossroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Gang Society Account", id = "gang", gang = gangroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
|
||||
distance = 2.5 })
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
loadModel(Config.PedPool[i])
|
||||
if not Config.Gabz then CreateModelHide(vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)), 1.0, `v_corp_bk_chair3`, true) 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)-1.03), b[4], false, false) end
|
||||
if Config.Debug then print("^5Debug^7: ^6Ped ^2Created for location^7: '^6"..k..l.."^7'") end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local function PlayATMAnimation(animation)
|
||||
if animation == 'enter' then
|
||||
loadAnimDict('amb@prop_human_atm@male@enter')
|
||||
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@enter', "enter", 1.0,-1.0, 1500, 1, 1, true, true, true)
|
||||
unloadAnimDict('amb@prop_human_atm@male@enter')
|
||||
end
|
||||
if animation == 'exit' then
|
||||
loadAnimDict('amb@prop_human_atm@male@exit')
|
||||
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@exit', "exit", 1.0,-1.0, 3000, 1, 1, true, true, true)
|
||||
unloadAnimDict('amb@prop_human_atm@male@enter')
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb) p:resolve(cb) end) local info = Citizen.Await(p)
|
||||
local cancelled = false
|
||||
if not Config.Manage then
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) info.society = Citizen.Await(p)
|
||||
local p2 = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) info.gsociety = Citizen.Await(p2)
|
||||
end
|
||||
local atmbartime = 2500
|
||||
local setoptions = {}
|
||||
|
||||
if data.id == "atm" then
|
||||
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, "..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 💵"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
for k, v in pairs(Config.ATMModels) do
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(playerPed, true)
|
||||
local hash = GetHashKey(v)
|
||||
local atm = IsObjectNearPoint(hash, playerCoords.x, playerCoords.y, playerCoords.z, 1.6)
|
||||
if atm then
|
||||
local obj = GetClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 1.6, v, false, false, false)
|
||||
local atmCoords = GetEntityCoords(obj, false)
|
||||
TaskTurnPedToFaceEntity(playerPed, obj, 1000)
|
||||
Wait(1000)
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing ATM", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
end
|
||||
end
|
||||
|
||||
elseif data.id == "bank" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
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 🏦"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Bank", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "transfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
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 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "savings" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
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 💰"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Savings", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "society" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setview = "Welcome back, "..info.name..
|
||||
"<br><br>- Society Account -<br>"..
|
||||
PlayerJob.label..
|
||||
"<br><br>- Balances -<br>🏢"..
|
||||
PlayerJob.label.." - $"..cv(info.society)..
|
||||
"<br>🏦Bank - $"..cv(info.bank)
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "societytransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(info.society).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "gang" then
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "gangtransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
end
|
||||
|
||||
Wait(atmbartime+500)
|
||||
if not cancelled then
|
||||
cancelled = false
|
||||
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
|
||||
if dialog then
|
||||
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, info.society, info.gsociety)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('jim-payments:client:ATM:give', function()
|
||||
local onlineList = {}
|
||||
local nearbyList = {}
|
||||
QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) onlineList = cb if onlineList[1] == nil then Wait(200) end
|
||||
for _, id in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(id)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(id) then
|
||||
if id ~= 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
|
||||
dist = nil
|
||||
end
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
|
||||
inputs = {
|
||||
{ text = " ", name = "citizen", type = "select", options = nearbyList },
|
||||
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Pay' }, }
|
||||
})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||
for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
|
||||
end)
|
||||
269
atmserver.lua
269
atmserver.lua
@@ -1,269 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do
|
||||
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
|
||||
if (k==0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, baccount, account, society, gsociety)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local cashB = Player.Functions.GetMoney("cash")
|
||||
local bankB = Player.Functions.GetMoney("bank")
|
||||
local amount = tonumber(amount)
|
||||
|
||||
--Simple transfers from bank to wallet --
|
||||
if account == "bank" or account == "atm" then
|
||||
if billtype == "withdraw" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
elseif bankB >= tonumber(amount) then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('cash', amount)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if cashB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough cash", "error")
|
||||
elseif cashB >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the Bank", "success")
|
||||
end
|
||||
end
|
||||
-- Transfers from bank to savings account --
|
||||
elseif account == "savings" then
|
||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
if getSavingsAccount[1] ~= nil then savbal = tonumber(getSavingsAccount[1].amount) aid = getSavingsAccount[1].record_id end
|
||||
|
||||
if billtype == "withdraw" then
|
||||
if savbal >= amount then
|
||||
savbal = savbal - amount
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Withdrawn from savings into bank account", "success")
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
elseif savbal < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Savings Balance too low", "error")
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if amount < bankB then
|
||||
savbal = savbal + amount
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Deposited from bank account into savings", "success")
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
else TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
end
|
||||
end
|
||||
--Simple transfers from society account to bank --
|
||||
elseif account == "society" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(society) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
elseif tonumber(society) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddMoney(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)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
||||
end
|
||||
end
|
||||
-- Transfer from boss account to players --
|
||||
elseif account == "societytransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (society - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
end
|
||||
end
|
||||
|
||||
--Simple transfers from gang society account to bank --
|
||||
elseif account == "gang" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(gsociety) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
elseif tonumber(gsociety) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddGangMoney(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)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
||||
end
|
||||
end
|
||||
-- Transfer from gang account to players --
|
||||
elseif account == "gangtransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (gsociety - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if not Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
elseif account == "transfer" then
|
||||
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (Player.PlayerData.money.bank - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local name = Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname
|
||||
local cid = Player.PlayerData.citizenid.." ["..source.."]"
|
||||
local cash = Player.Functions.GetMoney("cash")
|
||||
local bank = Player.Functions.GetMoney("bank")
|
||||
local account = Player.PlayerData.charinfo.account
|
||||
local society = 0
|
||||
local gsociety = 0
|
||||
|
||||
-- If qb-management, grab info directly from database
|
||||
if Config.Manage then
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM management_funds')
|
||||
for k, v in pairs(result) do
|
||||
if Player.PlayerData.job.name == v.job_name then society = v.amount end
|
||||
end
|
||||
if Player.PlayerData.gang.name ~= "none" then
|
||||
for k, v in pairs(result) do
|
||||
if Player.PlayerData.gang.name == v.job_name then gsociety = v.amount end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
-- Grab Savings account info
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
if result[1] then
|
||||
accountID = result[1].record_id
|
||||
savingBalance = result[1].amount
|
||||
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
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
aid = result[1].record_id
|
||||
savingBalance = result[1].amount
|
||||
end
|
||||
cb({name = name,
|
||||
cash = cash,
|
||||
bank = bank,
|
||||
account = account,
|
||||
cid = cid,
|
||||
savbal = savingBalance,
|
||||
aid = accountID,
|
||||
society = society,
|
||||
gsociety = gsociety})
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local Reciever = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = Player.Functions.GetMoney("cash")
|
||||
|
||||
if amount and amount > 0 then
|
||||
if balance >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
||||
Reciever.Functions.AddMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success")
|
||||
elseif balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't give $0", 'error') end
|
||||
end)
|
||||
197
client.lua
197
client.lua
@@ -1,197 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
PlayerJob = {}
|
||||
PlayerGang = {}
|
||||
|
||||
local onDuty = false
|
||||
local BankPed = nil
|
||||
local Targets = {}
|
||||
local till = {}
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
||||
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = GangInfo end)
|
||||
|
||||
--Keeps track of duty on script restarts
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||
QBCore.Functions.GetPlayerData(function(PlayerData)
|
||||
PlayerJob = PlayerData.job
|
||||
PlayerGang = PlayerData.gang
|
||||
onDuty = PlayerJob.onduty
|
||||
end)
|
||||
end)
|
||||
|
||||
local function loadModel(model) if not HasModelLoaded(model) then if Config.Debug then print("^5Debug^7: ^2Loading Model^7: '^6"..model.."^7'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end end
|
||||
local function unloadModel(model) if Config.Debug then print("^5Debug^7: ^2Removing Model^7: '^6"..model.."^7'") end SetModelAsNoLongerNeeded(model) end
|
||||
|
||||
CreateThread(function()
|
||||
local jobroles = {} local gangroles = {}
|
||||
--Build Job/Gang Checks for cashin location
|
||||
for k, v in pairs(Config.Jobs) do if v.gang then gangroles[tostring(k)] = 0 else jobroles[tostring(k)] = 0 end end
|
||||
--Create Target at location
|
||||
Targets["JimBank"] =
|
||||
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 })
|
||||
--Crete Ped at the location
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
loadModel(Config.PedPool[i])
|
||||
if not Config.Gabz then CreateModelHide(vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 1.0, `v_corp_bk_chair3`, true) end
|
||||
if not BankPed then BankPed = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
|
||||
if Config.Debug then print("^5Debug^7: ^6Ped ^2Created for location^7: '^6Ticket Trade^7'") end
|
||||
end
|
||||
|
||||
--Spawn Custom Cash Register Targets
|
||||
for k, v in pairs(Config.CustomCashRegisters) do
|
||||
for i = 1, #v do
|
||||
Targets["CustomRegister: "..k..i] =
|
||||
exports['qb-target']:AddBoxZone("CustomRegister: "..k..i, v[i].coords, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=Config.Debug, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4 },
|
||||
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = k, img = "" }, },
|
||||
distance = 2.0
|
||||
})
|
||||
if v[i].prop then
|
||||
loadModel(`prop_till_03`)
|
||||
till[#till+1] = CreateObject(`prop_till_03`, v[i].coords.x, v[i].coords.y, v[i].coords.z, 0, 0, 0)
|
||||
SetEntityHeading(till[#till],v[i].coords[4]+180.0)
|
||||
FreezeEntityPosition(till[#till], true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
--Check if player is using /cashregister command
|
||||
if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.List then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
|
||||
local onlineList = Citizen.Await(p)
|
||||
local nearbyList = {}
|
||||
--Convert list of players nearby into one qb-input understands + add distance info
|
||||
for _, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or Config.Debug then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
|
||||
end
|
||||
--Check if image was given when opening the regsiter
|
||||
local img = data.img or ""
|
||||
--Continue adding payment options to qb-input
|
||||
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local label = PlayerJob.label
|
||||
local gang = false
|
||||
if data.gang then label = PlayerGang.label gang = true end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = img..label.." Cash Register", submitText = "Send", inputs = newinputs})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
||||
if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.FineJobList then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
|
||||
local onlineList = Citizen.Await(p)
|
||||
local nearbyList = {}
|
||||
--Convert list of players nearby into one qb-input understands + add distance info
|
||||
for _, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or Config.Debug then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
|
||||
end
|
||||
--Continue adding payment options to qb-input
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local label = PlayerJob.label
|
||||
local gang = false
|
||||
local dialog = exports['qb-input']:ShowInput({ header = label.." Charge", submitText = "Send", inputs = newinputs})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
--Get ticket info
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
|
||||
local amount = Citizen.Await(p)
|
||||
if amount == 0 then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
||||
local sellable = false
|
||||
local name = "" local label = ""
|
||||
--Check/adjust for job/gang names
|
||||
for k, v in pairs(Config.Jobs) do
|
||||
if data.gang then if v.gang and k == PlayerGang.name then name = k label = PlayerGang.label sellable = true end
|
||||
else if not v.gang and k == PlayerJob.name then name = k label = PlayerJob.label sellable = true end
|
||||
end
|
||||
if sellable then -- if info is found then:
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<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)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
local img = img or ""
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = "🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the charge?" },
|
||||
{ isMenuHeader = true, header = "", txt = "Bank Charge: $"..amount },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||
for i = 1, #till do DeleteEntity(till[i]) end
|
||||
unloadModel(GetEntityModel(BankPed)) DeletePed(BankPed)
|
||||
end)
|
||||
148
client/atms.lua
148
client/atms.lua
@@ -1,5 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- This script is a simple replacement for QB-Banking and QB-ATMs
|
||||
-- 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
|
||||
@@ -16,10 +14,10 @@ CreateThread(function()
|
||||
if Config.useATM then
|
||||
if Config.ATMBlips then
|
||||
for _, v in pairs(Config.WallATMLocations) do
|
||||
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = "ATM" })
|
||||
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
|
||||
end
|
||||
for _, v in pairs(Config.ATMLocations) do
|
||||
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = "ATM" })
|
||||
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -27,7 +25,7 @@ CreateThread(function()
|
||||
if Config.BankBlips then
|
||||
for _, v in pairs(Config.BankLocations) do
|
||||
for _, b in pairs(v) do
|
||||
makeBlip({coords = b, sprite = 108, col = 2, scale = 0.55, disp = 6, name = "Bank" })
|
||||
makeBlip({coords = b, sprite = 108, col = 2, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_bank"] })
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -62,19 +60,19 @@ CreateThread(function()
|
||||
end
|
||||
end
|
||||
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 = Loc[Config.Lan].target["atm"], id = "atm" },}, distance = 1.5, })
|
||||
for k,v in pairs(Config.WallATMLocations) do
|
||||
Targets["jimwallatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(v.x, v.y, v.z+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"], id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
for k,v in pairs(Config.ATMLocations) do
|
||||
Targets["jimatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(v.x, v.y, 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" },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = Loc[Config.Lan].target["atm"], id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
end
|
||||
@@ -83,15 +81,15 @@ CreateThread(function()
|
||||
for l, b in pairs(v) do
|
||||
Targets["jimbank"..k..l] =
|
||||
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(b.x, b.y, b.z+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = Loc[Config.Lan].target["bank"], id = "bank" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer"], id = "transfer" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = Loc[Config.Lan].target["saving"], id = "savings" },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Access Society Account", id = "society", job = bossroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["soc_saving"], id = "society", job = bossroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["soc_trans"], id = "societytransfer", job = bossroles },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Gang Society Account", id = "gang", gang = gangroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["gang_acct"], id = "gang", gang = gangroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["gang_trans"], id = "gangtransfer", gang = gangroles }, },
|
||||
distance = 2.5 })
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
@@ -103,22 +101,11 @@ CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
local function PlayATMAnimation(animation)
|
||||
if animation == 'enter' then
|
||||
|
||||
end
|
||||
if animation == 'exit' then
|
||||
loadAnimDict('amb@prop_human_atm@male@exit')
|
||||
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@exit', "exit", 1.0,-1.0, 3000, 1, 1, true, true, true)
|
||||
unloadAnimDict('amb@prop_human_atm@male@enter')
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb) p:resolve(cb) end) local info = Citizen.Await(p)
|
||||
if not Config.Manage then
|
||||
if Config.Banking == "qb" then
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) info.society = Citizen.Await(p)
|
||||
local p2 = promise.new()
|
||||
@@ -129,87 +116,82 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
local setoptions = {}
|
||||
|
||||
if data.id == "atm" then
|
||||
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, "..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 💵"
|
||||
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, }
|
||||
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>"..Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["citizenid"]..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_atm"]
|
||||
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 = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
for k, v in pairs(Config.ATMModels) do
|
||||
if IsObjectNearPoint(v, GetEntityCoords(PlayerPedId()), 1.6) then
|
||||
local obj = GetClosestObjectOfType(GetEntityCoords(PlayerPedId()), 1.6, v, false, false, false)
|
||||
local atmCoords = GetEntityCoords(obj)
|
||||
lookEnt(obj)
|
||||
bartext = "Accessing ATM"
|
||||
bartext = Loc[Config.Lan].menu["acc_atm"]
|
||||
end
|
||||
end
|
||||
|
||||
elseif data.id == "bank" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
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 🏦"
|
||||
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_bank"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
bartext = "Accessing Bank"
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_bank"]
|
||||
|
||||
elseif data.id == "transfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
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 🔀"
|
||||
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_trans"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
|
||||
bartext = "Accessing Transfers"
|
||||
bartext = Loc[Config.Lan].menu["acc_trans"]
|
||||
|
||||
elseif data.id == "savings" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
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 💰"
|
||||
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_info"]..info.aid.."<br>"..info.cid..Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_saving"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
bartext = "Accessing Savings"
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_saving"]
|
||||
|
||||
elseif data.id == "society" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setview = "Welcome back, "..info.name..
|
||||
"<br><br>- Society Account -<br>"..
|
||||
PlayerJob.label..
|
||||
"<br><br>- Balances -<br>🏢"..
|
||||
PlayerJob.label.." - $"..cv(info.society)..
|
||||
"<br>🏦Bank - $"..cv(info.bank)
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
|
||||
setheader = Loc[Config.Lan].menu["header_soc_bank"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
bartext = "Accessing Society Account"
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_boss"]
|
||||
|
||||
|
||||
elseif data.id == "societytransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(info.society).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_trans"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
bartext = "Accessing Society Transfers"
|
||||
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_boss_trans"]
|
||||
|
||||
|
||||
elseif data.id == "gang" then
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setheader = Loc[Config.Lan].menu["header_soc_bank"]
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
|
||||
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
bartext = "Accessing Gang Society Account"
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_gang"]
|
||||
|
||||
|
||||
elseif data.id == "gangtransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(info.gsociety).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
|
||||
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["header_option"]
|
||||
setheader = Loc[Config.Lan].menu["header_trans"]
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
bartext = "Accessing Gang Transfers"
|
||||
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
|
||||
bartext = Loc[Config.Lan].menu["acc_gang_trans"]
|
||||
|
||||
end
|
||||
|
||||
@@ -217,7 +199,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@enter', "enter", 1.0,-1.0, 1500, 1, 1, true, true, true)
|
||||
unloadAnimDict('amb@prop_human_atm@male@enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", bartext, atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function()
|
||||
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
|
||||
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = Loc[Config.Lan].menu["transfer"], inputs = setinputs })
|
||||
if dialog then
|
||||
if not dialog.amount then return end
|
||||
loadAnimDict('amb@prop_human_atm@male@exit')
|
||||
@@ -226,7 +208,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, info.society, info.gsociety)
|
||||
end
|
||||
end, function() TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
end, function() triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
|
||||
end, data.icon)
|
||||
end)
|
||||
|
||||
@@ -245,11 +227,11 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
|
||||
end
|
||||
dist = nil
|
||||
end
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
|
||||
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = Loc[Config.Lan].menu["give_cash"], submitText = Loc[Config.Lan].menu["give"],
|
||||
inputs = {
|
||||
{ text = " ", name = "citizen", type = "select", options = nearbyList },
|
||||
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Pay' }, }
|
||||
{ type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_pay"] }, }
|
||||
})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
@@ -261,4 +243,4 @@ end)
|
||||
AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end
|
||||
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||
for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
PlayerJob = {}
|
||||
PlayerGang = {}
|
||||
|
||||
@@ -30,16 +28,13 @@ CreateThread(function()
|
||||
Targets["JimBank"] =
|
||||
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = {
|
||||
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Job Receipts", job = jobroles, },
|
||||
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Gang Receipts", gang = gangroles, } },
|
||||
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_boss"], job = jobroles, },
|
||||
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_gang"], gang = gangroles, } },
|
||||
distance = 2.0 })
|
||||
--Crete Ped at the location
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
if not Config.Gabz then CreateModelHide(vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 1.0, `v_corp_bk_chair3`, true) end
|
||||
if not BankPed then
|
||||
BankPed = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false)
|
||||
end
|
||||
BankPed = makePed(Config.PedPool[math.random(1, #Config.PedPool)], Config.CashInLocation, false, false)
|
||||
end
|
||||
|
||||
--Spawn Custom Cash Register Targets
|
||||
@@ -49,8 +44,8 @@ CreateThread(function()
|
||||
local gang = nil
|
||||
if v[i].gang then job = nil gang = k end
|
||||
Targets["CustomRegister: "..k..i] =
|
||||
exports['qb-target']:AddBoxZone("CustomRegister: "..k..i, v[i].coords, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=Config.Debug, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4 },
|
||||
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = job, gang = gang, img = "" }, },
|
||||
exports['qb-target']:AddBoxZone("CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=Config.Debug, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4 },
|
||||
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = Loc[Config.Lan].target["charge"], job = job, gang = gang, img = "" }, },
|
||||
distance = 2.0 })
|
||||
if v[i].prop then
|
||||
Till[#Till+1] = makeProp({prop = `prop_till_03`, coords = v[i].coords}, 1, false)
|
||||
@@ -61,8 +56,11 @@ end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
--Check if player is using /cashregister command
|
||||
if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
|
||||
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "error") return end
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.Usebzzz then
|
||||
TriggerEvent('animations:client:EmoteCommandStart', {'terminal'})
|
||||
end
|
||||
if Config.List then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
|
||||
@@ -80,32 +78,36 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["cus_id"] }
|
||||
end
|
||||
--Check if image was given when opening the regsiter
|
||||
local img = data.img or ""
|
||||
if not string.find(img, "<") then img = "<center><p><img src="..img.." width=100px></p>" end
|
||||
--Continue adding payment options to qb-input
|
||||
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = Loc[Config.Lan].menu["type"], options = { { value = "cash", text = Loc[Config.Lan].menu["cash"] }, { value = "bank", text = Loc[Config.Lan].menu["card"] } } }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local label = PlayerJob.label
|
||||
local gang = false
|
||||
if data.gang then label = PlayerGang.label gang = true end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = img..label.." Cash Register", submitText = "Send", inputs = newinputs})
|
||||
local dialog = exports['qb-input']:ShowInput({ header = img..label..Loc[Config.Lan].menu["cash_reg"], submitText = Loc[Config.Lan].menu["send"], inputs = newinputs})
|
||||
if dialog then
|
||||
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
|
||||
if config.Usebzzz then
|
||||
ExecuteCommand("e c")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
||||
if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
|
||||
if not allowed then triggerNotify(nil, Loc[Config.Lan].error["no_job"], "error") return end
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.FineJobList then -- If nearby player list is wanted:
|
||||
@@ -125,17 +127,17 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["person_id"] }
|
||||
end
|
||||
--Continue adding payment options to qb-input
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local label = PlayerJob.label
|
||||
local gang = false
|
||||
local dialog = exports['qb-input']:ShowInput({ header = label.." Charge", submitText = "Send", inputs = newinputs})
|
||||
local dialog = exports['qb-input']:ShowInput({ header = label..Loc[Config.Lan].menu["charge"], submitText = Loc[Config.Lan].menu["send"], inputs = newinputs})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
|
||||
@@ -146,7 +148,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
--Get ticket info
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
|
||||
local amount = Citizen.Await(p)
|
||||
if not amount then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") amount = 0 return end
|
||||
if not amount then triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error") amount = 0 return else amount = amount.amount end
|
||||
local sellable = false
|
||||
local name = "" local label = ""
|
||||
--Check/adjust for job/gang names
|
||||
@@ -156,10 +158,10 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
end
|
||||
if sellable then -- if info is found then:
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<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" } },
|
||||
{ isMenuHeader = true, header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], txt = Loc[Config.Lan].menu["trade_confirm"] },
|
||||
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["ticket_amount"]..amount..Loc[Config.Lan].menu["total_pay"]..(Config.Jobs[name].PayPerTicket * amount) },
|
||||
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
||||
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -168,18 +170,18 @@ end)
|
||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
local img = img or ""
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
|
||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_payment"] },
|
||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper)..Loc[Config.Lan].menu["payment_amount"]..amount },
|
||||
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
|
||||
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = "🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the charge?" },
|
||||
{ isMenuHeader = true, header = "", txt = "Bank Charge: $"..amount },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
|
||||
{ isMenuHeader = true, header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_charge"] },
|
||||
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount },
|
||||
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
|
||||
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
||||
@@ -187,6 +189,6 @@ RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:c
|
||||
|
||||
AddEventHandler('onResourceStop', function(r) if r ~= GetCurrentResourceName() then return end
|
||||
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||
for i = 1, #till do DeleteEntity(till[i]) end
|
||||
for i = 1, #Till do DeleteEntity(Till[i]) end
|
||||
unloadModel(GetEntityModel(BankPed)) DeletePed(BankPed)
|
||||
end)
|
||||
end)
|
||||
|
||||
20
config.lua
20
config.lua
@@ -1,17 +1,21 @@
|
||||
print("^2Jim^7-^2Payments v^42^7.^47 ^7- ^2Payments Script by ^1Jimathy^7")
|
||||
print("^2Jim^7-^2Payments ^7v^42^7.^48^7.^45 ^7- ^2Payments Script by ^1Jimathy^7")
|
||||
|
||||
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
||||
|
||||
-- https://discord.gg/xKgQZ6wZvS
|
||||
|
||||
Config = {
|
||||
Lan = "en",
|
||||
Debug = false,
|
||||
Notify = "qb",
|
||||
|
||||
---------------------------------
|
||||
-- Default Job Payment Systems --
|
||||
---------------------------------
|
||||
Manage = true, -- "true" if using qb-management
|
||||
-- "false" if using qb-bossmenu
|
||||
|
||||
Banking = "qb", -- qb, renewed, and fd currently default supported
|
||||
|
||||
ApGov = false, -- Toggle support for AP-Goverment Tax
|
||||
|
||||
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||
@@ -34,7 +38,10 @@ Config = {
|
||||
`U_F_M_CasinoShop_01`,
|
||||
},
|
||||
|
||||
PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
||||
usebzzz = false, -- enable if you're using the prop from bzzz
|
||||
Enablecommand = true, -- Enables the cashregister command
|
||||
|
||||
PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
||||
-- This doesn't affect Cash payments as they by default use confirmation now
|
||||
-- This is helpful for phones that don't support invoices well
|
||||
|
||||
@@ -58,6 +65,7 @@ Config = {
|
||||
-- Commission is a percentage eg "0.10" becomes 10%
|
||||
Jobs = {
|
||||
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['bakery'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10, },
|
||||
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
@@ -95,7 +103,7 @@ Config = {
|
||||
BankBlips = false, -- Enable this if you disabled qb-banking and need bank locations
|
||||
ATMBlips = false, -- Enable this if you are a pyscho and need every ATM to be on the map too
|
||||
|
||||
Gabz = true, -- "true" to enable Gabz Bank locations
|
||||
Gabz = false, -- "true" to enable Gabz Bank locations
|
||||
-- this corrects the ATM/Bank Cashier + Ticket Cash in location
|
||||
|
||||
ATMModels = { `prop_atm_01`, `prop_atm_02`, `prop_atm_03`, `prop_fleeca_atm` },
|
||||
@@ -246,3 +254,5 @@ if Config.Gabz then
|
||||
vector3(264.77, 207.51, 106.28),
|
||||
}
|
||||
end
|
||||
|
||||
Loc = {}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
name "Jim-Payments"
|
||||
author "Jimathy"
|
||||
version "v2.8"
|
||||
version "v2.8.6"
|
||||
description "Payment Script By Jimathy"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
lua54 'yes'
|
||||
|
||||
dependencies { 'qb-input', 'qb-target', }
|
||||
client_scripts { 'client/*.lua' }
|
||||
shared_scripts { 'config.lua', 'shared/*.lua', 'locales/*.lua' }
|
||||
client_scripts { 'client/*.lua', }
|
||||
server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' }
|
||||
shared_scripts { 'config.lua', 'shared/*.lua' }
|
||||
133
locales/de.lua
Normal file
133
locales/de.lua
Normal file
@@ -0,0 +1,133 @@
|
||||
Loc["de"] = {
|
||||
error = {
|
||||
["cancel"] = "Abgebrochen",
|
||||
["no_one"] = "Keiner in der Nähe zum Aufladen",
|
||||
["not_onduty"] = "Nicht eingestempelt!",
|
||||
["no_job"] = "Sie haben nicht den gewünschten Beruf",
|
||||
["no_ticket"] = "Sie haben keine Tickets zum Tauschen",
|
||||
["bank_low"] = "Kontostand zu niedrig",
|
||||
["no_cash"] = "Nicht genug Bargeld",
|
||||
["saving_low"] = "Sparguthaben zu niedrig",
|
||||
["soc_low"] = "Firmenkontoguthaben zu niedrig",
|
||||
["nomoney_bank"] = "Nicht genug Geld auf Ihrer Bank",
|
||||
["error_start"] = "Fehler: Konto '",
|
||||
["error_end"] = "' nicht gefunden",
|
||||
["not_enough"] = "Sie haben nicht genug Geld zum übergeben",
|
||||
["zero"] = "Sie können nicht 0$ geben",
|
||||
["charge_zero"] = "Sie können keine $0 berechnen",
|
||||
["no_ticket_to"] = "Keine Tickets zum Tauschen",
|
||||
["customer_nocash"] = "Der Kunde hat nicht genug Bargeld, um zu bezahlen",
|
||||
["you_nocash"] = "Sie haben nicht genug Geld, um zu bezahlen",
|
||||
["decline_pay"] = " lehnte die $ ab",
|
||||
["declined_payment"] = "Sie haben die Zahlung abgelehnt",
|
||||
},
|
||||
success = {
|
||||
["draw"] = "Abgehoben $",
|
||||
["from_bank"] = " von der Bank",
|
||||
["deposited"] = "Eingezahlt $",
|
||||
["into_bank"] = " in die Bank",
|
||||
["draw_save"] = " Abhebung von Ersparnissen auf ein Bankkonto",
|
||||
["depos_save"] = " Vom Bankkonto auf das Sparkonto eingezahlt",
|
||||
["fromthe"] = " von der ",
|
||||
["into"] = " in die ",
|
||||
["account"] = " Konto",
|
||||
["sent"] = "Gesendet $",
|
||||
["recieved"] = "Empfangen $",
|
||||
["to"] = " zu ",
|
||||
["from"] = " von ",
|
||||
["you_gave"] = "Sie gaben ",
|
||||
["you_got"] = "Sie haben $",
|
||||
["invoice_start"] = " Bezahlten ihre $",
|
||||
["invoice_end"] = " Rechnung",
|
||||
["rec_rec"] = "Erhaltene Quittung",
|
||||
["commission"] = " in der Kommission",
|
||||
["trade_ticket_start"] = "Gehandelte Tickets: ",
|
||||
["trade_ticket_end"] = " Total: $",
|
||||
["inv_succ"] = "Rechnung erfolgreich gesendet",
|
||||
["inv_recieved"] = "Neue Rechnung erhalten",
|
||||
["declined"] = "Sie haben die Zahlung abgelehnt",
|
||||
["accepted_pay"] = " akzeptierte die $",
|
||||
["payment"] = " Zahlung",
|
||||
["charged"] = " wurde berechnet für $",
|
||||
["you_charged"] = "Sie wurden berechnet für $",
|
||||
["charge_end"] = " Gebühr",
|
||||
},
|
||||
blip = {
|
||||
["blip_atm"] = "ATM",
|
||||
["blip_bank"] = "Bank",
|
||||
},
|
||||
command = {
|
||||
["pay_user"] = "Einen Bürger in der Nähe bezahlen",
|
||||
["cash_reg"] = "Mobile Registrierkasse verwenden",
|
||||
["charge"] = "Eine andere Person belasten",
|
||||
},
|
||||
target = {
|
||||
["atm"] = "ATM benutzen",
|
||||
["bank"] = "Bank benutzen",
|
||||
["transfer"] = "Geld überweisen",
|
||||
["saving"] = "Zugang Ersparnisse",
|
||||
["soc_saving"] = "Zugang Firmenkonto",
|
||||
["soc_trans"] = "Firmenkonto Geldüberweisung",
|
||||
["gang_acct"] = "Gang Konto",
|
||||
["gang_trans"] = "Gang Geldtransfer",
|
||||
["charge"] = "Gebühr für den Kunden",
|
||||
["cashin_boss"] = "Bargeld in Job-Einnahmen",
|
||||
["cashin_gang"] = "Bargeld in Bandeneinnahmen",
|
||||
},
|
||||
menu = {
|
||||
["close"] = "Schließen",
|
||||
["withdraw"] = "Abheben",
|
||||
["deposit"] = "Einzahlen",
|
||||
["transfer"] = "Überweißen",
|
||||
["transfer_money"] = "Geld überweisen",
|
||||
["header_atm"] = "💵 ATM Banking 💵",
|
||||
["header_trans_amount"] = "💵 Überweisungsbetrag",
|
||||
["header_bank"] = "🏦 Banking 🏦",
|
||||
["header_trans"] = "🔀 Transferdienste 🔀",
|
||||
["header_account_no"] = "🏦 Kontonummer.",
|
||||
["header_saving"] = "💰 Ersparnisse 💰",
|
||||
["acc_atm"] = "Zugang zu ATM",
|
||||
["acc_bank"] = "Zugang Bank",
|
||||
["acc_trans"] = "Zugriff auf Überweisungen",
|
||||
["acc_saving"] = "Zugang zu Ersparnissen",
|
||||
["acc_boss"] = "Zugriff auf das Firmenkonto",
|
||||
["acc_boss_trans"] = "Zugang zu Firmenkontotransfers",
|
||||
["acc_gang"] = "Zugriff auf das Gangkonto",
|
||||
["acc_gang_trans"] = "Zugang zu Gangkontotransfers",
|
||||
["header_soc"] = "<br><br>- Firmenkonto -<br>",
|
||||
["header_balance"] = "<br><br>- Kontostand -<br>🏢",
|
||||
["header_soc_bank"] = "🏢 Firmen Banking 🏢",
|
||||
["amount_pay"] = "💵 Zu zahlender Betrag'",
|
||||
["give_cash"] = "Jemandem Bargeld geben",
|
||||
["give"] = "Geben",
|
||||
["welcome"] = "Willkommen zurück, ",
|
||||
["citizenid"] = "<br><br>- Ausweisnummer -<br>",
|
||||
["header_acc"] = "<br><br>- Konto -<br>",
|
||||
["header_info"] = "<br><br>- Konto Info -<br>Ersparnis-ID: ",
|
||||
["header_balance_bank"] = "<br><br>- Kontostand -<br>🏦Bank - $",
|
||||
["header_option"] = "<br><br>- Optionen -",
|
||||
["cash_balance"] = "<br>💵Bargeld - $",
|
||||
["bank_balance"] = "<br>🏦Bank - $",
|
||||
["saving_balance"] = "<br><br>- Kontostand -<br>💰Ersparnisses - $",
|
||||
["cus_id"] = "# Kunden ID #",
|
||||
["type"] = "Zahlungsart",
|
||||
["amount_charge"] = "💵 Zu berechnender Betrag",
|
||||
["cash_reg"] = " Registrierkasse",
|
||||
["person_id"] = "# Bürger ID #",
|
||||
["charge"] = " Laden Sie",
|
||||
["send"] = "Send",
|
||||
["receipt"] = " Quittungen 🧾",
|
||||
["payment"] = " Zahlung 🧾",
|
||||
["trade_confirm"] = "Möchten Sie Ihre Quittungen gegen Bezahlung eintauschen??",
|
||||
["accept_payment"] = "Möchten Sie die Zahlung akzeptieren?",
|
||||
["accept_charge"] = "Möchten Sie die Gebühr akzeptieren?",
|
||||
["ticket_amount"] = "Anzahl der Tickets: ",
|
||||
["total_pay"] = "<br>Gesamte Zahlung: $",
|
||||
["yes"] = "Ja",
|
||||
["no"] = "Nein",
|
||||
["cash"] = "Bargeld",
|
||||
["card"] = "Karte",
|
||||
["payment_amount"] = " Zahlung: $",
|
||||
["bank_charge"] = "Bankgebühr: $",
|
||||
},
|
||||
}
|
||||
133
locales/en.lua
Normal file
133
locales/en.lua
Normal file
@@ -0,0 +1,133 @@
|
||||
Loc["en"] = {
|
||||
error = {
|
||||
["cancel"] = "Cancelled",
|
||||
["no_one"] = "No one near by to charge",
|
||||
["not_onduty"] = "Not Clocked in!",
|
||||
["no_job"] = "You don't have the required job",
|
||||
["no_ticket"] = "You don't have any tickets to trade",
|
||||
["bank_low"] = "Bank Balance too low",
|
||||
["no_cash"] = "Not enough cash",
|
||||
["saving_low"] = "Savings Balance too low",
|
||||
["soc_low"] = "Society balance too low",
|
||||
["nomoney_bank"] = "Not enough money in your bank",
|
||||
["error_start"] = "Error: Account '",
|
||||
["error_end"] = "' not found",
|
||||
["not_enough"] = "You don't have enough cash to give",
|
||||
["zero"] = "You can't give $0",
|
||||
["charge_zero"] = "You can't charge $0",
|
||||
["no_ticket_to"] = "No tickets to trade",
|
||||
["customer_nocash"] = "Customer doesn't have enough cash to pay",
|
||||
["you_nocash"] = "You don't have enough cash to pay",
|
||||
["decline_pay"] = " declined the $",
|
||||
["declined_payment"] = "You declined the payment",
|
||||
},
|
||||
success = {
|
||||
["draw"] = "Withdrew $",
|
||||
["from_bank"] = " from the bank",
|
||||
["deposited"] = "Deposited $",
|
||||
["into_bank"] = " into the Bank",
|
||||
["draw_save"] = " Withdrawn from savings into bank account",
|
||||
["depos_save"] = " Deposited from bank account into savings",
|
||||
["fromthe"] = " from the ",
|
||||
["into"] = " into the ",
|
||||
["account"] = " account",
|
||||
["sent"] = "Sent $",
|
||||
["recieved"] = "Recieved $",
|
||||
["to"] = " to ",
|
||||
["from"] = " from ",
|
||||
["you_gave"] = "You gave ",
|
||||
["you_got"] = "You got $",
|
||||
["invoice_start"] = " Paid their $",
|
||||
["invoice_end"] = " invoice",
|
||||
["rec_rec"] = "Receipt received",
|
||||
["commission"] = " in Commission",
|
||||
["trade_ticket_start"] = "Tickets traded: ",
|
||||
["trade_ticket_end"] = " Total: $",
|
||||
["inv_succ"] = "Invoice Successfully Sent",
|
||||
["inv_recieved"] = "New Invoice Received",
|
||||
["declined"] = "You declined the payment",
|
||||
["accepted_pay"] = " accepted the $",
|
||||
["payment"] = " payment",
|
||||
["charged"] = " was charged for $",
|
||||
["you_charged"] = "You were charged for $",
|
||||
["charge_end"] = " charge",
|
||||
},
|
||||
blip = {
|
||||
["blip_atm"] = "ATM",
|
||||
["blip_bank"] = "Bank",
|
||||
},
|
||||
command = {
|
||||
["pay_user"] = "Pay a user nearby",
|
||||
["cash_reg"] = "Use mobile cash register",
|
||||
["charge"] = "Charge another person",
|
||||
},
|
||||
target = {
|
||||
["atm"] = "Use ATM",
|
||||
["bank"] = "Use Bank",
|
||||
["transfer"] = "Transfer Money",
|
||||
["saving"] = "Access Savings",
|
||||
["soc_saving"] = "Access Society Account",
|
||||
["soc_trans"] = "Society Money Transfer",
|
||||
["gang_acct"] = "Gang Society Account",
|
||||
["gang_trans"] = "Gang Money Transfer",
|
||||
["charge"] = "Charge Customer",
|
||||
["cashin_boss"] = "Cash in Job Receipts",
|
||||
["cashin_gang"] = "Cash in Gang Receipts",
|
||||
},
|
||||
menu = {
|
||||
["close"] = "Close",
|
||||
["withdraw"] = "Withdrawl",
|
||||
["deposit"] = "Deposit",
|
||||
["transfer"] = "Transfer",
|
||||
["transfer_money"] = "Transfer Money",
|
||||
["header_atm"] = "💵 ATM Banking 💵",
|
||||
["header_trans_amount"] = "💵 Amount to transfer",
|
||||
["header_bank"] = "🏦 Banking 🏦",
|
||||
["header_trans"] = "🔀 Transfer Services 🔀",
|
||||
["header_account_no"] = "🏦 Account no.",
|
||||
["header_saving"] = "💰 Savings 💰",
|
||||
["acc_atm"] = "Accessing ATM",
|
||||
["acc_bank"] = "Accessing Bank",
|
||||
["acc_trans"] = "Accessing Transfers",
|
||||
["acc_saving"] = "Accessing Savings",
|
||||
["acc_boss"] = "Accessing Society Account",
|
||||
["acc_boss_trans"] = "Accessing Society Transfers",
|
||||
["acc_gang"] = "Accessing Gang Society Account",
|
||||
["acc_gang_trans"] = "Accessing Gang Transfers",
|
||||
["header_soc"] = "<br><br>- Society Account -<br>",
|
||||
["header_balance"] = "<br><br>- Balances -<br>🏢",
|
||||
["header_soc_bank"] = "🏢 Society Banking 🏢",
|
||||
["amount_pay"] = "💵 Amount to Pay'",
|
||||
["give_cash"] = "Give someone cash",
|
||||
["give"] = "Give",
|
||||
["welcome"] = "Welcome back, ",
|
||||
["citizenid"] = "<br><br>- Citizen ID -<br>",
|
||||
["header_acc"] = "<br><br>- Account -<br>",
|
||||
["header_info"] = "<br><br>- Account Info -<br>Savings ID: ",
|
||||
["header_balance_bank"] = "<br><br>- Balances -<br>🏦Bank - $",
|
||||
["header_option"] = "<br><br>- Options -",
|
||||
["cash_balance"] = "<br>💵Cash - $",
|
||||
["bank_balance"] = "<br>🏦Bank - $",
|
||||
["saving_balance"] = "<br><br>- Balances -<br>💰Savings - $",
|
||||
["cus_id"] = "# Customer ID #",
|
||||
["type"] = "Payment Type",
|
||||
["amount_charge"] = "💵 Amount to Charge",
|
||||
["cash_reg"] = " Cash Register",
|
||||
["person_id"] = "# Person's ID #",
|
||||
["charge"] = " Charge",
|
||||
["send"] = "Send",
|
||||
["receipt"] = " Receipts 🧾",
|
||||
["payment"] = " Payment 🧾",
|
||||
["trade_confirm"] = "Do you want trade your receipts for payment?",
|
||||
["accept_payment"] = "Do you want accept the payment?",
|
||||
["accept_charge"] = "Do you want accept the charge?",
|
||||
["ticket_amount"] = "Amount of Tickets: ",
|
||||
["total_pay"] = "<br>Total Payment: $",
|
||||
["yes"] = "Yes",
|
||||
["no"] = "No",
|
||||
["cash"] = "Cash",
|
||||
["card"] = "Card",
|
||||
["payment_amount"] = " Payment: $",
|
||||
["bank_charge"] = "Bank Charge: $",
|
||||
},
|
||||
}
|
||||
227
server.lua
227
server.lua
@@ -1,227 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end Wait(0) end
|
||||
return formatted
|
||||
end
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||
for k in pairs(Config.Jobs) do
|
||||
if not QBCore.Shared.Jobs[k] and not QBCore.Shared.Gangs[k] then
|
||||
print("Jim-Payments: Config.Jobs searched for job/gang '"..k.."' and couldn't find it in the Shared")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
QBCore.Commands.Add("polcharge", "Charge another person", {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
|
||||
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||
if gang then
|
||||
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
|
||||
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3GangMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7'") 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("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-BossMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
end
|
||||
elseif not biller then --Find the biller from their citizenid
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||
end
|
||||
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 gang == nil 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 Config.TicketSystemAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil or Player ~= billed then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
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
|
||||
else
|
||||
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
|
||||
-- Commission section, does each config option separately
|
||||
local comm = tonumber(Config.Jobs[data.society].Commission)
|
||||
if Config.Commission and comm ~= 0 then
|
||||
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.CommissionDouble then
|
||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success")
|
||||
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
end
|
||||
if Config.CommissionAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil and Player ~= biller then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * comm))
|
||||
TriggerClientEvent("QBCore:Notify", Player.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player.Functions.GetItemByName("payticket") == nil then TriggerClientEvent('QBCore:Notify', source, "No tickets to trade", 'error') return
|
||||
else
|
||||
tickets = Player.Functions.GetItemByName("payticket").amount
|
||||
Player.Functions.RemoveItem('payticket', tickets)
|
||||
pay = (tickets * Config.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
||||
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
|
||||
TriggerClientEvent('QBCore:Notify', source, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success')
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb)
|
||||
if QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket') == nil then amount = 0
|
||||
else amount = QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket').amount end
|
||||
cb(amount)
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||
local src = source
|
||||
local biller = QBCore.Functions.GetPlayer(src)
|
||||
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = billed.Functions.GetMoney(billtype)
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Customer doesn't have enough cash to pay", "error")
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
||||
return
|
||||
end
|
||||
local label = biller.PlayerData.job.label
|
||||
if gang == true then label = biller.PlayerData.gang.label end
|
||||
if Config.PhoneBank == false or gang == true or billtype == "cash" then
|
||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang, outside)
|
||||
else
|
||||
if Config.PhoneType == "qb" then
|
||||
MySQL.Async.insert(
|
||||
'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})
|
||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
||||
elseif Config.PhoneType == "gks" then
|
||||
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
|
||||
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
local src = source
|
||||
local billed = QBCore.Functions.GetPlayer(src)
|
||||
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
||||
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
|
||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
||||
elseif data.accept == false then
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
||||
local src = source
|
||||
local biller = QBCore.Functions.GetPlayer(src)
|
||||
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||
local price = math.floor(tonumber(price))
|
||||
local commission = math.floor(price * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||
if price > 0 then
|
||||
if not Config.FineJobConfirmation then
|
||||
if billed.Functions.RemoveMoney("bank", price) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..price.."^7") end end
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success")
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..(price - commission))
|
||||
else
|
||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
local src = source
|
||||
local billed = QBCore.Functions.GetPlayer(src)
|
||||
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
||||
data.amount = math.floor(data.amount)
|
||||
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||
if data.accept == true then
|
||||
if billed.Functions.RemoveMoney("bank", data.amount) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..data.amount.."^7") end end
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^6$^7"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
else
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error")
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
|
||||
local onlineList = {}
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local P = QBCore.Functions.GetPlayer(v)
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname }
|
||||
end
|
||||
cb(onlineList)
|
||||
end)
|
||||
@@ -1,5 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do
|
||||
@@ -21,18 +19,18 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
--Simple transfers from bank to wallet --
|
||||
if account == "bank" or account == "atm" then
|
||||
if billtype == "withdraw" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
||||
elseif bankB >= tonumber(amount) then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["from_bank"], "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('cash', amount)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if cashB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough cash", "error")
|
||||
if cashB < amount then triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
|
||||
elseif cashB >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the Bank", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into_bank"], "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfers from bank to savings account --
|
||||
@@ -42,43 +40,52 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
|
||||
if billtype == "withdraw" then
|
||||
if savbal >= amount then
|
||||
savbal = savbal - amount
|
||||
savbal -= amount
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Withdrawn from savings into bank account", "success")
|
||||
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
elseif savbal < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Savings Balance too low", "error")
|
||||
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if amount < bankB then
|
||||
savbal = savbal + amount
|
||||
savbal += amount
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Deposited from bank account into savings", "success")
|
||||
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
else TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
|
||||
end
|
||||
end
|
||||
--Simple transfers from society account to bank --
|
||||
elseif account == "society" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(society) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
if tonumber(society) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
||||
elseif tonumber(society) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Config.Banking == "qb" then
|
||||
exports['Renewed-Banking']:addAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
end
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from boss account to players --
|
||||
@@ -99,38 +106,45 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount) end
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
end
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.job.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
|
||||
end
|
||||
end
|
||||
|
||||
--Simple transfers from gang society account to bank --
|
||||
elseif account == "gang" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(gsociety) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
if tonumber(gsociety) < amount then triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
|
||||
elseif tonumber(gsociety) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.gang.label..Loc[Config.Lan].success["account"], "success", src)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if Config.Banking == "renewed" then exports['Renewed-Banking']:removeAccountMoney( tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "qb" then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "fd" then exports.fd_banking:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
if bankB < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if Config.Banking == "rewnewed" then exports['Renewed-Banking']:addAccountMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "qb" then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "fd" then exports.fd_banking:AddGangMoney(tostring(Player.PlayerData.gang.name), amount) end
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.gang.label..Loc[Config.Lan].success["account"], "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from gang account to players --
|
||||
@@ -151,18 +165,23 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:removeAccountMoney( tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
end
|
||||
if not Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, Reciever.PlayerData.source, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.gang.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -187,14 +206,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["sent"]..cv(amount)..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -212,7 +231,7 @@ QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
|
||||
local gsociety = 0
|
||||
|
||||
-- If qb-management, grab info directly from database
|
||||
if Config.Manage then
|
||||
if not Config.Banking == "renewed" then
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM management_funds')
|
||||
for _, v in pairs(result) do
|
||||
if Player.PlayerData.job.name == v.job_name then society = v.amount end
|
||||
@@ -247,7 +266,7 @@ QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
|
||||
gsociety = gsociety})
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
|
||||
QBCore.Commands.Add("cashgive", Loc[Config.Lan].command["pay_user"], {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
@@ -258,11 +277,12 @@ RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
||||
if amount and amount > 0 then
|
||||
if balance >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["you_gave"]..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
|
||||
Reciever.Functions.AddMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["you_got"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
|
||||
elseif balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
||||
triggerNotify(nil, Loc[Config.Lan].error["not_enough"], "error", source)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't give $0", 'error') end
|
||||
end)
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["zero"], 'error', source) end
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
@@ -14,23 +13,41 @@ AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName(
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
QBCore.Commands.Add("polcharge", "Charge another person", {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
|
||||
|
||||
CreateThread(function()
|
||||
if Config.Enablecommand then
|
||||
QBCore.Commands.Add("cashregister", Loc[Config.Lan].command["cash_reg"], {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("polcharge", Loc[Config.Lan].command["charge"], {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
|
||||
local takecomm = math.floor(tonumber(data.amount) * Config.Jobs[data.society].Commission)
|
||||
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("^5Debug^7: ^3QB^7-^3Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
|
||||
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3GangMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7'") end
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.gang.name), data.amount - takecomm)
|
||||
if Config.Debug then
|
||||
print("^5Debug^7: ^3Renewed-Banking^7(^3Gang^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney(biller.PlayerData.gang.name).."^7)") end
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount - takecomm)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount - takecomm)
|
||||
if Config.Debug then print("^5Debug^7: ^3FD-Banking^7(^3Gang^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports.fd_banking:GetGangAccount(biller.PlayerData.gang.name).."^7)") 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("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-BossMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
if Config.Banking == "renewed"
|
||||
then exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), data.amount - takecomm)
|
||||
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..tostring(exports['Renewed-Banking']:getAccountMoney(biller.PlayerData.job.name)).."^7)") end
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - takecomm)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:AddMoney(tostring(biller.PlayerData.job.name), data.amount - takecomm)
|
||||
if Config.Debug then print("^5Debug^7: ^3FD-Banking^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports.fd_banking:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
end
|
||||
end
|
||||
elseif not biller then --Find the biller from their citizenid
|
||||
@@ -38,55 +55,53 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.PlayerData.source)
|
||||
end
|
||||
|
||||
local duty = true
|
||||
if not biller.PlayerData.job.onduty or gang == nil then duty = false end
|
||||
|
||||
-- If ticket system enabled, do this
|
||||
if duty and Config.TicketSystem then
|
||||
if (biller.PlayerData.job.onduty or gang) and Config.TicketSystem then
|
||||
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
|
||||
if Config.TicketSystemAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil or Player ~= billed then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
if gang then
|
||||
if Player.PlayerData.gang.name == data.society then
|
||||
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
|
||||
end
|
||||
else
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
|
||||
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
|
||||
else
|
||||
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)
|
||||
if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
|
||||
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Commission section, does each config option separately
|
||||
local comm = tonumber(Config.Jobs[data.society].Commission)
|
||||
if Config.Commission and comm ~= 0 then
|
||||
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.CommissionDouble then
|
||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * (comm *2))..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
|
||||
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
|
||||
end
|
||||
if Config.CommissionAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil and Player ~= biller then
|
||||
if Player and Player ~= biller then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * comm))
|
||||
TriggerClientEvent("QBCore:Notify", Player.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.PlayerData.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -96,14 +111,14 @@ end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player.Functions.GetItemByName("payticket") then TriggerClientEvent('QBCore:Notify', source, "No tickets to trade", 'error') return
|
||||
if not Player.Functions.GetItemByName("payticket") then triggerNotify(nil, Loc[Config.Lan].error["no_ticket_to"], 'error', source) return
|
||||
else
|
||||
tickets = Player.Functions.GetItemByName("payticket").amount
|
||||
Player.Functions.RemoveItem('payticket', tickets)
|
||||
pay = (tickets * Config.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
||||
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
|
||||
TriggerClientEvent('QBCore:Notify', source, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success')
|
||||
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', source)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -119,8 +134,8 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
local balance = billed.Functions.GetMoney(billtype)
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Customer doesn't have enough cash to pay", "error")
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
||||
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
|
||||
return
|
||||
end
|
||||
local label = biller.PlayerData.job.label
|
||||
@@ -131,7 +146,11 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
if Config.PhoneType == "qb" then
|
||||
MySQL.Async.insert(
|
||||
'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}, function(id)
|
||||
if id then
|
||||
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.PlayerData.source, id, biller.PlayerData.charinfo.firstname, biller.PlayerData.job.name, biller.PlayerData.citizenid, amount, GetInvokingResource())
|
||||
end
|
||||
end)
|
||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
||||
elseif Config.PhoneType == "gks" then
|
||||
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
|
||||
@@ -142,13 +161,13 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
['@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' })
|
||||
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = Loc[Config.Lan].success["inv_succ"], img= '/html/static/img/icons/logo.png' })
|
||||
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = Loc[Config.Lan].success["inv_recieved"], img= '/html/static/img/icons/logo.png' })
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
||||
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.PlayerData.source)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
@@ -159,11 +178,12 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
if data.gang == true then newdata.society = biller.PlayerData.gang.name end
|
||||
if data.accept == true then
|
||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
|
||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
|
||||
elseif data.accept == false then
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error")
|
||||
triggerNotify(nil, Loc[Config.Lan].success["declined"], nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -176,20 +196,25 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
||||
if price > 0 then
|
||||
if not Config.FineJobConfirmation then
|
||||
if billed.Functions.RemoveMoney("bank", price) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..price.."^7") end end
|
||||
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", price) end
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney((biller.PlayerData.job.name).."^7)")) end
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..(price - takecomm).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:AddMoney(tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..(price - takecomm).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports.fd_banking:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success")
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..(price - commission))
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
|
||||
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.PlayerData.source)
|
||||
else
|
||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
@@ -200,18 +225,23 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||
if data.accept == true then
|
||||
if billed.Functions.RemoveMoney("bank", data.amount) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..data.amount.."^7") end end
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
|
||||
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["charge_end"], "success", data.biller)
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..(data.amount - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney((biller.PlayerData.job.name).."^7)")) end
|
||||
elseif Config.Banking == "qb" then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
else
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^6$^7"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
if Config.Debug then print("^5Debug^7: ^3FD-Banking^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports.fd_banking:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||
end
|
||||
else
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error")
|
||||
triggerNotify(nil, Loc[Config.Lan].error["declined_payment"], nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..Loc[Config.Lan].success["charge_end"], "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -222,4 +252,13 @@ QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source,
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname }
|
||||
end
|
||||
cb(onlineList)
|
||||
end)
|
||||
|
||||
|
||||
CreateThread(function()
|
||||
if Config.Usebzzz then
|
||||
QBCore.Functions.CreateUseableItem('terminal', function(source, item)
|
||||
TriggerClientEvent("jim-payments:client:Charge", source, {}, true)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -1,20 +1,19 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local time = 1000
|
||||
function loadModel(model) if not HasModelLoaded(model) then
|
||||
if Config.Debug then print("^5Debug^7: ^2Loading Model^7: '^6"..model.."^7'") end
|
||||
while not HasModelLoaded(model) do
|
||||
if time > 0 then time = time - 1 RequestModel(model)
|
||||
if time > 0 then time -= 1 RequestModel(model)
|
||||
else time = 1000 print("^5Debug^7: ^3LoadModel^7: ^2Timed out loading model ^7'^6"..model.."^7'") break
|
||||
end
|
||||
Wait(10)
|
||||
end
|
||||
end end
|
||||
function unloadModel(model) if Config.Debug then print("^5Debug^7: ^2Removing Model^7: '^6"..model.."^7'") end SetModelAsNoLongerNeeded(model) end
|
||||
function loadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Loading Anim Dictionary^7: '^6"..dict.."^7'") end while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Wait(5) end end
|
||||
function loadAnimDict(dict) if not HasAnimDictLoaded(dict) then if Config.Debug then print("^5Debug^7: ^2Loading Anim Dictionary^7: '^6"..dict.."^7'") end while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Wait(5) end end end
|
||||
function unloadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Anim Dictionary^7: '^6"..dict.."^7'") end RemoveAnimDict(dict) end
|
||||
function loadPtfxDict(dict) if Config.Debug then print("^5Debug^7: ^2Loading Ptfx Dictionary^7: '^6"..dict.."^7'") end while not HasNamedPtfxAssetLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end end
|
||||
function loadPtfxDict(dict) if not HasNamedPtfxAssetLoaded(dict) then if Config.Debug then print("^5Debug^7: ^2Loading Ptfx Dictionary^7: '^6"..dict.."^7'") end while not HasNamedPtfxAssetLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end end end
|
||||
function unloadPtfxDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Ptfx Dictionary^7: '^6"..dict.."^7'") end RemoveNamedPtfxAsset(dict) end
|
||||
|
||||
function lookEnt(entity)
|
||||
@@ -44,7 +43,7 @@ end
|
||||
|
||||
function makeProp(data, freeze, synced)
|
||||
loadModel(data.prop)
|
||||
local prop = CreateObject(data.prop, data.coords.x, data.coords.y, data.coords.z-1.03, synced or false, synced or false, 0)
|
||||
local prop = CreateObject(data.prop, data.coords.x, data.coords.y, data.coords.z, synced or false, synced or false, 0)
|
||||
SetEntityHeading(prop, data.coords.w+180.0)
|
||||
FreezeEntityPosition(prop, freeze or 0)
|
||||
if Config.Debug then print("^5Debug^7: ^6Prop ^2Created ^7: '^6"..prop.."^7'") end
|
||||
@@ -83,11 +82,11 @@ end
|
||||
|
||||
function triggerNotify(title, message, type, src)
|
||||
if Config.Notify == "okok" then
|
||||
if not src then exports['okokNotify']:Alert(title, message, 6000, type)
|
||||
else TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type) end
|
||||
if not src then exports['okokNotify']:Alert(title, message, 6000, type or 'info')
|
||||
else TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type or 'info') end
|
||||
elseif Config.Notify == "qb" then
|
||||
if not src then TriggerEvent("QBCore:Notify", message, type)
|
||||
else TriggerClientEvent("QBCore:Notify", src, message, type) end
|
||||
if not src then TriggerEvent("QBCore:Notify", message, "primary")
|
||||
else TriggerClientEvent("QBCore:Notify", src, message, "primary") end
|
||||
elseif Config.Notify == "t" then
|
||||
if not src then exports['t-notify']:Custom({title = title, style = type, message = message, sound = true})
|
||||
else TriggerClientEvent('t-notify:client:Custom', src, { style = type, duration = 6000, title = title, message = message, sound = true, custom = true}) end
|
||||
@@ -105,11 +104,11 @@ function pairsByKeys(t)
|
||||
for n in pairs(t) do a[#a+1] = n end
|
||||
table.sort(a)
|
||||
local i = 0
|
||||
local iter = function() i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end
|
||||
local iter = function() i += 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end
|
||||
return iter
|
||||
end
|
||||
|
||||
function countTable(table) local i = 0 for keys in pairs(table) do i = i + 1 end return i end
|
||||
function countTable(table) local i = 0 for keys in pairs(table) do i += 1 end return i end
|
||||
|
||||
function cv(amount)
|
||||
local formatted = amount
|
||||
@@ -118,6 +117,4 @@ function cv(amount)
|
||||
if (k==0) then break end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
function toggleItem(give, item, amount) TriggerServerEvent("jim-mining:server:toggleItem", give, item, amount) end
|
||||
end
|
||||
Reference in New Issue
Block a user