mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 06:46:02 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
892acf1283 | ||
|
|
13d83a066a | ||
|
|
88765357b3 |
@@ -26,7 +26,7 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
local cashB = Player.Functions.GetMoney("cash")
|
local cashB = Player.Functions.GetMoney("cash")
|
||||||
local bankB = Player.Functions.GetMoney("bank")
|
local bankB = Player.Functions.GetMoney("bank")
|
||||||
local amount = tonumber(amount)
|
local amount = tonumber(amount)
|
||||||
--TriggerClientEvent("QBCore:Notify", src, tostring(account), "error")
|
--TriggerClientEvent("QBCore:Notify", src, tostring(account), "error")
|
||||||
|
|
||||||
--Simple transfers from bank to wallet --
|
--Simple transfers from bank to wallet --
|
||||||
if account == "bank" or account == "atm" then
|
if account == "bank" or account == "atm" then
|
||||||
@@ -79,14 +79,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)
|
||||||
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||||
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
|
||||||
exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
if Config.Manage then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
--TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||||
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
|
||||||
@@ -109,8 +109,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)
|
||||||
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||||
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount)
|
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||||
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")
|
||||||
@@ -131,14 +131,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)
|
||||||
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
--TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||||
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
|
||||||
exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
--TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||||
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
|
||||||
@@ -161,8 +161,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)
|
||||||
exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||||
--TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount)
|
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||||
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")
|
||||||
|
|||||||
16
client.lua
16
client.lua
@@ -36,12 +36,12 @@ RegisterNetEvent('jim-payments:client:Charge', function(data)
|
|||||||
end
|
end
|
||||||
if data.img == nil then img = "" else img = data.img end
|
if data.img == nil then img = "" else img = data.img end
|
||||||
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||||
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send",
|
local newinputs = {}
|
||||||
inputs = {
|
if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
|
||||||
{ text = " ", name = "citizen", type = "select", options = nearbyList },
|
if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
|
||||||
{ 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" } } }
|
||||||
{ 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 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)
|
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img)
|
||||||
@@ -62,10 +62,10 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img)
|
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
||||||
if img == nil then img = "" end
|
if img == nil then img = "" end
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = img.."🧾 "..PlayerJob.label.." 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 },
|
||||||
{ 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 } } }, })
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
print("Jim-Payments v2.2 - Payments Script by Jimathy")
|
print("Jim-Payments v2.3 - 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.
|
||||||
|
|
||||||
@@ -6,8 +6,12 @@ print("Jim-Payments v2.2 - Payments Script by Jimathy")
|
|||||||
|
|
||||||
Config = {}
|
Config = {}
|
||||||
|
|
||||||
Config.TicketSystem = true -- Enable this if you want to use the ticket system
|
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
|
||||||
|
|
||||||
|
Config.List = true -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||||
Config.PaymentRadius = 30 -- This is how far the playerlist will check for nearby players (based on the person charging)
|
Config.PaymentRadius = 30 -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||||
|
|
||||||
Config.useATM = true -- Enable this to use my ATM's
|
Config.useATM = true -- Enable this to use my ATM's
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "v2.2"
|
version "v2.3"
|
||||||
description "Payment Script By Jimathy"
|
description "Payment Script By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
@@ -8,7 +8,6 @@ game "gta5"
|
|||||||
dependencies {
|
dependencies {
|
||||||
'qb-input',
|
'qb-input',
|
||||||
'qb-target',
|
'qb-target',
|
||||||
'qb-management'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
|||||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- If ticket system enabled, do this
|
||||||
if Config.TicketSystem then
|
if 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 k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||||
@@ -91,10 +92,10 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if billtype == "cash" then
|
if billtype == "cash" then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img)
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
||||||
elseif billtype == "bank" then
|
elseif billtype == "bank" then
|
||||||
if Config.PhoneBank == false then
|
if Config.PhoneBank == false then
|
||||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img)
|
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
||||||
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 (?, ?, ?, ?, ?)',
|
||||||
@@ -114,8 +115,8 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
|||||||
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.accept == true then
|
if data.accept == true then
|
||||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||||
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)
|
||||||
--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) end
|
||||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user