diff --git a/atms.lua b/atms.lua
index 420dcb0..c80bfd7 100644
--- a/atms.lua
+++ b/atms.lua
@@ -298,6 +298,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
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
diff --git a/client.lua b/client.lua
index ed779db..4d27da3 100644
--- a/client.lua
+++ b/client.lua
@@ -15,9 +15,13 @@ end)
CreateThread(function()
local jobroles = {}
- for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
+ local gangroles = {}
+ for k, v in pairs(Config.Jobs) do if v.gang then gangroles[tostring(k)] = 0 else jobroles[tostring(k)] = 0 end end
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
- { options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in 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 })
if Config.Peds then
local i = math.random(1, #Config.PedPool)
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
@@ -28,7 +32,7 @@ end)
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
if outside == nil then outside = false end
- if not outside and not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
+ if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
local onlineList = {}
local nearbyList = {}
local p = promise.new()
@@ -38,7 +42,7 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
for i = 1, #onlineList do
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)' }
end
end
@@ -52,33 +56,50 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
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})
+ if data.job then label = PlayerJob.label gang = false elseif 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)
+ TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
end
end)
-RegisterNetEvent('jim-payments:Tickets:Menu', function()
+RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
local amount = 0
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
- for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
- else exports['qb-menu']:openMenu({
- { isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
- { isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."
Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
- { icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
+ local sellable = false
+ local name = "" local label = ""
+ for k, v in pairs(Config.Jobs) do
+ if data.gang then
+ if v.gang and k == PlayerGang.name then
+ name = k
+ label = PlayerGang.label
+ sellable = true
+ end
+ else
+ if not v.gang and k == PlayerJob.name then
+ name = k
+ label = PlayerJob.label
+ sellable = true
+ end
+ end
+ if sellable then
+ exports['qb-menu']:openMenu({
+ { isMenuHeader = true, header = "🧾 "..label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
+ { isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."
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)
+RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang)
if not img then img = "" end
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 } } },
+ { icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang } } },
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
end)
diff --git a/config.lua b/config.lua
index 590f8ba..f277cb3 100644
--- a/config.lua
+++ b/config.lua
@@ -1,4 +1,4 @@
-print("Jim-Payments v2.5 - Payments Script by Jimathy")
+print("Jim-Payments v2.6 - Payments Script by Jimathy")
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
@@ -8,7 +8,7 @@ Config = {}
Config.Debug = false
-Config.Manage = false -- "true" if using qb-management
+Config.Manage = true -- "true" if using qb-management
-- "false" if using qb-bossmenu
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
@@ -48,7 +48,7 @@ Config.PhoneType = "qb" -- Change this setting to make invoices work with your p
-- "qb" for qb-phone
-- "gks"" for GKSPhone
-Config.Commission = false -- Set this to true to enable Commissions and give the person charging a percentage of the total
+Config.Commission = true -- Set this to true to enable Commissions and give the person charging a percentage of the total
Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
@@ -70,6 +70,7 @@ Config.Jobs = {
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
+ ['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true },
}
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
diff --git a/fxmanifest.lua b/fxmanifest.lua
index a0ed265..ce8b4b1 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -1,6 +1,6 @@
name "Jim-Payments"
author "Jimathy"
-version "v2.5"
+version "v2.6"
description "Payment Script By Jimathy"
fx_version "cerulean"
game "gta5"
diff --git a/server.lua b/server.lua
index d75964b..33c0c7d 100644
--- a/server.lua
+++ b/server.lua
@@ -7,28 +7,37 @@ local function cv(amount)
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, v 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)
-RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, popup)
+RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
- if 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
+ 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 k, v in pairs(QBCore.Functions.GetPlayers()) do
- local Player = QBCore.Functions.GetPlayer(v)
- if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
- end
+ local biller = QBCore.Functions.GetPlayerByCitizenId(data.senderCitizenId)
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
end
local duty = true
- if biller.PlayerData.job.onduty then duty = true else duty = false end
+ if not biller.PlayerData.job.onduty or not gang then duty = false end
-- If ticket system enabled, do this
if duty and Config.TicketSystem then
@@ -42,6 +51,11 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, popup)
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
end
end
@@ -67,7 +81,6 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, popup)
end
end
end
-
end)
RegisterServerEvent('jim-payments:Tickets:Sell', function()
@@ -89,7 +102,7 @@ QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb
cb(amount)
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 biller = QBCore.Functions.GetPlayer(src)
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
@@ -101,32 +114,30 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
return
end
- if billtype == "cash" then
- TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
- elseif billtype == "bank" then
- if Config.PhoneBank == false then
- TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
- 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')
+ 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)
+ 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)
@@ -136,9 +147,10 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
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)
+ 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")
@@ -153,4 +165,4 @@ 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)
+end)
\ No newline at end of file