mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
qb-management export update
This commit is contained in:
28
atms.lua
28
atms.lua
@@ -3,7 +3,6 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
|||||||
-- This script is a simple replacement for QB-Banking and QB-ATMs
|
-- This script is a simple replacement for QB-Banking and QB-ATMs
|
||||||
-- It uses QB-Input and server callbacks to retreive info about accounts and cash
|
-- It uses QB-Input and server callbacks to retreive info about accounts and cash
|
||||||
-- This requires QB-Target and has the location of every ATM, ATM prop and bank window
|
-- This requires QB-Target and has the location of every ATM, ATM prop and bank window
|
||||||
-- If Config.useATM = false, then none of this load
|
|
||||||
|
|
||||||
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" }
|
||||||
|
|
||||||
@@ -88,7 +87,6 @@ Config.BankLocations = {
|
|||||||
--vector3(252.41, 221.41, 106.29)
|
--vector3(252.41, 221.41, 106.29)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local function cv(amount)
|
local function cv(amount)
|
||||||
local formatted = amount
|
local formatted = amount
|
||||||
while true do
|
while true do
|
||||||
@@ -161,14 +159,15 @@ Citizen.CreateThread(function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Config.useATM then
|
if Config.useATM then
|
||||||
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
|
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
|
||||||
for k,v in pairs(Config.ATMLocations) do
|
for k,v in pairs(Config.ATMLocations) do
|
||||||
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=false, 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=false, 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" },
|
||||||
--[[{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },]] }, distance = 1.5 })
|
--[[{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },]]
|
||||||
|
}, distance = 1.5 })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Config.useBanks then
|
if Config.useBanks then
|
||||||
@@ -198,26 +197,29 @@ local function PlayATMAnimation(animation)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function GrabAccount(type, job)
|
||||||
|
local p = promise.new()
|
||||||
|
QBCore.Functions.TriggerCallback('jim-payments:ManageWrapper', function(cb) p:resolve(cb) end, type, job)
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||||
--this grabs all the info from names to savings account numbers in the databases
|
--this grabs all the info from names to savings account numbers in the databases
|
||||||
while name == nil do
|
while name == nil do
|
||||||
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb1, cb2, cb3, cb4, cb5, cb6, cb7) name = cb1 cash = cb2 bank = cb3 account = cb4 cid = cb5 savbal = cb6 aid = cb7 end)
|
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb1, cb2, cb3, cb4, cb5, cb6, cb7) name = cb1 cash = cb2 bank = cb3 account = cb4 cid = cb5 savbal = cb6 aid = cb7 end)
|
||||||
Citizen.Wait(100)
|
Citizen.Wait(100)
|
||||||
end
|
end
|
||||||
while society == nil do
|
|
||||||
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) society = cb end, PlayerJob.name)
|
society = GrabAccount("GetAccount", PlayerJob.name)
|
||||||
Citizen.Wait(100)
|
Wait(200)
|
||||||
end
|
gsociety = GrabAccount("GetGangAccount", PlayerGang.name)
|
||||||
while gsociety == nil do
|
|
||||||
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) gsociety = cb end, PlayerGang.name)
|
|
||||||
Citizen.Wait(100)
|
|
||||||
end
|
|
||||||
local atmbartime = 2500
|
local atmbartime = 2500
|
||||||
local setoptions = {}
|
local setoptions = {}
|
||||||
|
|
||||||
if data.id == "atm" then
|
if data.id == "atm" then
|
||||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, }
|
setoptions = { { value = "withdraw", text = "Withdrawl" }, }
|
||||||
setview = "Welcome back, "..name.."<br><br>- Citizen ID -<br>"..cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(bank).."<br>💵Cash - $"..cv(cash)..'<br><br>- Options -'
|
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>Welcome back, "..name.."<br><br>- Citizen ID -<br>"..cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(bank).."<br>💵Cash - $"..cv(cash)..'<br><br>- Options -'
|
||||||
setheader = "💵 ATM Banking 💵"
|
setheader = "💵 ATM Banking 💵"
|
||||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||||
|
|||||||
@@ -13,6 +13,16 @@ end
|
|||||||
|
|
||||||
|
|
||||||
---- BANK STUFF
|
---- BANK STUFF
|
||||||
|
QBCore.Functions.CreateCallback('jim-payments:ManageWrapper', function(source, cb, type, account)
|
||||||
|
local result = nil
|
||||||
|
if type == "GetAccount" then result = exports["qb-management"]:GetAccount(account) end
|
||||||
|
if type == "GetGangAccount" then result = exports["qb-management"]:GetGangAccount(account) end
|
||||||
|
|
||||||
|
print(type.." "..account.." "..result)
|
||||||
|
|
||||||
|
cb(result)
|
||||||
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, baccount, account, society, gsociety)
|
RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, baccount, account, society, gsociety)
|
||||||
local src = source
|
local src = source
|
||||||
local Player = QBCore.Functions.GetPlayer(src)
|
local Player = QBCore.Functions.GetPlayer(src)
|
||||||
@@ -72,12 +82,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
elseif tonumber(society) >= amount then
|
elseif tonumber(society) >= amount then
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
||||||
Player.Functions.AddMoney('bank', amount)
|
Player.Functions.AddMoney('bank', amount)
|
||||||
TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
||||||
end
|
end
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||||
elseif bankB >= amount then
|
elseif bankB >= amount then
|
||||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
--TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
||||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
||||||
end
|
end
|
||||||
@@ -100,7 +112,8 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||||
if result[1] ~= nil then
|
if result[1] ~= nil then
|
||||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||||
TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
|
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
||||||
if Reciever ~= nil then
|
if Reciever ~= nil then
|
||||||
Reciever.Functions.AddMoney('bank', amount)
|
Reciever.Functions.AddMoney('bank', amount)
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||||
@@ -121,12 +134,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
elseif tonumber(gsociety) >= amount then
|
elseif tonumber(gsociety) >= amount then
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
||||||
Player.Functions.AddMoney('bank', amount)
|
Player.Functions.AddMoney('bank', amount)
|
||||||
TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
|
--TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
||||||
end
|
end
|
||||||
elseif billtype == "deposit" then
|
elseif billtype == "deposit" then
|
||||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||||
elseif bankB >= amount then
|
elseif bankB >= amount then
|
||||||
TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
|
--TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
||||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
||||||
end
|
end
|
||||||
@@ -149,7 +164,8 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||||
if result[1] ~= nil then
|
if result[1] ~= nil then
|
||||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||||
TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
|
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
||||||
if Reciever ~= nil then
|
if Reciever ~= nil then
|
||||||
Reciever.Functions.AddMoney('bank', amount)
|
Reciever.Functions.AddMoney('bank', amount)
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||||
@@ -233,7 +249,7 @@ RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
|||||||
Player.Functions.RemoveMoney('cash', amount)
|
Player.Functions.RemoveMoney('cash', amount)
|
||||||
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
||||||
Reciever.Functions.AddMoney('cash', amount)
|
Reciever.Functions.AddMoney('cash', amount)
|
||||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success")
|
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Reciever.PlayerData.charinfo.firstname, "success")
|
||||||
elseif balance < amount then
|
elseif balance < amount then
|
||||||
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
||||||
end
|
end
|
||||||
|
|||||||
10
client.lua
10
client.lua
@@ -27,9 +27,9 @@ RegisterNetEvent('jim-payments:client:Charge', function(data)
|
|||||||
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() 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
|
dist = nil
|
||||||
@@ -44,7 +44,7 @@ RegisterNetEvent('jim-payments:client:Charge', function(data)
|
|||||||
})
|
})
|
||||||
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)
|
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -62,9 +62,9 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype)
|
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img)
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Payment 🧾", txt = "Do you want accept the payment?" },
|
{ isMenuHeader = true, header = img.."🧾 "..PlayerJob.label.." 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 },
|
||||||
{ header = "✅ Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype } } },
|
{ header = "✅ Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype } } },
|
||||||
{ header = "❌ No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
|
{ header = "❌ No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ game "gta5"
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
'qb-input',
|
'qb-input',
|
||||||
'qb-target'
|
'qb-target',
|
||||||
|
'qb-management'
|
||||||
}
|
}
|
||||||
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
|
|||||||
21
server.lua
21
server.lua
@@ -11,6 +11,9 @@ local function cv(amount)
|
|||||||
return formatted
|
return formatted
|
||||||
end
|
end
|
||||||
|
|
||||||
|
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then
|
||||||
|
print(exports["qb-management"]:GetAccount("police")) 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(amount, job)
|
RegisterServerEvent('jim-payments:Tickets:Give', function(amount, job)
|
||||||
@@ -51,7 +54,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)
|
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img)
|
||||||
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))
|
||||||
@@ -59,14 +62,14 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
|||||||
if amount and amount > 0 then
|
if amount and amount > 0 then
|
||||||
if billtype == "cash" then balance = billed.Functions.GetMoney(billtype)
|
if billtype == "cash" then balance = billed.Functions.GetMoney(billtype)
|
||||||
if balance >= amount then
|
if balance >= amount then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype)
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img)
|
||||||
elseif balance < amount then
|
elseif balance < amount then
|
||||||
TriggerClientEvent("QBCore:Notify", src, "Customer doesn't have enough cash to pay", "error")
|
TriggerClientEvent("QBCore:Notify", src, "Customer doesn't have enough cash to pay", "error")
|
||||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
||||||
end
|
end
|
||||||
elseif billtype == "card" then
|
elseif billtype == "card" then
|
||||||
if Config.PhoneBank == false then
|
if Config.PhoneBank == false then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype)
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img)
|
||||||
else
|
else
|
||||||
MySQL.Async.insert(
|
MySQL.Async.insert(
|
||||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
||||||
@@ -81,13 +84,13 @@ end)
|
|||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||||
local src = source
|
local src = source
|
||||||
local billtype = data.billtype
|
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))
|
|
||||||
if billtype == "card" then billtype = "bank" end
|
|
||||||
if data.accept == true then
|
if data.accept == true then
|
||||||
billed.Functions.RemoveMoney(tostring(billtype), data.amount) TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||||
TriggerEvent('jim-payments:Tickets:Give', data.amount, tostring(biller.PlayerData.job.name))
|
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
||||||
|
--TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
||||||
|
TriggerEvent('jim-payments:Tickets:Give', data.amount, tostring(billed.PlayerData.job.name))
|
||||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the payment", "success")
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the 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