mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d252ce6a02 | ||
|
|
4bc2aaa95f | ||
|
|
fdf92fde64 | ||
|
|
954b208016 | ||
|
|
51265681c1 | ||
|
|
6ab839e2a3 | ||
|
|
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
|
||||||
13
README.md
13
README.md
@@ -40,19 +40,24 @@ ensure [jim]
|
|||||||
|
|
||||||
---
|
---
|
||||||
## BZZ Terminal Instructions
|
## BZZ Terminal Instructions
|
||||||
Free Package https://bzzz.tebex.io/package/5551076
|
|
||||||
|
|
||||||
Stream the prop and add the emote that is provided to rpemotes or dpemotes
|
If you enable Config.General.Usebzzz then the script will use `bzzz_terminal` to automatically create a prop and animation when using the commands:
|
||||||
|
- `/cashregister`
|
||||||
|
- `/terminal`
|
||||||
|
|
||||||
|
This is also available as an item users can use by adding this to your shared items
|
||||||
```lua
|
```lua
|
||||||
['terminal'] = {['name'] = 'terminal', ['label'] = 'Wireless Terminal', ['weight'] = 5000, ["type"] = "item", ["image"] = 'terminal.png', ['unique'] = true, ['useable'] = true, ["shouldClose"] = true, ["combinable"] = nil, ['description'] = ''},
|
terminal = { name = 'terminal', label = 'Wireless Terminal', weight = 5000, ["type"] = "item", ["image"] = 'terminal.png', unique = true, useable = true, ["shouldClose"] = true, ["combinable"] = nil, description = '' },
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This payment terminal prop is available as a Free Package from https://bzzz.tebex.io/package/5551076
|
||||||
|
|
||||||
---
|
---
|
||||||
## Item installation
|
## Item installation
|
||||||
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
|
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
|
||||||
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
|
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
|
||||||
```lua
|
```lua
|
||||||
payticket = { name = "payticket", label = "Receipt", weight = 10, type = "item", image = "ticket.png", unique = false, useable = false, shouldClose = false, description = "Cash these in at the bank!" },
|
payticket = { name = "payticket", label = "Receipt", weight = 10, type = "item", image = "ticket.png", unique = false, useable = false, shouldClose = false, description = "Cash these in at the bank!" },
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add the ticket image to your inventory script:
|
- Add the ticket image to your inventory script:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function spawnCustomRegisters()
|
|||||||
for i = 1, #v do
|
for i = 1, #v do
|
||||||
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
|
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
|
||||||
createBoxTarget({"CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=debugMode, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4}}, {
|
createBoxTarget({"CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=debugMode, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4}}, {
|
||||||
{ onSelect = function() TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""}) end, icon = "fas fa-credit-card", label = locale("target", "charge"), }
|
{ action = function() TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""}) end, icon = "fas fa-credit-card", label = locale("target", "charge"), }
|
||||||
}, 2.0)
|
}, 2.0)
|
||||||
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
||||||
end
|
end
|
||||||
@@ -16,8 +16,8 @@ end
|
|||||||
|
|
||||||
onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
||||||
|
|
||||||
local billPrev = "cash"
|
|
||||||
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||||
|
local billPrev = "cash"
|
||||||
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, locale("error", "not_onduty") return end
|
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, locale("error", "not_onduty") return end
|
||||||
local newinputs = {} -- Begin qb-input creation here.
|
local newinputs = {} -- Begin qb-input creation here.
|
||||||
local nearbyList = {}
|
local nearbyList = {}
|
||||||
@@ -42,22 +42,45 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--If list is empty(no one nearby) show error and stop
|
--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
|
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
|
end
|
||||||
|
|
||||||
|
local prop = nil
|
||||||
|
if Config.General.Usebzzz then
|
||||||
|
local Ped = PlayerPedId()
|
||||||
|
prop = makeProp({ prop = 'bzzz_prop_payment_terminal', coords = vec4(0,0,0,0)}, false, true)
|
||||||
|
AttachEntityToEntity(prop, Ped, GetPedBoneIndex(Ped, 57005), 0.17, 0.04, 0.01, 340.0, 200.0, 50.0, true, true, false, false, 1, true)
|
||||||
|
playAnim('cellphone@', 'cellphone_text_read_base', -1, 49)
|
||||||
|
end
|
||||||
|
|
||||||
--Grab Player Job name or Gang Name if needed
|
--Grab Player Job name or Gang Name if needed
|
||||||
local getInfo = getPlayer()
|
local getInfo = getPlayer()
|
||||||
--Check if image was given when opening the regsiter
|
--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
|
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] = {
|
newinputs[#newinputs+1] = {
|
||||||
type = 'select',
|
type = 'select',
|
||||||
name = 'billtype',
|
name = 'billtype',
|
||||||
@@ -73,7 +96,11 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
|||||||
local dialog = createInput(img, newinputs)
|
local dialog = createInput(img, newinputs)
|
||||||
|
|
||||||
if dialog then
|
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.citizen = dialog[1]
|
||||||
dialog.billtype = dialog[2]
|
dialog.billtype = dialog[2]
|
||||||
dialog.price = dialog[3]
|
dialog.price = dialog[3]
|
||||||
@@ -81,11 +108,15 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
|||||||
billPrev = dialog.billtype
|
billPrev = dialog.billtype
|
||||||
TriggerServerEvent(getScript()..":server:Charge", dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
TriggerServerEvent(getScript()..":server:Charge", dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||||
end
|
end
|
||||||
|
if Config.General.Usebzzz then
|
||||||
|
destroyProp(prop)
|
||||||
|
stopAnim('cellphone@', 'cellphone_text_read_base')
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||||
local setimage = ""
|
local setimage = ""
|
||||||
print(billerjob)
|
|
||||||
if not img then
|
if not img then
|
||||||
setimage = billerjob
|
setimage = billerjob
|
||||||
else
|
else
|
||||||
@@ -134,7 +165,7 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
debugPrint(setimage)
|
|
||||||
openMenu(Menu, {
|
openMenu(Menu, {
|
||||||
header = setimage,
|
header = setimage,
|
||||||
onExit = function()
|
onExit = function()
|
||||||
|
|||||||
@@ -2,38 +2,69 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
|||||||
local Playerinfo = getPlayer()
|
local Playerinfo = getPlayer()
|
||||||
--Check if player is allowed to use /cashregister command
|
--Check if player is allowed to use /cashregister command
|
||||||
local allowed = false
|
local allowed = false
|
||||||
for k in pairs(Config.PolCharge.FineJobs) do if k == Playerinfo.job then allowed = true end end
|
for k in pairs(Config.PolCharge.FineJobs) do
|
||||||
if not allowed then triggerNotify(nil, locale("error", "no_job"), "error") return end
|
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 newinputs = {} -- Begin qb-input creation here.
|
||||||
local nearbyList = {}
|
local nearbyList = {}
|
||||||
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
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")
|
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
|
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||||
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() or debugMode 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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--If list is empty(no one nearby) show error and stop
|
--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
|
||||||
end
|
triggerNotify(nil, locale("error" ,"no_one"), "error")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if Config.PolCharge.FineJobList then
|
newinputs[#newinputs+1] = {
|
||||||
newinputs[#newinputs+1] = { type = "select", text = locale("menu" ,"cus_id"), name = "citizen", label = locale("menu" ,"cus_id"), default = 1, options = nearbyList }
|
type = "select",
|
||||||
|
text = locale("menu" ,"cus_id"),
|
||||||
|
name = "citizen",
|
||||||
|
label = locale("menu" ,"cus_id"),
|
||||||
|
default = 1,
|
||||||
|
options = nearbyList
|
||||||
|
}
|
||||||
else
|
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
|
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)
|
local dialog = createInput(Jobs[Playerinfo.job].label, newinputs)
|
||||||
if dialog then
|
if dialog then
|
||||||
|
jsonPrint(dialog)
|
||||||
if dialog[1] then
|
if dialog[1] then
|
||||||
dialog.citizen = dialog[1]
|
dialog.citizen = dialog[1]
|
||||||
dialog.price = dialog[2]
|
dialog.price = dialog[2]
|
||||||
@@ -42,9 +73,13 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob, commPercent)
|
||||||
local Menu = {}
|
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] = {
|
Menu[#Menu+1] = {
|
||||||
icon = "fas fa-circle-check",
|
icon = "fas fa-circle-check",
|
||||||
header = locale("menu" ,"yes"),
|
header = locale("menu" ,"yes"),
|
||||||
@@ -54,6 +89,7 @@ RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, bille
|
|||||||
accept = true,
|
accept = true,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
biller = biller,
|
biller = biller,
|
||||||
|
commPercent = commPercent,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Config = {
|
|||||||
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||||
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
|
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||||
|
|
||||||
Usebzzz = false, -- enable if you're using the prop from bzzz
|
Usebzzz = true, -- enable if you're using the prop from bzzz
|
||||||
|
|
||||||
Enablecommand = true, -- Enables the /cashregister command
|
Enablecommand = true, -- Enables the /cashregister command
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "3.0"
|
version "3.0.03"
|
||||||
description "Payment Script By Jimathy"
|
description "Payment Script"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
lua54 'yes'
|
lua54 'yes'
|
||||||
@@ -12,25 +12,12 @@ shared_scripts {
|
|||||||
'locales/*.lua',
|
'locales/*.lua',
|
||||||
'config.lua',
|
'config.lua',
|
||||||
|
|
||||||
-- Required core scripts
|
--Jim Bridge - https://github.com/jimathy/jim_bridge
|
||||||
'@ox_lib/init.lua',
|
|
||||||
'@ox_core/lib/init.lua',
|
|
||||||
|
|
||||||
'@es_extended/imports.lua',
|
|
||||||
|
|
||||||
'@qbx_core/modules/playerdata.lua',
|
|
||||||
|
|
||||||
--Jim Bridge
|
|
||||||
'@jim_bridge/starter.lua',
|
'@jim_bridge/starter.lua',
|
||||||
|
|
||||||
'shared/*.lua',
|
'shared/*.lua',
|
||||||
}
|
}
|
||||||
client_scripts {
|
client_scripts {
|
||||||
'@PolyZone/client.lua',
|
|
||||||
'@PolyZone/BoxZone.lua',
|
|
||||||
'@PolyZone/EntityZone.lua',
|
|
||||||
'@PolyZone/CircleZone.lua',
|
|
||||||
'@PolyZone/ComboZone.lua',
|
|
||||||
|
|
||||||
'client/*.lua',
|
'client/*.lua',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
images/terminal.png
Normal file
BIN
images/terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -1,10 +1,49 @@
|
|||||||
registerCommand("cashgive", {
|
onResourceStart(function()
|
||||||
locale("command" , "pay_user"), {}, false,
|
registerCommand("cashgive", {
|
||||||
function(source)
|
locale("command" , "pay_user"), {}, false,
|
||||||
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
function(source)
|
||||||
end
|
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)
|
RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, baccount, account, society, gsociety)
|
||||||
local src = source
|
local src = source
|
||||||
@@ -207,44 +246,6 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
|
|||||||
end
|
end
|
||||||
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)
|
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
|
||||||
local Player = getPlayer(source)
|
local Player = getPlayer(source)
|
||||||
local Reciever = getPlayer(tonumber(citizen))
|
local Reciever = getPlayer(tonumber(citizen))
|
||||||
|
|||||||
@@ -9,24 +9,36 @@ onResourceStart(function()
|
|||||||
if Items and not Items["payticket"] then
|
if Items and not Items["payticket"] then
|
||||||
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
|
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, v in pairs({"cashregister", "terminal"}) do
|
||||||
|
registerCommand(v, {
|
||||||
|
locale("command", "cash_reg"), {}, false,
|
||||||
|
function(source)
|
||||||
|
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if Items["terminal"] then
|
||||||
|
createUseableItem("terminal", function(source, item)
|
||||||
|
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||||
|
end)
|
||||||
|
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)
|
||||||
|
|
||||||
end, true)
|
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)
|
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||||
local src = source
|
local src = source
|
||||||
local biller = getPlayer(src)
|
local biller = getPlayer(src)
|
||||||
@@ -90,12 +102,4 @@ RegisterServerEvent(getScript()..":server:PayPopup", function(data)
|
|||||||
triggerNotify(nil, locale("success", "declined"), "error", src)
|
triggerNotify(nil, locale("success", "declined"), "error", src)
|
||||||
triggerNotify(nil, billed.firstname..locale("error", "decline_pay")..data.amount..locale("success", "payment"), "error", data.biller)
|
triggerNotify(nil, billed.firstname..locale("error", "decline_pay")..data.amount..locale("success", "payment"), "error", data.biller)
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
CreateThread(function()
|
|
||||||
if Config.General.Usebzzz then
|
|
||||||
createUseableItem('terminal', function(source, item)
|
|
||||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
registerCommand("polcharge", {
|
onResourceStart(function()
|
||||||
locale("command", "charge"), {}, false,
|
registerCommand("polcharge", {
|
||||||
function(source)
|
locale("command", "charge"), {}, false,
|
||||||
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
function(source)
|
||||||
end
|
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||||
})
|
end
|
||||||
|
})
|
||||||
|
end, true)
|
||||||
|
|
||||||
RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||||
local src = source
|
local src = source
|
||||||
@@ -12,12 +14,7 @@ RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
|||||||
local price = math.floor(tonumber(price))
|
local price = math.floor(tonumber(price))
|
||||||
|
|
||||||
local commPercent = Config.PolCharge.FineJobs[biller.job] and Config.PolCharge.FineJobs[biller.job].Commission or 0.25
|
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)
|
local commission = math.floor(price * commPercent)
|
||||||
|
|
||||||
if price > 0 then
|
if price > 0 then
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
|
|||||||
local activePlayers = GetPlayers()
|
local activePlayers = GetPlayers()
|
||||||
local commPercent = 0
|
local commPercent = 0
|
||||||
jsonPrint(data)
|
jsonPrint(data)
|
||||||
if Config.Receipts.Jobs[data.society] then
|
|
||||||
commPercent = Config.Receipts.Jobs[data.society].Commission
|
local commPercent = Config.PolCharge.FineJobs[data.society] and Config.PolCharge.FineJobs[data.society].Commission or 0.25
|
||||||
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 takecomm = math.floor(data.amount * commPercent)
|
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
|
if biller ~= nil then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||||
|
|||||||
@@ -1 +1,7 @@
|
|||||||
3.0
|
3.0.03
|
||||||
|
|
||||||
|
- Adjust commands to unify /cashregister and /terminal
|
||||||
|
- If "Usebzzz = true" both commands will trigger the emote
|
||||||
|
- Updated readme to explain this
|
||||||
|
|
||||||
|
https://github.com/jimathy/jim-payments
|
||||||
Reference in New Issue
Block a user