mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 14:56:02 +01:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41bedcc6ca | ||
|
|
a4413ea5c6 | ||
|
|
8adf3c3829 | ||
|
|
f5753df4b2 | ||
|
|
ec9dc51ccf | ||
|
|
4b028d75b1 | ||
|
|
2302ff987b | ||
|
|
d29d2d6904 | ||
|
|
f535df6b9c | ||
|
|
170f680ef8 | ||
|
|
2fc3b56e22 | ||
|
|
a18db3d6b9 | ||
|
|
da5e4c604f | ||
|
|
284700bafb | ||
|
|
ee532d5e3e |
@@ -64,8 +64,7 @@ Go to gks-phone > server > serverapi.lua
|
|||||||
|
|
||||||
- Add these lines:
|
- Add these lines:
|
||||||
```lua
|
```lua
|
||||||
local data = { society = id.society, amount = amount }
|
TriggerEvent('jim-payments:Tickets:Give', { sender = Ply.PlayerData.charinfo.firstname, senderCitizenId = data[1].sendercitizenid, society = data[1].society, amount = data[1].amount })
|
||||||
TriggerServerEvent('jim-payments:Tickets:Give', data)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
21
atms.lua
21
atms.lua
@@ -21,10 +21,12 @@ local function cv(amount)
|
|||||||
return formatted
|
return formatted
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function loadModel(model) if Config.Debug then print("Debug: Loading Model: '"..model.."'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end
|
||||||
|
local function unloadModel(model) if Config.Debug then print("Debug: Removing Model: '"..model.."'") end SetModelAsNoLongerNeeded(model) end
|
||||||
|
|
||||||
local bossroles = {}
|
local bossroles = {}
|
||||||
local gangroles = {}
|
local gangroles = {}
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
|
|
||||||
if Config.useATM then
|
if Config.useATM then
|
||||||
if Config.ATMBlips then
|
if Config.ATMBlips then
|
||||||
for k, v in pairs(Config.WallATMLocations) do
|
for k, v in pairs(Config.WallATMLocations) do
|
||||||
@@ -38,7 +40,7 @@ CreateThread(function()
|
|||||||
AddTextComponentString("ATM")
|
AddTextComponentString("ATM")
|
||||||
EndTextCommandSetBlipName(blip)
|
EndTextCommandSetBlipName(blip)
|
||||||
end
|
end
|
||||||
for k, v in pairs(ATMLoc) do
|
for k, v in pairs(Config.ATMLocations) do
|
||||||
blip = AddBlipForCoord(v)
|
blip = AddBlipForCoord(v)
|
||||||
SetBlipSprite(blip, 108)
|
SetBlipSprite(blip, 108)
|
||||||
SetBlipDisplay(blip, 4)
|
SetBlipDisplay(blip, 4)
|
||||||
@@ -53,7 +55,7 @@ CreateThread(function()
|
|||||||
end
|
end
|
||||||
if Config.useBanks then
|
if Config.useBanks then
|
||||||
if Config.BankBlips then
|
if Config.BankBlips then
|
||||||
for k,v in pairs(BankLoc) do
|
for k,v in pairs(Config.BankLocations) do
|
||||||
for l, b in pairs(v) do
|
for l, b in pairs(v) do
|
||||||
blip = AddBlipForCoord(b)
|
blip = AddBlipForCoord(b)
|
||||||
SetBlipSprite(blip, 108)
|
SetBlipSprite(blip, 108)
|
||||||
@@ -106,7 +108,7 @@ CreateThread(function()
|
|||||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||||
}, distance = 1.5 })
|
}, distance = 1.5 })
|
||||||
end
|
end
|
||||||
for k,v in pairs(ATMLoc) do
|
for k,v in pairs(Config.ATMLocations) do
|
||||||
Targets["jimatm"..k] =
|
Targets["jimatm"..k] =
|
||||||
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
|
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||||
@@ -115,7 +117,7 @@ CreateThread(function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Config.useBanks then
|
if Config.useBanks then
|
||||||
for k,v in pairs(BankLoc) do
|
for k,v in pairs(Config.BankLocations) do
|
||||||
for l, b in pairs(v) do
|
for l, b in pairs(v) do
|
||||||
Targets["jimbank"..k..l] =
|
Targets["jimbank"..k..l] =
|
||||||
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
|
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
|
||||||
@@ -131,8 +133,8 @@ CreateThread(function()
|
|||||||
distance = 2.5 })
|
distance = 2.5 })
|
||||||
if Config.Peds then
|
if Config.Peds then
|
||||||
local i = math.random(1, #Config.PedPool)
|
local i = math.random(1, #Config.PedPool)
|
||||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
loadModel(Config.PedPool[i])
|
||||||
if Peds["jimbank"..k..l] == nil then Peds["jimbank"..k..l] = CreatePed(0, Config.PedPool[i], vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)), b[4], false, false) 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("Ped Created - 'jimbank"..k..l.."'") end
|
if Config.Debug then print("Ped Created - 'jimbank"..k..l.."'") end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -298,6 +300,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
|||||||
|
|
||||||
Wait(atmbartime+500)
|
Wait(atmbartime+500)
|
||||||
if not cancelled then
|
if not cancelled then
|
||||||
|
cancelled = false
|
||||||
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 = "Transfer", inputs = setinputs })
|
||||||
if dialog then
|
if dialog then
|
||||||
if not dialog.amount then return end
|
if not dialog.amount then return end
|
||||||
@@ -337,6 +340,6 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||||
for k, v in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||||
for k, v in pairs(Peds) do DeletePed(Peds[k]) end
|
for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
|
||||||
end)
|
end)
|
||||||
158
client.lua
158
client.lua
@@ -1,8 +1,11 @@
|
|||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
local QBCore = exports['qb-core']:GetCoreObject()
|
||||||
|
|
||||||
PlayerJob = {}
|
PlayerJob = {}
|
||||||
|
PlayerGang = {}
|
||||||
|
|
||||||
local onDuty = false
|
local onDuty = false
|
||||||
local BankPed = {}
|
local BankPed = nil
|
||||||
|
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
RegisterNetEvent('QBCore:Client: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:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
||||||
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||||
@@ -10,81 +13,162 @@ RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = G
|
|||||||
|
|
||||||
--Keeps track of duty on script restarts
|
--Keeps track of duty on script restarts
|
||||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||||
QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end)
|
QBCore.Functions.GetPlayerData(function(PlayerData)
|
||||||
|
PlayerJob = PlayerData.job
|
||||||
|
PlayerGang = PlayerData.gang
|
||||||
|
onDuty = PlayerJob.onduty
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local function loadModel(model) if Config.Debug then print("Debug: Loading Model: '"..model.."'") end RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end
|
||||||
|
local function unloadModel(model) if Config.Debug then print("Debug: Removing Model: '"..model.."'") end SetModelAsNoLongerNeeded(model) end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
local jobroles = {}
|
local jobroles = {} local gangroles = {}
|
||||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
--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
|
||||||
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
||||||
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
|
{ options = {
|
||||||
|
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in 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
|
if Config.Peds then
|
||||||
local i = math.random(1, #Config.PedPool)
|
local i = math.random(1, #Config.PedPool)
|
||||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
loadModel(Config.PedPool[i])
|
||||||
if not BankPed[1] then BankPed[1] = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
|
if not BankPed then BankPed = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
|
||||||
if Config.Debug then print("Ped Created for Ticket Trade") end
|
if Config.Debug then print("Ped Created for Ticket Trade") end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||||
if outside == nil then outside = false end
|
--Check if player is using /cashregister command
|
||||||
if not outside and not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
|
if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
|
||||||
local onlineList = {}
|
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 = {}
|
local nearbyList = {}
|
||||||
local p = promise.new()
|
--Convert list of players nearby into one qb-input understands + add distance info
|
||||||
QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
|
for _, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||||
onlineList = Citizen.Await(p)
|
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
|
||||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||||
for i = 1, #onlineList do
|
for i = 1, #onlineList do
|
||||||
if onlineList[i].value == GetPlayerServerId(v) then
|
if onlineList[i].value == GetPlayerServerId(v) then
|
||||||
if v ~= PlayerId() 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)' }
|
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dist = nil
|
|
||||||
end
|
end
|
||||||
if not data.img then img = "" else img = data.img end
|
--If list is empty(no one nearby) show error and stop
|
||||||
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
if not nearbyList[#nearbyList] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||||
local newinputs = {}
|
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||||
if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
|
else -- If Config.List is false, create input text box for ID's
|
||||||
if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
|
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 = '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 = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||||
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send", inputs = newinputs})
|
--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 dialog then
|
||||||
if not dialog.citizen or not dialog.price then return end
|
if not dialog.citizen or not dialog.price then return end
|
||||||
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside)
|
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||||
local amount = 0
|
--Check if player is allowed to use /cashregister command
|
||||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
local allowed = false
|
||||||
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
||||||
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
|
||||||
else exports['qb-menu']:openMenu({
|
|
||||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
local newinputs = {} -- Begin qb-input creation here.
|
||||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
|
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[#nearbyList] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||||
|
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||||
|
else -- If Config.List is false, create input text box for ID's
|
||||||
|
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
|
||||||
|
end
|
||||||
|
--Continue adding payment options to qb-input
|
||||||
|
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||||
|
--Grab Player Job name or Gang Name if needed
|
||||||
|
local label = PlayerJob.label
|
||||||
|
local gang = false
|
||||||
|
local dialog = exports['qb-input']:ShowInput({ header = label.." Charge", submitText = "Send", inputs = newinputs})
|
||||||
|
if dialog then
|
||||||
|
if not dialog.citizen or not dialog.price then return end
|
||||||
|
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||||
|
--Get ticket info
|
||||||
|
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
|
||||||
|
local amount = Citizen.Await(p)
|
||||||
|
if amount == 0 then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
||||||
|
local sellable = false
|
||||||
|
local name = "" local label = ""
|
||||||
|
--Check/adjust for job/gang names
|
||||||
|
for k, v in pairs(Config.Jobs) do
|
||||||
|
if data.gang then if v.gang and k == PlayerGang.name then name = k label = PlayerGang.label sellable = true end
|
||||||
|
else if not v.gang and k == PlayerJob.name then name = k label = PlayerJob.label sellable = true end
|
||||||
|
end
|
||||||
|
if sellable then -- if info is found then:
|
||||||
|
exports['qb-menu']:openMenu({
|
||||||
|
{ isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||||
|
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<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-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
||||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, })
|
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||||
if not img then img = "" end
|
local img = img or ""
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||||
{ 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 } } },
|
{ 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 } } }, })
|
{ 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)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
||||||
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||||
exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed[1])
|
exports['qb-target']:RemoveZone("JimBank") unloadModel(GetEntityModel(BankPed)) DeletePed(BankPed)
|
||||||
end)
|
end)
|
||||||
145
config.lua
145
config.lua
@@ -1,66 +1,62 @@
|
|||||||
print("Jim-Payments v2.5 - Payments Script by Jimathy")
|
print("Jim-Payments v2.7 - Payments Script by Jimathy")
|
||||||
|
|
||||||
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
-- 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
|
-- https://discord.gg/xKgQZ6wZvS
|
||||||
|
|
||||||
Config = {}
|
Config = {
|
||||||
|
Debug = true,
|
||||||
Config.Debug = false
|
Manage = true, -- "true" if using qb-management
|
||||||
|
|
||||||
Config.Manage = false -- "true" if using qb-management
|
|
||||||
-- "false" if using qb-bossmenu
|
-- "false" if using qb-bossmenu
|
||||||
|
TicketSystem = true, -- Enable this if you want to use the ticket system false
|
||||||
|
|
||||||
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||||
|
PaymentRadius = 30, -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||||
|
|
||||||
Config.List = true -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
Peds = true, -- "true" to enable peds spawning in banks
|
||||||
Config.PaymentRadius = 30 -- This is how far the playerlist will check for nearby players (based on the person charging)
|
PedPool = {
|
||||||
|
`IG_Bankman`,
|
||||||
|
`U_M_M_BankMan`,
|
||||||
|
`S_F_M_Shop_HIGH`,
|
||||||
|
`S_M_M_HighSec_02`,
|
||||||
|
`S_M_M_HighSec_03`,
|
||||||
|
`S_M_M_HighSec_04`,
|
||||||
|
`A_F_Y_Business_01`,
|
||||||
|
`A_F_Y_Business_02`,
|
||||||
|
`A_F_Y_Business_03`,
|
||||||
|
`A_F_Y_Business_04`,
|
||||||
|
`A_M_M_Business_01`,
|
||||||
|
`A_M_Y_Business_02`,
|
||||||
|
`A_M_Y_Business_03`,
|
||||||
|
`U_F_M_CasinoShop_01`,
|
||||||
|
},
|
||||||
|
useATM = true, -- Enable this to use the scripts ATM's and controls
|
||||||
|
useBanks = true, -- Enable this to use my banking stuff
|
||||||
|
BankBlips = true, -- Enable this if you disabled qb-banking and need bank locations
|
||||||
|
ATMBlips = false, -- Enable this if you are a pyscho and need every ATM to be on the map too
|
||||||
|
|
||||||
Config.Peds = true -- "true" to enable peds spawning in banks
|
PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
||||||
Config.PedPool = {
|
|
||||||
[1] = `IG_Bankman`,
|
|
||||||
[2] = `U_M_M_BankMan`,
|
|
||||||
[3] = `S_F_M_Shop_HIGH`,
|
|
||||||
[4] = `S_M_M_HighSec_02`,
|
|
||||||
[5] = `S_M_M_HighSec_03`,
|
|
||||||
[6] = `S_M_M_HighSec_04`,
|
|
||||||
[7] = `A_F_Y_Business_01`,
|
|
||||||
[8] = `A_F_Y_Business_02`,
|
|
||||||
[9] = `A_F_Y_Business_03`,
|
|
||||||
[10] = `A_F_Y_Business_04`,
|
|
||||||
[11] = `A_M_M_Business_01`,
|
|
||||||
[12] = `A_M_Y_Business_02`,
|
|
||||||
[13] = `A_M_Y_Business_03`,
|
|
||||||
[14] = `U_F_M_CasinoShop_01`,
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.Gabz = true -- "true" to enable Gabz Banking locations
|
|
||||||
Config.useATM = true -- Enable this to use my ATM's
|
|
||||||
Config.useBanks = true -- Enable this to use my banking stuff
|
|
||||||
Config.BankBlips = true -- Enable this if you disabled qb-banking and need bank locations
|
|
||||||
Config.ATMBlips = false -- Enable this if you are a pyscho and need every ATM to be on the map too
|
|
||||||
|
|
||||||
Config.PhoneBank = true -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
|
||||||
-- This doesn't affect Cash payments as they by default use confirmation now
|
-- This doesn't affect Cash payments as they by default use confirmation now
|
||||||
-- This is helpful for phones that don't support invoices well
|
-- This is helpful for phones that don't support invoices well
|
||||||
|
|
||||||
Config.PhoneType = "qb" -- Change this setting to make invoices work with your phone script [still testing this currently]
|
PhoneType = "qb", -- Change this setting to make invoices work with your phone script [still testing this currently]
|
||||||
-- "qb" for qb-phone
|
-- "qb" for qb-phone
|
||||||
-- "gks"" for GKSPhone
|
-- "gks"" for GKSPhone
|
||||||
|
|
||||||
Config.Commission = false -- Set this to true to enable Commissions and give the person charging a percentage of the total
|
CashInLocation = vector4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
|
||||||
Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
|
|
||||||
Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
|
Commission = true, -- Set this to true to enable Commissions and give the person charging a percentage of the total
|
||||||
Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
|
CommissionAll = false, -- Set this to true to give commission to workers clocked in
|
||||||
|
CommissionDouble = false, -- Set this to true if you want the person charging to get double Commission
|
||||||
|
CommissionLimit = false, -- If true, this limits the Commission to only be given if over the "MinAmountForTicket".
|
||||||
|
-- If false, Commission will be given for any amount
|
||||||
|
|
||||||
|
Gabz = true, -- "true" to enable Gabz Bank locations
|
||||||
|
|
||||||
-- MinAmountforTicket should be your cheapest item
|
-- MinAmountforTicket should be your cheapest item
|
||||||
-- PayPerTicket should never be higher than MinAmountforTicket
|
-- PayPerTicket should never be higher than MinAmountforTicket
|
||||||
-- Commission is a percentage eg "0.10" becomes 10%
|
-- Commission is a percentage eg "0.10" becomes 10%
|
||||||
|
Jobs = {
|
||||||
Config.CashInLocation = vector4(252.23, 223.11, 106.29, 159.2) -- Default Third Window along in Pacific Bank
|
|
||||||
if Config.Gabz then Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0) end -- Middle along in Pacific Bank (Gabz)
|
|
||||||
|
|
||||||
Config.Jobs = {
|
|
||||||
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10, },
|
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10, },
|
||||||
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
@@ -70,27 +66,21 @@ Config.Jobs = {
|
|||||||
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||||
}
|
['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true, },
|
||||||
|
},
|
||||||
|
|
||||||
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
-- The /polcharge command requires specific jobs to be set
|
||||||
|
-- No tickets for these, it's just commission
|
||||||
|
FineJobs = {
|
||||||
|
['police'] = { Commission = 0.25, },
|
||||||
|
['ambulance'] = { Commission = 0.25, },
|
||||||
|
},
|
||||||
|
FineJobConfirmation = true, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
|
||||||
|
FineJobList = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||||
|
|
||||||
Config.GabzATMLocations = {
|
ATMModels = { "prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" },
|
||||||
--PACIFIC BANK 12 ATMS (GABZ)
|
|
||||||
vector3(239.02, 212.37, 106.28),
|
|
||||||
vector3(239.46, 213.6, 106.28),
|
|
||||||
vector3(239.9, 214.82, 106.28),
|
|
||||||
vector3(240.35, 216.03, 106.28),
|
|
||||||
vector3(241.42, 218.96, 106.28),
|
|
||||||
vector3(241.86, 220.16, 106.28),
|
|
||||||
vector3(242.3, 221.41, 106.28),
|
|
||||||
vector3(242.76, 222.63, 106.28),
|
|
||||||
vector3(263.46, 203.86, 106.28),
|
|
||||||
vector3(263.96, 205.03, 106.28),
|
|
||||||
vector3(264.37, 206.28, 106.28),
|
|
||||||
vector3(264.77, 207.51, 106.28),
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.VanATMLocations = {
|
ATMLocations = {
|
||||||
--PACIFIC BANK 10 ATMS
|
--PACIFIC BANK 10 ATMS
|
||||||
vector3(265.9, 213.86, 106.28),
|
vector3(265.9, 213.86, 106.28),
|
||||||
vector3(265.56, 212.98, 106.28),
|
vector3(265.56, 212.98, 106.28),
|
||||||
@@ -102,10 +92,9 @@ Config.VanATMLocations = {
|
|||||||
vector3(237.5, 217.87, 106.29),
|
vector3(237.5, 217.87, 106.29),
|
||||||
vector3(237.93, 216.94, 106.29),
|
vector3(237.93, 216.94, 106.29),
|
||||||
vector3(238.36, 216.03, 106.29),
|
vector3(238.36, 216.03, 106.29),
|
||||||
}
|
},
|
||||||
|
|
||||||
--QB-Target doesn't seem to like ALL ATM Props so need to manually add locations
|
--QB-Target doesn't seem to like ALL ATM Props so need to manually add locations
|
||||||
Config.WallATMLocations = {
|
WallATMLocations = {
|
||||||
vector3(-386.54, 6046.29, 31.5),
|
vector3(-386.54, 6046.29, 31.5),
|
||||||
vector3(-282.82, 6226.24, 31.49),
|
vector3(-282.82, 6226.24, 31.49),
|
||||||
vector3(-132.74, 6366.79, 31.48),
|
vector3(-132.74, 6366.79, 31.48),
|
||||||
@@ -158,9 +147,8 @@ Config.WallATMLocations = {
|
|||||||
vector3(-303.23, -829.44, 32.43),
|
vector3(-303.23, -829.44, 32.43),
|
||||||
vector3(5.27, -919.87, 29.56),
|
vector3(5.27, -919.87, 29.56),
|
||||||
vector3(-1200.61, -885.62, 13.26),
|
vector3(-1200.61, -885.62, 13.26),
|
||||||
}
|
},
|
||||||
|
BankLocations = {
|
||||||
Config.VanBankLocations = {
|
|
||||||
["legion"] = {
|
["legion"] = {
|
||||||
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||||
},
|
},
|
||||||
@@ -186,9 +174,11 @@ Config.VanBankLocations = {
|
|||||||
vector4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
|
vector4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
|
||||||
vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
if Config.Gabz then -- If Gabz banks enabled, load these locations instead
|
||||||
Config.GabzBankLocations = {
|
Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0)
|
||||||
|
Config.BankLocations = {
|
||||||
["legion"] = {
|
["legion"] = {
|
||||||
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||||
},
|
},
|
||||||
@@ -220,3 +210,18 @@ Config.GabzBankLocations = {
|
|||||||
vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
|
vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Config.ATMLocations = {
|
||||||
|
vector3(239.02, 212.37, 106.28),
|
||||||
|
vector3(239.46, 213.6, 106.28),
|
||||||
|
vector3(239.9, 214.82, 106.28),
|
||||||
|
vector3(240.35, 216.03, 106.28),
|
||||||
|
vector3(241.42, 218.96, 106.28),
|
||||||
|
vector3(241.86, 220.16, 106.28),
|
||||||
|
vector3(242.3, 221.41, 106.28),
|
||||||
|
vector3(242.76, 222.63, 106.28),
|
||||||
|
vector3(263.46, 203.86, 106.28),
|
||||||
|
vector3(263.96, 205.03, 106.28),
|
||||||
|
vector3(264.37, 206.28, 106.28),
|
||||||
|
vector3(264.77, 207.51, 106.28),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "v2.5"
|
version "v2.7"
|
||||||
description "Payment Script By Jimathy"
|
description "Payment Script By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
108
server.lua
108
server.lua
@@ -7,39 +7,60 @@ local function cv(amount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||||
for k, v in pairs(Config.Jobs) do if not QBCore.Shared.Jobs[k] then print("Jim-Payments: Config.Jobs searched for job '"..k.."' and couldn't find it in the Shared") end end
|
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)
|
end)
|
||||||
|
|
||||||
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) 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)
|
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||||
--Find the biller from their citizenid
|
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
|
||||||
if not biller then
|
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
if gang then
|
||||||
|
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
|
||||||
|
if Config.Debug then print("QB-Management(Gang): Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
|
||||||
|
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
|
||||||
|
if Config.Debug then print("QB-GangMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
|
||||||
|
end
|
||||||
|
elseif not gang then
|
||||||
|
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
||||||
|
if Config.Debug then print("QB-Management(Job): Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||||
|
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
||||||
|
if Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not biller then --Find the biller from their citizenid
|
||||||
|
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||||
local Player = QBCore.Functions.GetPlayer(v)
|
local Player = QBCore.Functions.GetPlayer(v)
|
||||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||||
end
|
end
|
||||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||||
end
|
end
|
||||||
|
|
||||||
local duty = true
|
local duty = true
|
||||||
if biller.PlayerData.job.onduty then duty = true else duty = false end
|
if not biller.PlayerData.job.onduty or gang == nil then duty = false end
|
||||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
|
||||||
if Config.Debug then print("QB-Management: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
|
||||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
|
||||||
if Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
|
||||||
end
|
|
||||||
-- If ticket system enabled, do this
|
-- If ticket system enabled, do this
|
||||||
if duty and Config.TicketSystem then
|
if duty and Config.TicketSystem then
|
||||||
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
|
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||||
local Player = QBCore.Functions.GetPlayer(v)
|
local Player = QBCore.Functions.GetPlayer(v)
|
||||||
if Player ~= nil then
|
if Player ~= nil or Player ~= billed then
|
||||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||||
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||||
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
||||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if gang then
|
||||||
|
biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||||
|
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, 'Receipt received', 'success')
|
||||||
|
TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -54,7 +75,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
|||||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||||
end
|
end
|
||||||
if Config.CommissionAll then
|
if Config.CommissionAll then
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||||
local Player = QBCore.Functions.GetPlayer(v)
|
local Player = QBCore.Functions.GetPlayer(v)
|
||||||
if Player ~= nil and Player ~= biller then
|
if Player ~= nil and Player ~= biller then
|
||||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||||
@@ -65,7 +86,6 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||||
@@ -87,7 +107,7 @@ QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb
|
|||||||
cb(amount)
|
cb(amount)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside)
|
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||||
local src = source
|
local src = source
|
||||||
local biller = QBCore.Functions.GetPlayer(src)
|
local biller = QBCore.Functions.GetPlayer(src)
|
||||||
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||||
@@ -99,11 +119,10 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
|||||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if billtype == "cash" then
|
local label = biller.PlayerData.job.label
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
if gang == true then label = biller.PlayerData.gang.label end
|
||||||
elseif billtype == "bank" then
|
if Config.PhoneBank == false or gang == true or billtype == "cash" then
|
||||||
if Config.PhoneBank == false then
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang, outside)
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
|
||||||
else
|
else
|
||||||
if Config.PhoneType == "qb" then
|
if Config.PhoneType == "qb" then
|
||||||
MySQL.Async.insert(
|
MySQL.Async.insert(
|
||||||
@@ -111,18 +130,20 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
|||||||
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
|
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
|
||||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
||||||
elseif Config.PhoneType == "gks" then
|
elseif Config.PhoneType == "gks" then
|
||||||
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid)', {
|
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
|
||||||
['@citizenid'] = billed.PlayerData.citizenid,
|
['@citizenid'] = billed.PlayerData.citizenid,
|
||||||
['@amount'] = amount,
|
['@amount'] = amount,
|
||||||
['@society'] = biller.PlayerData.job.name,
|
['@society'] = biller.PlayerData.job.name,
|
||||||
['@sender'] = biller.PlayerData.charinfo.firstname,
|
['@sender'] = biller.PlayerData.charinfo.firstname,
|
||||||
['@sendercitizenid'] = biller.PlayerData.citizenid
|
['@sendercitizenid'] = biller.PlayerData.citizenid,
|
||||||
|
['@label'] = biller.PlayerData.job.label,
|
||||||
})
|
})
|
||||||
|
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = 'Invoice Successfully Sent', img= '/html/static/img/icons/logo.png' })
|
||||||
|
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = 'New Invoice Recieved', img= '/html/static/img/icons/logo.png' })
|
||||||
end
|
end
|
||||||
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
||||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -131,9 +152,10 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
|||||||
local billed = QBCore.Functions.GetPlayer(src)
|
local billed = QBCore.Functions.GetPlayer(src)
|
||||||
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
||||||
local newdata = { senderCitizenId = biller.PlayerData.citizenid, society = biller.PlayerData.job.name, amount = data.amount }
|
local newdata = { senderCitizenId = biller.PlayerData.citizenid, society = biller.PlayerData.job.name, amount = data.amount }
|
||||||
|
if data.gang == true then newdata.society = biller.PlayerData.gang.name end
|
||||||
if data.accept == true then
|
if data.accept == true then
|
||||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
||||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
||||||
elseif data.accept == false then
|
elseif data.accept == false then
|
||||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||||
@@ -141,6 +163,42 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
||||||
|
local src = source
|
||||||
|
local biller = QBCore.Functions.GetPlayer(src)
|
||||||
|
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||||
|
if tonumber(price) and tonumber(price) > 0 then
|
||||||
|
if not Config.FineJobConfirmation then
|
||||||
|
billed.Functions.RemoveMoney("bank", math.floor(tonumber(price)))
|
||||||
|
local commission = (tonumber(price) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||||
|
biller.Functions.AddMoney("bank", math.floor(commission))
|
||||||
|
if Config.Manage then
|
||||||
|
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), price)
|
||||||
|
if Config.Debug then print("QB-Management(Job): Adding $"..price.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||||
|
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), price)
|
||||||
|
if Config.Debug then print("QB-BossMenu: Adding $"..price.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..tonumber(price), "success")
|
||||||
|
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..tonumber(price))
|
||||||
|
else
|
||||||
|
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, tonumber(price), src, biller.PlayerData.job.label)
|
||||||
|
end
|
||||||
|
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||||
|
end)
|
||||||
|
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||||
|
local src = source
|
||||||
|
local billed = QBCore.Functions.GetPlayer(src)
|
||||||
|
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
||||||
|
if data.accept == true then
|
||||||
|
billed.Functions.RemoveMoney("bank", data.amount)
|
||||||
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
|
||||||
|
else
|
||||||
|
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||||
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
|
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
|
||||||
local onlineList = {}
|
local onlineList = {}
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||||
|
|||||||
Reference in New Issue
Block a user