mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
triggerNotify()
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
|
||||
|
||||
-- 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
|
||||
@@ -226,7 +227,7 @@ RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
Wait(1000)
|
||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, info.society, info.gsociety)
|
||||
end
|
||||
end, function() TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
end, function() triggerNotify(nil, "Cancelled!", "error")
|
||||
end, data.icon)
|
||||
end)
|
||||
|
||||
@@ -245,7 +246,7 @@ RegisterNetEvent('jim-payments:client:ATM:give', function()
|
||||
end
|
||||
dist = nil
|
||||
end
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
|
||||
inputs = {
|
||||
{ text = " ", name = "citizen", type = "select", options = nearbyList },
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
|
||||
|
||||
PlayerJob = {}
|
||||
PlayerGang = {}
|
||||
@@ -58,7 +59,7 @@ end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
--Check if player is using /cashregister command
|
||||
if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
|
||||
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, "Not Clocked in!", "error") return end
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.List then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
@@ -77,7 +78,7 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
|
||||
@@ -102,7 +103,7 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
|
||||
if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
|
||||
if not allowed then triggerNotify(nil, "You don't have the required job", "error") return end
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
if Config.FineJobList then -- If nearby player list is wanted:
|
||||
@@ -122,7 +123,7 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
|
||||
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
|
||||
@@ -143,7 +144,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
|
||||
--Get ticket info
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
|
||||
local amount = Citizen.Await(p)
|
||||
if not amount then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") amount = 0 return end
|
||||
if not amount then triggerNotify(nil, "You don't have any tickets to trade", "error") amount = 0 return end
|
||||
local sellable = false
|
||||
local name = "" local label = ""
|
||||
--Check/adjust for job/gang names
|
||||
|
||||
@@ -5,8 +5,8 @@ print("^2Jim^7-^2Payments v^42^7.^47 ^7- ^2Payments Script by ^1Jimathy^7")
|
||||
-- https://discord.gg/xKgQZ6wZvS
|
||||
|
||||
Config = {
|
||||
Debug = false,
|
||||
|
||||
Debug = true,
|
||||
Notify = "qb",
|
||||
---------------------------------
|
||||
-- Default Job Payment Systems --
|
||||
---------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterNetEvent('QBCore:Server:UpdateObject', function() if source ~= '' then return false end QBCore = exports['qb-core']:GetCoreObject() end)
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
@@ -21,18 +22,18 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
--Simple transfers from bank to wallet --
|
||||
if account == "bank" or account == "atm" then
|
||||
if billtype == "withdraw" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
if bankB < amount then triggerNotify(nil, "Bank Balance too low", "error", src)
|
||||
elseif bankB >= tonumber(amount) then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
triggerNotify(nil, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('cash', amount)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if cashB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough cash", "error")
|
||||
if cashB < amount then triggerNotify(nil, "Not enough cash", "error", src)
|
||||
elseif cashB >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the Bank", "success")
|
||||
triggerNotify(nil, "Deposited $"..cv(amount).." into the Bank", "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfers from bank to savings account --
|
||||
@@ -44,41 +45,41 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
if savbal >= amount then
|
||||
savbal = savbal - amount
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Withdrawn from savings into bank account", "success")
|
||||
triggerNotify(nil, "$"..cv(amount).." Withdrawn from savings into bank account", "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
elseif savbal < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Savings Balance too low", "error")
|
||||
triggerNotify(nil, "Savings Balance too low", "error")
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if amount < bankB then
|
||||
savbal = savbal + amount
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Deposited from bank account into savings", "success")
|
||||
triggerNotify(nil, "$"..cv(amount).." Deposited from bank account into savings", "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
else TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
else triggerNotify(nil, "Bank Balance too low", "error", src)
|
||||
end
|
||||
end
|
||||
--Simple transfers from society account to bank --
|
||||
elseif account == "society" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(society) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
if tonumber(society) < amount then triggerNotify(nil, "Society balance too low", "error", src)
|
||||
elseif tonumber(society) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
||||
triggerNotify(nil, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success", src)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
if bankB < amount then triggerNotify(nil, "Not enough money in your bank", "error", src)
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddMoney(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)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
||||
triggerNotify(nil, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from boss account to players --
|
||||
@@ -103,34 +104,34 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success")
|
||||
triggerNotify(nil, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
|
||||
end
|
||||
end
|
||||
|
||||
--Simple transfers from gang society account to bank --
|
||||
elseif account == "gang" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(gsociety) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
if tonumber(gsociety) < amount then triggerNotify(nil, "Society balance too low", "error", src)
|
||||
elseif tonumber(gsociety) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
||||
triggerNotify(nil, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success", src)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
if bankB < amount then triggerNotify(nil, "Not enough money in your bank", "error", src)
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddGangMoney(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)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
||||
triggerNotify(nil, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from gang account to players --
|
||||
@@ -155,14 +156,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if not Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success")
|
||||
triggerNotify(nil, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -187,14 +188,14 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success")
|
||||
triggerNotify(nil, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
elseif not result[1] then triggerNotify(nil, "Error: Account '"..baccount.."' not found", "error", src)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -258,11 +259,11 @@ RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
||||
if amount and amount > 0 then
|
||||
if balance >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
||||
triggerNotify(nil, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
|
||||
Reciever.Functions.AddMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success")
|
||||
triggerNotify(nil, "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
|
||||
elseif balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
||||
triggerNotify(nil, "You don't have enough cash to give", "error", source)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't give $0", 'error') end
|
||||
else triggerNotify(nil,"You can't give $0", 'error', source) end
|
||||
end)
|
||||
@@ -1,4 +1,5 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
RegisterNetEvent('QBCore:Server:UpdateObject', function() if source ~= '' then return false end QBCore = exports['qb-core']:GetCoreObject() end)
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
@@ -39,7 +40,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||
triggerNotify(nil, data.sender.." Paid their $"..data.amount.." invoice", "success", biller.PlayerData.source)
|
||||
end
|
||||
|
||||
local duty = true
|
||||
@@ -54,19 +55,19 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
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})
|
||||
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
||||
triggerNotify(nil, 'Receipt received', '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})
|
||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, 'Receipt received', 'success')
|
||||
triggerNotify(nil, 'Receipt received', '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})
|
||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, 'Receipt received', 'success')
|
||||
triggerNotify(nil, 'Receipt received', 'success', biller.PlayerData.source)
|
||||
TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
end
|
||||
end
|
||||
@@ -77,9 +78,9 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.CommissionDouble then
|
||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success")
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success", biller.PlayerData.source)
|
||||
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success", biller.PlayerData.source)
|
||||
end
|
||||
if Config.CommissionAll then
|
||||
for _, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
@@ -87,7 +88,7 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
||||
if Player ~= nil and Player ~= biller then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * comm))
|
||||
TriggerClientEvent("QBCore:Notify", Player.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
triggerNotify(nil, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success", Player.PlayerData.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -97,14 +98,14 @@ end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player.Functions.GetItemByName("payticket") then TriggerClientEvent('QBCore:Notify', source, "No tickets to trade", 'error') return
|
||||
if Player.Functions.GetItemByName("payticket") then triggerNotify(nil, "No tickets to trade", 'error', source) return
|
||||
else
|
||||
tickets = Player.Functions.GetItemByName("payticket").amount
|
||||
Player.Functions.RemoveItem('payticket', tickets)
|
||||
pay = (tickets * Config.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
||||
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
|
||||
TriggerClientEvent('QBCore:Notify', source, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success')
|
||||
triggerNotify(nil, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success', source)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -120,8 +121,8 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
local balance = billed.Functions.GetMoney(billtype)
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
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")
|
||||
triggerNotify(nil, "Customer doesn't have enough cash to pay", "error", src)
|
||||
triggerNotify(nil, "You don't have enough cash to pay", "error", tonumber(citizen))
|
||||
return
|
||||
end
|
||||
local label = biller.PlayerData.job.label
|
||||
@@ -146,10 +147,10 @@ RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billt
|
||||
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')
|
||||
triggerNotify(nil, 'Invoice Successfully Sent', 'success', src)
|
||||
triggerNotify(nil, 'New Invoice Received', nil, billed.PlayerData.source)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
else triggerNotify(nil, "You can't charge $0", 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
@@ -161,10 +162,10 @@ RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
if data.accept == true then
|
||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success", data.biller)
|
||||
elseif data.accept == false then
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error")
|
||||
triggerNotify(nil, "You declined the payment", nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -185,12 +186,12 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), (price - commission))
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success")
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..(price - commission))
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success", src)
|
||||
triggerNotify(nil, 'You were charged for $'..(price - commission), nil, billed.PlayerData.source)
|
||||
else
|
||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label)
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
else triggerNotify(nil, "You can't charge $0", 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
@@ -201,7 +202,7 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||
if data.accept == true then
|
||||
if billed.Functions.RemoveMoney("bank", data.amount) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..data.amount.."^7") end end
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success", data.biller)
|
||||
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||
if Config.Manage then
|
||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||
@@ -211,8 +212,8 @@ RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||
if Config.Debug then print("^5Debug^7: ^3QB^7-^3BossMenu^7: ^2Adding ^6$^7"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
||||
end
|
||||
else
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error")
|
||||
triggerNotify(nil, "You declined the payment", nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." charge", "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user