mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-19 07:16:03 +01:00
Polcharge Commission now taken from society charge
This commit is contained in:
43
server.lua
43
server.lua
@@ -22,9 +22,9 @@ RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
|
|||||||
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
|
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||||
if gang then
|
if gang then
|
||||||
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
|
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount)
|
||||||
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
|
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
|
||||||
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
|
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(biller.PlayerData.gang.name), data.amount)
|
||||||
if Config.Debug then print("^5Debug^7: ^3QB-GangMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7'") end
|
if Config.Debug then print("^5Debug^7: ^3QB^7-^3GangMenu^7: ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7'") end
|
||||||
end
|
end
|
||||||
elseif not gang then
|
elseif not gang then
|
||||||
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)
|
||||||
@@ -173,40 +173,43 @@ RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
|
|||||||
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))
|
||||||
if tonumber(price) and tonumber(price) > 0 then
|
local price = math.floor(tonumber(price))
|
||||||
|
if price > 0 then
|
||||||
if not Config.FineJobConfirmation then
|
if not Config.FineJobConfirmation then
|
||||||
billed.Functions.RemoveMoney("bank", math.floor(tonumber(price)))
|
if billed.Functions.AddMoney("bank", price) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..price.."^7") end end
|
||||||
local commission = (tonumber(price) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
local commission = math.floor(price * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||||
biller.Functions.AddMoney("bank", math.floor(commission))
|
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
||||||
if Config.Manage then
|
if Config.Manage then
|
||||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), price)
|
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), (price - commission))
|
||||||
if Config.Debug then print("^5Debug^7: ^6QB-Management^7(^4Job^7): ^2Adding ^7$^6"..price.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||||
else
|
else
|
||||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), price)
|
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), (price - commission))
|
||||||
if Config.Debug then print("^5Debug^7: ^6QB-BossMenu^7: ^2Adding ^7$^6"..price.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
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
|
end
|
||||||
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..tonumber(price), "success")
|
TriggerClientEvent('QBCore:Notify', src, billed.PlayerData.charinfo.firstname.." was charged for $"..(price - commission), "success")
|
||||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..tonumber(price))
|
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'You were charged for $'..(price - commission))
|
||||||
else
|
else
|
||||||
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, tonumber(price), src, biller.PlayerData.job.label)
|
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, (price - commission), src, biller.PlayerData.job.label)
|
||||||
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)
|
||||||
|
|
||||||
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
|
||||||
local src = source
|
local src = source
|
||||||
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))
|
||||||
|
data.amount = math.floor(data.amount)
|
||||||
if data.accept == true then
|
if data.accept == true then
|
||||||
billed.Functions.RemoveMoney("bank", data.amount)
|
if billed.Functions.AddMoney("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")
|
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." charge", "success")
|
||||||
local commission = (tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
|
||||||
if biller.Functions.AddMoney("bank", math.floor(commission)) then if Config.Debug then print("^5Debug^7: ^6PolCharge^7 - ^4Commission ^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
|
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
|
if Config.Manage then
|
||||||
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||||
if Config.Debug then print("^5Debug^7: ^6QB-Management^7(^4Job^7): ^2Adding ^7$^6"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
if Config.Debug then print("^5Debug^7: ^3QB^7-^3Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - commission.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
|
||||||
else
|
else
|
||||||
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount - commission)
|
||||||
if Config.Debug then print("^5Debug^7: ^6QB-BossMenu^7: ^2Adding ^6$^7"..data.amount.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7'") end
|
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
|
end
|
||||||
else
|
else
|
||||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||||
|
|||||||
Reference in New Issue
Block a user