Add files via upload

This commit is contained in:
Jim Shield
2025-02-22 13:23:43 +00:00
committed by GitHub
parent 2ebfeff554
commit ef6b664890
14 changed files with 1093 additions and 1020 deletions

View File

@@ -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)

View File

@@ -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",

View File

@@ -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()))
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)' }
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 = ""
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 = '!['..''.. ']('..(img and img or "")..')'
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()

View File

@@ -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,

View File

@@ -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)

View File

@@ -1,5 +1,3 @@
print("^2Jim^7-^2Payments ^7v^4"..GetResourceMetadata(GetCurrentResourceName(), 'version', nil):gsub("%.", "^7.^4").."^7 - ^2Payments Script by ^1Jimathy^7")
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
-- https://discord.gg/xKgQZ6wZvS

View File

@@ -1,13 +1,11 @@
Core.Commands.Add("cashgive",
Loc[Config.Lan].command["pay_user"], {}, false, function(source) TriggerClientEvent(getScript()..":client:ATM:give", source) end)
registerCommand("polcharge", {
Loc[Config.Lan].command["pay_user"], {}, false,
registerCommand("cashgive", {
locale("command" , "pay_user"), {}, false,
function(source)
TriggerClientEvent(getScript()..":client:ATM:give", source)
end
})
RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, baccount, account, society, gsociety)
local src = source
local Player = getPlayer(src)
@@ -18,19 +16,19 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
if account == "bank" or account == "atm" then
if billtype == "withdraw" then
if Player.bank < amount then
triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
triggerNotify(nil, locale("error" ,"bank_low"), "error", src)
elseif Player.bank >= tonumber(amount) then
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["from_bank"], "success") -- Don't really need this as phone gets notified when money is withdrawn
triggerNotify(nil, locale("success" ,"draw")..cv(amount)..locale("success" ,"from_bank"), "success") -- Don't really need this as phone gets notified when money is withdrawn
chargePlayer(amount, "bank", src) Wait(1500)
fundPlayer(amount, "cash", src)
end
elseif billtype == "deposit" then
if Player.cash < amount then
triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
triggerNotify(nil, locale("error" ,"no_cash"), "error", src)
elseif Player.cash >= amount then
chargePlayer(amount, "cash", src) Wait(1500)
fundPlayer(amount, "bank", src)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into_bank"], "success", src)
triggerNotify(nil, locale("success" ,"deposited")..cv(amount)..locale("success" ,"into_bank"), "success", src)
end
end
-- Transfers from bank to savings account --
@@ -42,29 +40,29 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
if savbal >= amount then
savbal -= amount
fundPlayer(amount, "cash", src)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
triggerNotify(nil, "$"..cv(amount)..locale("success" ,"draw_save"), "success", src)
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId }, function(success)
if success then return true else return false end
end)
elseif savbal < amount then
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
triggerNotify(nil, locale("error" ,"saving_low"), "error")
end
elseif billtype == "deposit" then
if amount < Player.bank then
savbal += amount
chargePlayer(amount, "bank", src)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
triggerNotify(nil, "$"..cv(amount)..locale("success", "depos_save"), "success", src)
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId}, function(success)
if success then return true else return false end
end)
else triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
else triggerNotify(nil, locale("error" ,"bank_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
triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
triggerNotify(nil, locale("error" ,"soc_low"), "error", src)
elseif tonumber(society) >= amount then
if isStarted("Renewed-Banking") then
@@ -87,10 +85,10 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
fundPlayer(amount, "bank", src)
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Removing ^7$"..amount.." ^2from account ^7'^6"..Player.job.."^7' ($"..newAmount..")")
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Jobs[Player.job].label..Loc[Config.Lan].success["account"], "success", src)
triggerNotify(nil, locale("success", "draw")..cv(amount)..locale("success", "fromthe")..Jobs[Player.job].label..locale("success" ,"account"), "success", src)
end
elseif billtype == "deposit" then
if Player.bank < amount then triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
if Player.bank < amount then triggerNotify(nil, locale("error", "nomoney_bank"), "error", src)
elseif Player.bank >= amount then
if isStarted("Renewed-Banking") then
bankScript = "Renewed-Banking"
@@ -112,7 +110,7 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
end
chargePlayer(amount, "bank", src) Wait(1500)
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Adding ^7$"..amount.." ^2to account ^7'^6"..Player.job.."^7' ($"..newAmount..")")
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Jobs[Player.job].label..Loc[Config.Lan].success["account"], "success", src)
triggerNotify(nil, locale("success", "deposited")..cv(amount)..locale("success", "into")..Jobs[Player.job].label..locale("success", "account"), "success", src)
end
end
-- Transfer from boss account to players --
@@ -145,14 +143,14 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
end
if Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.job.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
triggerNotify(nil, locale("success" ,"sent"]..amount..locale("success" ,"to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, locale("success" ,"recieved"]..cv(amount)..locale("success" ,"from"]..tostring(Player.PlayerData.job.label)..locale("success" ,"account"], "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank += amount
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
elseif not result[1] then triggerNotify(nil, locale("error" ,"error_start"]..baccount..locale("error" ,"error_end"], "error", src)
end
end]]
@@ -160,7 +158,7 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
elseif account == "gang" then
if billtype == "withdraw" then
if tonumber(gsociety) < amount then
triggerNotify(nil, Loc[Config.Lan].error["soc_low"], "error", src)
triggerNotify(nil, locale("error" ,"soc_low"), "error", src)
elseif tonumber(gsociety) >= amount then
if isStarted("Renewed-Banking") then
exports['Renewed-Banking']:removeAccountMoney(Player.gang, amount)
@@ -174,11 +172,11 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
end
fundPlayer(amount, "bank", src)
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Gangs[Player.gang].label..Loc[Config.Lan].success["account"], "success", src)
triggerNotify(nil, locale("success" ,"draw")..cv(amount)..locale("success" ,"fromthe")..Gangs[Player.gang].label..locale("success" ,"account"), "success", src)
elseif billtype == "deposit" then
if Player.bank < amount then
triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
triggerNotify(nil, locale("error" ,"nomoney_bank"), "error", src)
elseif Player.bank >= amount then
if isStarted("Renewed-Banking") then
exports['Renewed-Banking']:addAccountMoney(Player.gang, amount)
@@ -190,7 +188,7 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
exports["okokBanking"]:AddMoney(Player.gang, amount)
end
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Gangs[Player.gang].label..Loc[Config.Lan].success["account"], "success", src)
triggerNotify(nil, locale("success" ,"deposited")..cv(amount)..locale("success" ,"into")..Gangs[Player.gang].label..locale("success" ,"account"), "success", src)
end
end
-- Transfer from gang account to players --
@@ -217,14 +215,14 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
elseif Config.Banking == "fd" then exports.fd_banking:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount) end
if not Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Reciever.PlayerData.source, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.gang.label)..Loc[Config.Lan].success["account"], "success", Reciever.PlayerData.source)
triggerNotify(nil, locale("success" ,"sent")..amount..locale("success" ,"to")..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Reciever.PlayerData.source, locale("success" ,"recieved")..cv(amount)..locale("success" ,"from")..tostring(Player.PlayerData.gang.label)..locale("success" ,"account"), "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank += amount
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
elseif not result[1] then triggerNotify(nil, locale("error" ,"error_start")..baccount..locale("error" ,"error_end"), "error", src)
end
end
@@ -249,15 +247,15 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
Player.Functions.RemoveMoney('bank', amount)
if Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..cv(amount)..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
triggerNotify(nil, locale("success" ,"sent")..cv(amount)..locale("success" ,"to")..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, locale("success" ,"recieved")..cv(amount)..locale("success" ,"from")..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
else
local RecieverMoney = json.decode(result[1].money)
RecieverMoney.bank += amount
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
end
elseif not result[1] then
triggerNotify(nil, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
triggerNotify(nil, locale("error" ,"error_start")..baccount..locale("error" ,"error_end"), "error", src)
end
end
end
@@ -299,6 +297,8 @@ createCallback(getScript()..":GetInfo", function(source)
end
end
-- Savings account is only QBCore for now
if isStarted(QBExport) 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
@@ -310,6 +310,7 @@ createCallback(getScript()..":GetInfo", function(source)
accountID = result[1].citizenid
savingBalance = result[1].account_balance
end
end
local retTable = {
name = Player.firstname..' '..Player.lastname,
cash = Player.cash,
@@ -326,20 +327,20 @@ createCallback(getScript()..":GetInfo", function(source)
end)
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
local Player = Core.Functions.GetPlayer(source)
local Reciever = Core.Functions.GetPlayer(tonumber(citizen))
local Player = getPlayer(source)
local Reciever = getPlayer(tonumber(citizen))
local amount = tonumber(price)
local balance = Player.Functions.GetMoney("cash")
local balance = Player.cash
if amount and amount > 0 then
if balance >= amount then
Player.Functions.RemoveMoney('cash', amount)
triggerNotify(nil, Loc[Config.Lan].success["you_gave"]..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
Reciever.Functions.AddMoney('cash', amount)
triggerNotify(nil, Loc[Config.Lan].success["you_got"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
chargePlayer(amount, "cash", source)
triggerNotify(nil, locale("success" ,"you_gave")..Reciever.name.." $"..cv(amount), "success", source)
fundPlayer(amount, "cash", Reciever.source)
triggerNotify(nil, locale("success" ,"you_got")..cv(amount)..locale("success" ,"from")..Player.name, "success", tonumber(citizen))
elseif balance < amount then
triggerNotify(nil, Loc[Config.Lan].error["not_enough"], "error", source)
triggerNotify(nil, locale("error" ,"not_enough"), "error", source)
end
else triggerNotify(nil, Loc[Config.Lan].error["zero"], 'error', source) end
else triggerNotify(nil, locale("error" ,"zero"), 'error', source) end
end)

View File

@@ -12,7 +12,7 @@ onResourceStart(function()
end, true)
registerCommand("cashregister", {
Loc[Config.Lan].command["cash_reg"], {}, false,
locale("command", "cash_reg"), {}, false,
function(source)
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
end
@@ -22,10 +22,7 @@ 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
}
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
end
return onlineList
end)
@@ -38,8 +35,8 @@ RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, bill
local balance = billed[billtype]
if amount and amount > 0 then
if balance < amount then
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
triggerNotify(nil, locale("error", "customer_nocash"), "error", src)
triggerNotify(nil, locale("error", "you_nocash"), "error", tonumber(citizen))
return
end
local label = gang == true and Gangs[biller.gang].label or Jobs[biller.job].label
@@ -64,13 +61,13 @@ RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, bill
['@sendercitizenid'] = biller.citizenid,
['@label'] = label,
})
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = Loc[Config.Lan].success["inv_succ"], img= '/html/static/img/icons/logo.png' })
TriggerClientEvent('gksphone:notifi', billed.source, {title = 'Billing', message = Loc[Config.Lan].success["inv_recieved"], img= '/html/static/img/icons/logo.png' })
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = locale("success", "inv_succ"), img= '/html/static/img/icons/logo.png' })
TriggerClientEvent('gksphone:notifi', billed.source, {title = 'Billing', message = locale("success", "inv_recieved"), img= '/html/static/img/icons/logo.png' })
end
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.source)
triggerNotify(nil, locale("success", "inv_succ"), 'success', src)
triggerNotify(nil, locale("success", "inv_recieved"), nil, billed.source)
end
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
end)
RegisterServerEvent(getScript()..":server:PayPopup", function(data)
@@ -88,10 +85,10 @@ RegisterServerEvent(getScript()..":server:PayPopup", function(data)
exports['ap-government']:chargeCityTax(billed.source, "Item", data.amount)
end
TriggerEvent(getScript()..":Tickets:Give", newdata, biller, data.gang)
triggerNotify(nil, billed.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
triggerNotify(nil, billed.firstname..locale("success", "accepted_pay")..data.amount..locale("success", "payment"), "success", data.biller)
elseif not data.accept then
triggerNotify(nil, Loc[Config.Lan].success["declined"], "error", src)
triggerNotify(nil, billed.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
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)

View File

@@ -1,5 +1,5 @@
registerCommand("polcharge", {
Loc[Config.Lan].command["charge"], {}, false,
locale("command", "charge"), {}, false,
function(source)
TriggerClientEvent(getScript()..":client:PolCharge", source)
end
@@ -31,12 +31,12 @@ RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
amountChange = (price - commission)
})
triggerNotify(nil, billed.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.source)
triggerNotify(nil, billed.firstname..locale("success", "charged")..(price - commission), "success", src)
triggerNotify(nil, locale("success", "you_charged")..(price - commission), nil, billed.source)
else
TriggerClientEvent(getScript()..":client:PolPopup", billed.source, price, src, biller.job, commPercent)
end
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
end)
RegisterServerEvent(getScript()..":server:PolPopup", function(data)
@@ -55,8 +55,8 @@ RegisterServerEvent(getScript()..":server:PolPopup", function(data)
amountChange = (price - commission)
})
elseif not data.accept then
triggerNotify(nil, Loc[Config.Lan].error["declined_payment"], nil, src)
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..Loc[Config.Lan].success["charge_end"], "error", data.biller)
triggerNotify(nil, locale("error", "declined_payment"), nil, src)
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..locale("success", "charge_end"), "error", data.biller)
end
end)

View File

@@ -47,7 +47,7 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
biller = Player
end
end
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.source)
triggerNotify(nil, data.sender..locale("success", "invoice_start")..data.amount..locale("success", "invoice_end"), "success", biller.source)
end
-- If ticket system enabled, do this
@@ -60,21 +60,21 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
if gang then
if Player.gang == data.society then
addItem("payticket", 1, nil, Player.source)
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.source)
triggerNotify(nil, locale("success", "rec_rec"), 'success', Player.source)
end
else
print("player found")
if Player.job == data.society and Player.onDuty then
print("player on duty, giving tickets")
addItem("payticket", 1, nil, Player.source)
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.source)
triggerNotify(nil, locale("success", "rec_rec"), 'success', Player.source)
end
end
end
end
else
addItem("payticket", 1, nil, biller.source)
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.source)
triggerNotify(nil, locale("success", "rec_rec"), 'success', biller.source)
end
end
end
@@ -85,10 +85,10 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
if Config.Receipts.CommissionLimit and data.amount < Config.Receipts.Jobs[data.society].MinAmountforTicket then return end
if Config.Receipts.CommissionDouble then
fundPlayer(math.floor(tonumber(data.amount) * (comm *2)), "bank", biller.source)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * (comm *2))..Loc[Config.Lan].success["commission"], "success", biller.source)
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * (comm *2))..locale("success", "commission"), "success", biller.source)
else
fundPlayer(math.floor(tonumber(data.amount) *comm), "bank", biller.source)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.source)
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * comm)..locale("success", "commission"), "success", biller.source)
end
if Config.Receipts.CommissionAll then
for _, v in pairs(activePlayers) do
@@ -96,7 +96,7 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
if v ~= biller.source then
if Player.job == data.society and Player.onDuty then
fundPlayer(math.floor(tonumber(data.amount) * comm), "bank", Player.source)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.source)
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * comm)..locale("success", "commission"), "success", Player.source)
end
end
end
@@ -108,13 +108,13 @@ RegisterServerEvent(getScript()..":Tickets:Sell", function() local src = source
local Player = getPlayer(src)
local hasItem, hasTable = hasItem("payticket", 1, src)
if not hasItem then
triggerNotify(nil, Loc[Config.Lan].error["no_ticket_to"], 'error', src)
triggerNotify(nil, locale("error", "no_ticket_to"), 'error', src)
return
else
local tickets = hasTable["payticket"].count
removeItem("payticket", tickets, src)
local pay = (tickets * Config.Receipts.Jobs[Player.job].PayPerTicket)
fundPlayer(pay, "bank", src)
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', src)
triggerNotify(nil, locale("success", "trade_ticket_start")..tickets..locale("success", "trade_ticket_end")..cv(pay), 'success', src)
end
end)