mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 14:56:02 +01:00
Add files via upload
This commit is contained in:
@@ -109,3 +109,62 @@ function atmWithdrawl(info)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent(getScript()..":client:ATM:give", function()
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
local nearbyList = {}
|
||||
if Config.General.List then -- If nearby player list is wanted:
|
||||
--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
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do
|
||||
local ped = GetPlayerPed(v)
|
||||
local dist = #(GetEntityCoords(ped) - playerCoords)
|
||||
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)'
|
||||
}
|
||||
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
|
||||
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") }
|
||||
end
|
||||
|
||||
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',
|
||||
text = locale("menu" ,"type"),
|
||||
default = billPrev,
|
||||
options = {
|
||||
{ value = "cash", text = locale("menu" ,"cash"), label = locale("menu" ,"cash") },
|
||||
}
|
||||
}
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
|
||||
local dialog = createInput(locale("menu", "give_cash"), newinputs)
|
||||
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.billtype = dialog[2]
|
||||
dialog.price = dialog[3]
|
||||
end
|
||||
billPrev = dialog.billtype
|
||||
TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
@@ -103,7 +103,7 @@ RegisterNetEvent(getScript()..":Client:Bank", function(data) local setheader = n
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) then
|
||||
if isStarted(QBExport) then -- only supports qbcore account transfers
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "soc_trans"),
|
||||
txt = Jobs[info.job].label or "Error",
|
||||
|
||||
@@ -5,8 +5,8 @@ function spawnCustomRegisters()
|
||||
for k, v in pairs(Config.CustomCashRegisters) do
|
||||
for i = 1, #v do
|
||||
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=Config.Debug, 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 = Loc[Config.Lan].target["charge"], }
|
||||
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"), }
|
||||
}, 2.0)
|
||||
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
|
||||
end
|
||||
@@ -17,50 +17,57 @@ onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
||||
|
||||
local billPrev = "cash"
|
||||
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
--Check if player is using /cashregister command
|
||||
local dialog
|
||||
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "error") 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 nearbyList = {}
|
||||
if Config.General.List then -- If nearby player list is wanted:
|
||||
--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
|
||||
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)' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do
|
||||
local ped = GetPlayerPed(v)
|
||||
local dist = #(GetEntityCoords(ped) - playerCoords)
|
||||
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)'
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, locale("error" ,"no_one"), "error") return end
|
||||
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 = Loc[Config.Lan].menu["person_id"], text = Loc[Config.Lan].menu["person_id"] }
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, required = true, name = 'citizen', label = locale("menu" ,"person_id"), text = locale("menu" ,"person_id") }
|
||||
end
|
||||
--Check if image was given when opening the regsiter
|
||||
local img = Config.System.Menu == "qb" and "<center><img src="..(data.img and data.img or "").." width=200px></center>" or ""
|
||||
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local label = data.gang and PlayerGang.label or PlayerJob.label
|
||||
local getInfo = getPlayer()
|
||||
--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 = Loc[Config.Lan].menu["cus_id"], name = "citizen", label = Loc[Config.Lan].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 = Loc[Config.Lan].menu["cus_id"] }
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = locale("menu" ,"cus_id") }
|
||||
end
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'select',
|
||||
name = 'billtype',
|
||||
text = Loc[Config.Lan].menu["type"],
|
||||
text = locale("menu" ,"type"),
|
||||
default = billPrev,
|
||||
options = {
|
||||
{ value = "cash", text = Loc[Config.Lan].menu["cash"], label = Loc[Config.Lan].menu["cash"] },
|
||||
{ value = "bank", text = Loc[Config.Lan].menu["card"], label = Loc[Config.Lan].menu["card"] }
|
||||
{ value = "cash", text = locale("menu" ,"cash"), label = locale("menu" ,"cash") },
|
||||
{ value = "bank", text = locale("menu" ,"card"), label = locale("menu" ,"card") }
|
||||
}
|
||||
}
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
|
||||
local dialog = createInput(img, newinputs)
|
||||
|
||||
@@ -77,26 +84,31 @@ end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
local setimage = ""
|
||||
if Config.System.Menu == "qb" then
|
||||
setimage = "<center><img src="..(img and img or "").." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then
|
||||
setimage = '..')'
|
||||
print(billerjob)
|
||||
if not img then
|
||||
setimage = billerjob
|
||||
else
|
||||
if Config.System.Menu == "qb" then
|
||||
setimage = "<center><img src="..(img and img or "").." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then
|
||||
setimage = '..')'
|
||||
end
|
||||
end
|
||||
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"],
|
||||
txt = Loc[Config.Lan].menu["accept_payment"]
|
||||
header = "🧾 "..locale("menu" ,"payment"),
|
||||
txt = locale("menu" ,"accept_payment")
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "",
|
||||
txt = billtype:gsub("^%l", string.upper)..Loc[Config.Lan].menu["payment_amount"]..amount
|
||||
txt = billtype:gsub("^%l", string.upper)..locale("menu" ,"payment_amount")..amount
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check",
|
||||
header = Loc[Config.Lan].menu["yes"],
|
||||
header = locale("menu" ,"yes"),
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
@@ -110,7 +122,7 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = Loc[Config.Lan].menu["no"],
|
||||
header = locale("menu" ,"no"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = false,
|
||||
@@ -121,6 +133,7 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
|
||||
})
|
||||
end,
|
||||
}
|
||||
debugPrint(setimage)
|
||||
openMenu(Menu, {
|
||||
header = setimage,
|
||||
onExit = function()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
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 == PlayerJob.name then allowed = true end end
|
||||
if not allowed then triggerNotify(nil, Loc[Config.Lan].error["no_job"], "error") return end
|
||||
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
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
local nearbyList = {}
|
||||
@@ -21,17 +22,17 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
end
|
||||
end
|
||||
--If list is empty(no one nearby) show error and stop
|
||||
if not nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
|
||||
if not nearbyList[1] then triggerNotify(nil, locale("error" ,"no_one"), "error") return end
|
||||
end
|
||||
|
||||
if Config.PolCharge.FineJobList then
|
||||
newinputs[#newinputs+1] = { type = "select", text = Loc[Config.Lan].menu["cus_id"], name = "citizen", label = Loc[Config.Lan].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 = Loc[Config.Lan].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 = Loc[Config.Lan].menu["amount_charge"] }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
|
||||
local dialog = createInput(img, newinputs)
|
||||
local dialog = createInput(Jobs[Playerinfo.job].label, newinputs)
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
dialog.citizen = dialog[1]
|
||||
@@ -43,10 +44,10 @@ end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = Loc[Config.Lan].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 = Loc[Config.Lan].menu["yes"],
|
||||
header = locale("menu" ,"yes"),
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
@@ -58,7 +59,7 @@ RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, bille
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = Loc[Config.Lan].menu["no"],
|
||||
header = locale("menu" ,"no"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
@@ -68,8 +69,8 @@ RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, bille
|
||||
end,
|
||||
}
|
||||
openMenu(Menu, {
|
||||
header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"],
|
||||
headertxt = Loc[Config.Lan].menu["accept_payment"],
|
||||
header = "🧾 "..billerjob..locale("menu" ,"payment"),
|
||||
headertxt = locale("menu" ,"accept_payment"),
|
||||
onExit = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
RegisterNetEvent(getScript()..":Tickets:Menu", function(data)
|
||||
local PlayerInfo = getPlayer()
|
||||
local hasItem, hasTable = hasItem("payticket", 1)
|
||||
if not hasItem then
|
||||
triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error")
|
||||
triggerNotify(nil, locale("error" ,"no_ticket"), "error")
|
||||
return
|
||||
end
|
||||
local amount, sellable, name, label = hasTable["payticket"].count, false, "", ""
|
||||
for k, v in pairs(Config.Receipts.Jobs) do
|
||||
sellable = (data.gang and v.gang and k == PlayerGang.name) or (not data.gang and not v.gang and k == PlayerJob.name)
|
||||
if sellable then name, label = k, (data.gang and PlayerGang.label) or (not data.gang and PlayerJob.label) break end
|
||||
sellable = (data.gang and v.gang and k == PlayerInfo.gang) or (not data.gang and not v.gang and k == PlayerInfo.job)
|
||||
if sellable then name, label = k, (data.gang and Gangs[PlayerInfo.gang].label) or (not data.gang and Jobs[PlayerInfo.job].label) break end
|
||||
end
|
||||
if sellable then local Menu = {}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
txt = Loc[Config.Lan].menu["ticket_amount"]..amount..Loc[Config.Lan].menu["total_pay"]..(Config.Receipts.Jobs[name].PayPerTicket * amount)
|
||||
txt = locale("menu" ,"ticket_amount")..amount..locale("menu" ,"total_pay")..(Config.Receipts.Jobs[name].PayPerTicket * amount)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"],
|
||||
onSelect = function() TriggerServerEvent(getScript()..":Tickets:Sell") end,
|
||||
icon = "fas fa-circle-check", header = locale("menu" ,"yes"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":Tickets:Sell")
|
||||
playAnim("pickup_object", "putdown_low", 2000, 1)
|
||||
end,
|
||||
}
|
||||
openMenu(Menu, { header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], headertxt = Loc[Config.Lan].menu["trade_confirm"], canClose = true, })
|
||||
openMenu(Menu, { header = "🧾 "..label..locale("menu" ,"receipt"), headertxt = locale("menu" ,"trade_confirm"), canClose = true, })
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user