mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 23:06:02 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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', { senderCitizenId = id.sendercitizenid, society = id.society, amount = amount })
|
||||||
TriggerServerEvent('jim-payments:Tickets:Give', data)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
1
atms.lua
1
atms.lua
@@ -298,6 +298,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
|
||||||
|
|||||||
47
client.lua
47
client.lua
@@ -15,9 +15,13 @@ end)
|
|||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
local jobroles = {}
|
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, },
|
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
|
if Config.Peds then
|
||||||
local i = math.random(1, #Config.PedPool)
|
local i = math.random(1, #Config.PedPool)
|
||||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
||||||
@@ -28,7 +32,7 @@ end)
|
|||||||
|
|
||||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||||
if outside == nil then outside = false end
|
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 onlineList = {}
|
||||||
local nearbyList = {}
|
local nearbyList = {}
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
@@ -38,7 +42,7 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
|||||||
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
|
||||||
@@ -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
|
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 = '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})
|
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 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:Tickets:Menu', function(data)
|
||||||
local amount = 0
|
local amount = 0
|
||||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
||||||
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
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
|
local sellable = false
|
||||||
else exports['qb-menu']:openMenu({
|
local name = "" local label = ""
|
||||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
for k, v in pairs(Config.Jobs) do
|
||||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
|
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.."<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)
|
||||||
if not img then img = "" end
|
if not img then img = "" end
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||||
{ 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 } } }, })
|
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ Config = {}
|
|||||||
|
|
||||||
Config.Debug = false
|
Config.Debug = false
|
||||||
|
|
||||||
Config.Manage = false -- "true" if using qb-management
|
Config.Manage = true -- "true" if using qb-management
|
||||||
-- "false" if using qb-bossmenu
|
-- "false" if using qb-bossmenu
|
||||||
|
|
||||||
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
||||||
@@ -48,7 +48,7 @@ Config.PhoneType = "qb" -- Change this setting to make invoices work with your p
|
|||||||
-- "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
|
Config.Commission = true -- Set this to true to enable Commissions and give the person charging a percentage of the total
|
||||||
Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
|
Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
|
||||||
Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
|
Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
|
||||||
Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
|
Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
|
||||||
@@ -70,6 +70,7 @@ Config.Jobs = {
|
|||||||
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||||
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||||
|
['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true },
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "v2.5"
|
version "v2.6"
|
||||||
description "Payment Script By Jimathy"
|
description "Payment Script By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
63
server.lua
63
server.lua
@@ -7,27 +7,38 @@ 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, 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)
|
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)
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||||
--Find the biller from their citizenid
|
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||||
if not biller then
|
if gang then
|
||||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
|
||||||
local Player = QBCore.Functions.GetPlayer(v)
|
if Config.Debug then print("QB-Management(Gang): Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.gang.name).."'") end
|
||||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player 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
|
end
|
||||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
elseif not gang then
|
||||||
end
|
|
||||||
local duty = true
|
|
||||||
if biller.PlayerData.job.onduty then duty = true else duty = false end
|
|
||||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
if Config.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
|
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)
|
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 Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
elseif not biller then --Find the biller from their citizenid
|
||||||
|
local biller = QBCore.Functions.GetPlayerByCitizenId(data.senderCitizenId)
|
||||||
|
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||||
|
end
|
||||||
|
|
||||||
|
local duty = true
|
||||||
|
if not biller.PlayerData.job.onduty or not gang then duty = false end
|
||||||
|
|
||||||
-- If ticket system enabled, do this
|
-- If 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
|
||||||
@@ -40,6 +51,11 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
|||||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if gang then
|
||||||
|
biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||||
|
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, 'Receipt received', 'success')
|
||||||
|
TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -65,7 +81,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 +102,7 @@ QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb
|
|||||||
cb(amount)
|
cb(amount)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, 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 +114,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)
|
||||||
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 +125,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 +147,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")
|
||||||
|
|||||||
Reference in New Issue
Block a user