From ec40bd5cf1247ea0dc43b01b22cb8c464021e3f8 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 20 Sep 2022 21:06:56 +0100 Subject: [PATCH] v2.8.3 - Renewed's QB-Phone support --- README.md | 19 +++++++++++++++++-- config.lua | 4 ++-- fxmanifest.lua | 4 ++-- server/server.lua | 19 ++++++++++--------- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e309fe9..839adf9 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,21 @@ TriggerEvent('jim-payments:Tickets:Give', { sender = Ply.PlayerData.charinfo.fir ``` - The phone should now be integrated with jim-payments ---- +#### Renewed QB-Phone: +- Go to `qb-phone > server > invoices.lua` +- Search for the event: `qb-phone:server:PayMyInvoice` and search for this line: +```lua +TriggerEvent("qb-phone:server:InvoiceHandler", true, amount, src, resource) +``` + +- Directly under this line add this event: +```lua +TriggerEvent('jim-payments:Tickets:Give', { amount = amount, senderCitizenId = sendercitizenid, sender = SenderPly.PlayerData.charinfo.firstname, society = society }, SenderPly) +``` +- When invoices are paid, they should now be integrated with jim-payments + # Setup/Config ---- + ## Custom Locations - You can make of this payment system for a job script that wasn't created by me @@ -180,6 +192,9 @@ FineJobList = true, -- "true" to use nearby player list feature in the cash regi - Support for renewed banking added - Toggle `RenewedBanking` in the config.lua to enable this +### Renewed's qb-phone + - Simply leave the Config.PhoneType as `"qb"` + ### AP-Goverment - Support for AP-Goverment Tax on payments - Toggle `ApGov` in the config.lua to enable this \ No newline at end of file diff --git a/config.lua b/config.lua index 27a87a7..cbce94f 100644 --- a/config.lua +++ b/config.lua @@ -1,4 +1,4 @@ -print("^2Jim^7-^2Payments ^7v^42^7.^48^7.^42 ^7- ^2Payments Script by ^1Jimathy^7") +print("^2Jim^7-^2Payments ^7v^42^7.^48^7.^43 ^7- ^2Payments Script by ^1Jimathy^7") -- If you need support I now have a discord available, it helps me keep track of issues and give better support. @@ -39,7 +39,7 @@ Config = { `U_F_M_CasinoShop_01`, }, - PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices + PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices -- This doesn't affect Cash payments as they by default use confirmation now -- This is helpful for phones that don't support invoices well diff --git a/fxmanifest.lua b/fxmanifest.lua index cebdb3b..2a0f5fd 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim-Payments" author "Jimathy" -version "v2.8.2" +version "v2.8.3" description "Payment Script By Jimathy" fx_version "cerulean" game "gta5" @@ -9,4 +9,4 @@ lua54 'yes' dependencies { 'qb-input', 'qb-target', } client_scripts { 'client/*.lua', 'locales/*.lua' } server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' } -shared_scripts { 'config.lua', 'shared/*.lua', 'locales/*.lua' } +shared_scripts { 'config.lua', 'shared/*.lua', 'locales/*.lua' } \ No newline at end of file diff --git a/server/server.lua b/server/server.lua index f6dfef2..57cac5a 100644 --- a/server/server.lua +++ b/server/server.lua @@ -54,7 +54,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang) end local duty = true - if not biller.PlayerData.job.onduty or gang == nil then duty = false end + if not biller.PlayerData.job.onduty or gang ~= nil then duty = false end -- If ticket system enabled, do this if duty and Config.TicketSystem then @@ -64,21 +64,18 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang) local Player = QBCore.Functions.GetPlayer(v) if Player ~= nil or Player ~= billed then if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then - Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil}) + if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source) - 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}) + if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source) - TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end end else - biller.Functions.AddItem('payticket', 1, false, {["quality"] = nil}) + if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source) - TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end end end @@ -143,7 +140,11 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt if Config.PhoneType == "qb" then MySQL.Async.insert( 'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)', - {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid}) + {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid}, function(id) + if id then + TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.PlayerData.source, id, biller.PlayerData.charinfo.firstname, biller.PlayerData.job.name, biller.PlayerData.citizenid, amount, GetInvokingResource()) + end + end) TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source) elseif Config.PhoneType == "gks" then MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', { @@ -243,4 +244,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