mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9eb2e987d4 | ||
|
|
e73520a10c | ||
|
|
f869c682c1 | ||
|
|
ca625c50e2 | ||
|
|
49f4d404e3 | ||
|
|
2b92f749b5 | ||
|
|
5e80192cef | ||
|
|
2eff1996c2 | ||
|
|
29b3b2ffb9 | ||
|
|
5cc7b60a1f | ||
|
|
41e146e35a |
17
.github/workflows/notify-discord.yml
vendored
Normal file
17
.github/workflows/notify-discord.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Discord Commit Notifier
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*' # triggers on all branches
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Discord Commits
|
||||
uses: Sniddl/discord-commits@v1.6
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
template: "avatar-with-link"
|
||||
include-extras: true
|
||||
@@ -43,9 +43,28 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then triggerNotify(nil, locale("error" ,"no_one"), "error") return end
|
||||
if not nearbyList[1] then
|
||||
triggerNotify(nil, locale("error" ,"no_one"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
newinputs[#newinputs+1] = {
|
||||
type = "select",
|
||||
text = locale("menu", "cus_id"),
|
||||
name = "citizen",
|
||||
label = locale("menu", "cus_id"),
|
||||
default = 1,
|
||||
options = nearbyList
|
||||
}
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, required = true, name = 'citizen', label = locale("menu" ,"person_id"), text = locale("menu" ,"person_id") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'text',
|
||||
isRequired = true,
|
||||
required = true,
|
||||
name = 'citizen',
|
||||
label = locale("menu", "cus_id"),
|
||||
text = locale("menu", "cus_id")
|
||||
}
|
||||
end
|
||||
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
@@ -53,11 +72,6 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
--Check if image was given when opening the regsiter
|
||||
local img = data.img ~= nil and (Config.System.Menu == "qb" and "<center><img src="..(data.img).." width=200px></center>") or Jobs[getInfo.job].label
|
||||
|
||||
if Config.General.List then
|
||||
newinputs[#newinputs+1] = { type = "select", text = locale("menu" ,"cus_id"), name = "citizen", label = locale("menu" ,"cus_id"), default = 1, options = nearbyList }
|
||||
else
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = locale("menu" ,"cus_id") }
|
||||
end
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'select',
|
||||
name = 'billtype',
|
||||
@@ -73,7 +87,11 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
local dialog = createInput(img, newinputs)
|
||||
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
if dialog[1] then -- if ox menu, auto adjust values
|
||||
if dialog[1] == "" then
|
||||
TriggerEvent(getScript()..":client:Charge", data, outside)
|
||||
return
|
||||
end
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.billtype = dialog[2]
|
||||
dialog.price = dialog[3]
|
||||
@@ -85,7 +103,7 @@ end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
local setimage = ""
|
||||
print(billerjob)
|
||||
|
||||
if not img then
|
||||
setimage = billerjob
|
||||
else
|
||||
@@ -134,7 +152,7 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
|
||||
})
|
||||
end,
|
||||
}
|
||||
debugPrint(setimage)
|
||||
|
||||
openMenu(Menu, {
|
||||
header = setimage,
|
||||
onExit = function()
|
||||
|
||||
@@ -2,38 +2,69 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
local Playerinfo = getPlayer()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.PolCharge.FineJobs) do if k == Playerinfo.job then allowed = true end end
|
||||
if not allowed then triggerNotify(nil, locale("error", "no_job"), "error") return end
|
||||
for k in pairs(Config.PolCharge.FineJobs) do
|
||||
if k == Playerinfo.job then
|
||||
allowed = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not allowed then
|
||||
triggerNotify(nil, locale("error", "no_job"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
local nearbyList = {}
|
||||
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
-- Retrieve a list of nearby players from server
|
||||
local onlineList = triggerCallback(getScript()..":MakePlayerList")
|
||||
--Convert list of players nearby into one qb-input understands + add distance info
|
||||
-- Convert list of players nearby into one an input script understands + add distance info
|
||||
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or debugMode then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)', text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
nearbyList[#nearbyList+1] = {
|
||||
value = onlineList[i].value,
|
||||
label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)',
|
||||
text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)'
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then triggerNotify(nil, locale("error" ,"no_one"), "error") return end
|
||||
end
|
||||
if not nearbyList[1] then
|
||||
triggerNotify(nil, locale("error" ,"no_one"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
if Config.PolCharge.FineJobList then
|
||||
newinputs[#newinputs+1] = { type = "select", text = locale("menu" ,"cus_id"), name = "citizen", label = locale("menu" ,"cus_id"), default = 1, options = nearbyList }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = "select",
|
||||
text = locale("menu" ,"cus_id"),
|
||||
name = "citizen",
|
||||
label = locale("menu" ,"cus_id"),
|
||||
default = 1,
|
||||
options = nearbyList
|
||||
}
|
||||
else
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = locale("menu" ,"cus_id") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'text',
|
||||
isRequired = true,
|
||||
name = 'citizen',
|
||||
text = locale("menu" ,"cus_id")
|
||||
}
|
||||
end
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'number',
|
||||
isRequired = true,
|
||||
name = 'price',
|
||||
text = locale("menu" ,"amount_charge")
|
||||
}
|
||||
|
||||
local dialog = createInput(Jobs[Playerinfo.job].label, newinputs)
|
||||
if dialog then
|
||||
jsonPrint(dialog)
|
||||
if dialog[1] then
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.price = dialog[2]
|
||||
@@ -42,9 +73,13 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob, commPercent)
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = locale("menu" ,"bank_charge")..amount }
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "",
|
||||
txt = locale("menu" ,"bank_charge")..amount
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check",
|
||||
header = locale("menu" ,"yes"),
|
||||
@@ -54,6 +89,7 @@ RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, bille
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
commPercent = commPercent,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name "Jim-Payments"
|
||||
author "Jimathy"
|
||||
version "3.0"
|
||||
description "Payment Script By Jimathy"
|
||||
version "3.0.02"
|
||||
description "Payment Script"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
lua54 'yes'
|
||||
@@ -12,25 +12,12 @@ shared_scripts {
|
||||
'locales/*.lua',
|
||||
'config.lua',
|
||||
|
||||
-- Required core scripts
|
||||
'@ox_lib/init.lua',
|
||||
'@ox_core/lib/init.lua',
|
||||
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
'@qbx_core/modules/playerdata.lua',
|
||||
|
||||
--Jim Bridge
|
||||
--Jim Bridge - https://github.com/jimathy/jim-bridge
|
||||
'@jim_bridge/starter.lua',
|
||||
|
||||
'shared/*.lua',
|
||||
}
|
||||
client_scripts {
|
||||
'@PolyZone/client.lua',
|
||||
'@PolyZone/BoxZone.lua',
|
||||
'@PolyZone/EntityZone.lua',
|
||||
'@PolyZone/CircleZone.lua',
|
||||
'@PolyZone/ComboZone.lua',
|
||||
|
||||
'client/*.lua',
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,49 @@
|
||||
registerCommand("cashgive", {
|
||||
locale("command" , "pay_user"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
||||
end
|
||||
})
|
||||
onResourceStart(function()
|
||||
registerCommand("cashgive", {
|
||||
locale("command" , "pay_user"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
||||
end
|
||||
})
|
||||
|
||||
createCallback(getScript()..":GetInfo", function(source)
|
||||
local Player = getPlayer(source)
|
||||
local society, gsociety = 0, 0
|
||||
|
||||
society = getSocietyAccount(Player.job)
|
||||
if Player.gang ~= "none" then
|
||||
gsociety = getSocietyAccount(Player.gang)
|
||||
end
|
||||
|
||||
-- Savings account is only QBCore for now
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then
|
||||
-- Grab Savings account info
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
if result[1] then
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
else
|
||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.citizenId, 'Savings_'..Player.citizenId, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
end
|
||||
end
|
||||
local retTable = {
|
||||
name = Player.firstname..' '..Player.lastname,
|
||||
cash = Player.cash,
|
||||
bank = Player.bank,
|
||||
account = Player.account,
|
||||
cid = Player.citizenId.." ["..source.."]",
|
||||
savbal = savingBalance,
|
||||
aid = accountID,
|
||||
society = society,
|
||||
gsociety = gsociety
|
||||
}
|
||||
|
||||
return retTable
|
||||
end)
|
||||
end, true)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, baccount, account, society, gsociety)
|
||||
local src = source
|
||||
@@ -207,44 +246,6 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
|
||||
end
|
||||
end)
|
||||
|
||||
createCallback(getScript()..":GetInfo", function(source)
|
||||
local Player = getPlayer(source)
|
||||
local society, gsociety = 0, 0
|
||||
|
||||
society = getSocietyAccount(Player.job)
|
||||
if Player.gang ~= "none" then
|
||||
gsociety = getSocietyAccount(Player.gang)
|
||||
end
|
||||
|
||||
-- Savings account is only QBCore for now
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then
|
||||
-- Grab Savings account info
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
if result[1] then
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
else
|
||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.citizenId, 'Savings_'..Player.citizenId, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
end
|
||||
end
|
||||
local retTable = {
|
||||
name = Player.firstname..' '..Player.lastname,
|
||||
cash = Player.cash,
|
||||
bank = Player.bank,
|
||||
account = Player.account,
|
||||
cid = Player.citizenId.." ["..source.."]",
|
||||
savbal = savingBalance,
|
||||
aid = accountID,
|
||||
society = society,
|
||||
gsociety = gsociety
|
||||
}
|
||||
|
||||
return retTable
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
|
||||
local Player = getPlayer(source)
|
||||
local Reciever = getPlayer(tonumber(citizen))
|
||||
|
||||
@@ -9,24 +9,34 @@ onResourceStart(function()
|
||||
if Items and not Items["payticket"] then
|
||||
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
|
||||
end
|
||||
|
||||
registerCommand("cashregister", {
|
||||
locale("command", "cash_reg"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end
|
||||
})
|
||||
|
||||
createCallback(getScript()..":MakePlayerList", function(source)
|
||||
local onlineList = {}
|
||||
for _, v in pairs(GetPlayers()) do
|
||||
if v ~= nil or type(v) ~= "number" then
|
||||
local Player = getPlayer(v)
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
||||
Wait(10)
|
||||
end
|
||||
end
|
||||
return onlineList
|
||||
end)
|
||||
|
||||
|
||||
if Config.General.Usebzzz then
|
||||
createUseableItem('terminal', function(source, item)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end)
|
||||
end
|
||||
end, true)
|
||||
|
||||
registerCommand("cashregister", {
|
||||
locale("command", "cash_reg"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end
|
||||
})
|
||||
|
||||
createCallback(getScript()..":MakePlayerList", function(source)
|
||||
local onlineList = {}
|
||||
for _, v in pairs(GetPlayers()) do
|
||||
local Player = getPlayer(v)
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
||||
end
|
||||
return onlineList
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||
local src = source
|
||||
local biller = getPlayer(src)
|
||||
@@ -90,12 +100,4 @@ RegisterServerEvent(getScript()..":server:PayPopup", function(data)
|
||||
triggerNotify(nil, locale("success", "declined"), "error", src)
|
||||
triggerNotify(nil, billed.firstname..locale("error", "decline_pay")..data.amount..locale("success", "payment"), "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
if Config.General.Usebzzz then
|
||||
createUseableItem('terminal', function(source, item)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -1,9 +1,11 @@
|
||||
registerCommand("polcharge", {
|
||||
locale("command", "charge"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||
end
|
||||
})
|
||||
onResourceStart(function()
|
||||
registerCommand("polcharge", {
|
||||
locale("command", "charge"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||
end
|
||||
})
|
||||
end, true)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||
local src = source
|
||||
@@ -12,12 +14,7 @@ RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||
local price = math.floor(tonumber(price))
|
||||
|
||||
local commPercent = Config.PolCharge.FineJobs[biller.job] and Config.PolCharge.FineJobs[biller.job].Commission or 0.25
|
||||
if Config.PolCharge.FineJobs[biller.job] then
|
||||
commPercent = Config.PolCharge.FineJobs[biller.job].Commission
|
||||
else
|
||||
commPercent = 0.25
|
||||
print("Can't find job in 'FineJobs', defaulting to 0.25 (25% commission)")
|
||||
end
|
||||
|
||||
local commission = math.floor(price * commPercent)
|
||||
|
||||
if price > 0 then
|
||||
|
||||
@@ -3,11 +3,9 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
|
||||
local activePlayers = GetPlayers()
|
||||
local commPercent = 0
|
||||
jsonPrint(data)
|
||||
if Config.Receipts.Jobs[data.society] then
|
||||
commPercent = Config.Receipts.Jobs[data.society].Commission
|
||||
else commPercent = 0.25
|
||||
print("^1Error^7: ^2Can't find job in ^7'^3Config^7.^3Receipts^7.^3Jobs^7', ^2defaulting to 0.25 (25% commission)^7")
|
||||
end
|
||||
|
||||
local commPercent = Config.PolCharge.FineJobs[data.society] and Config.PolCharge.FineJobs[data.society].Commission or 0.25
|
||||
|
||||
local takecomm = math.floor(data.amount * commPercent)
|
||||
|
||||
if biller ~= nil then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0
|
||||
3.0.02
|
||||
Reference in New Issue
Block a user