mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-19 07:16:03 +01:00
Bug Fixes
This commit is contained in:
13
atms.lua
13
atms.lua
@@ -21,7 +21,9 @@ local function cv(amount)
|
|||||||
return formatted
|
return formatted
|
||||||
end
|
end
|
||||||
|
|
||||||
local function createBlips()
|
local bossroles = {}
|
||||||
|
local gangroles = {}
|
||||||
|
CreateThread(function()
|
||||||
if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
|
if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
|
||||||
if Config.useATM then
|
if Config.useATM then
|
||||||
if Config.ATMBlips then
|
if Config.ATMBlips then
|
||||||
@@ -67,15 +69,6 @@ local function createBlips()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then createBlips() end end)
|
|
||||||
|
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() createBlips() end)
|
|
||||||
|
|
||||||
local bossroles = {}
|
|
||||||
local gangroles = {}
|
|
||||||
Citizen.CreateThread(function()
|
|
||||||
if Config.useATM or Config.useBanks then
|
if Config.useATM or Config.useBanks then
|
||||||
for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
|
for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
|
||||||
for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
|
for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, ba
|
|||||||
local cashB = Player.Functions.GetMoney("cash")
|
local cashB = Player.Functions.GetMoney("cash")
|
||||||
local bankB = Player.Functions.GetMoney("bank")
|
local bankB = Player.Functions.GetMoney("bank")
|
||||||
local amount = tonumber(amount)
|
local amount = tonumber(amount)
|
||||||
--TriggerClientEvent("QBCore:Notify", src, tostring(account), "error")
|
|
||||||
|
|
||||||
--Simple transfers from bank to wallet --
|
--Simple transfers from bank to wallet --
|
||||||
if account == "bank" or account == "atm" then
|
if account == "bank" or account == "atm" then
|
||||||
|
|||||||
14
client.lua
14
client.lua
@@ -2,7 +2,7 @@ local QBCore = exports['qb-core']:GetCoreObject()
|
|||||||
|
|
||||||
PlayerJob = {}
|
PlayerJob = {}
|
||||||
local onDuty = false
|
local onDuty = false
|
||||||
local BankPed = nil
|
local BankPed = {}
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
||||||
RegisterNetEvent('QBCore:Client:OnJobUpdate') AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
RegisterNetEvent('QBCore:Client:OnJobUpdate') AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
||||||
RegisterNetEvent('QBCore:Client:SetDuty') AddEventHandler('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
RegisterNetEvent('QBCore:Client:SetDuty') AddEventHandler('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||||
@@ -11,16 +11,15 @@ RegisterNetEvent('QBCore:Client:OnGangUpdate') AddEventHandler('QBCore:Client:On
|
|||||||
--Keeps track of duty on script restarts
|
--Keeps track of duty on script restarts
|
||||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end) end end)
|
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end) end end)
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
CreateThread(function()
|
||||||
local jobroles = {}
|
local jobroles = {}
|
||||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
||||||
--exports['qb-target']:AddBoxZone("JimBank", Config.CashInLocation, 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=Config.Debug, minZ = 105.75, maxZ = 107.29, },
|
|
||||||
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
||||||
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
|
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
|
||||||
if Config.Peds then
|
if Config.Peds then
|
||||||
local i = math.random(1, #Config.PedPool)
|
local i = math.random(1, #Config.PedPool)
|
||||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
||||||
if BankPed == nil then BankPed = CreatePed(0, Config.PedPool[i], Config.CashInLocation, Config.CashInLocation[4], false, false) end
|
if not BankPed[1] then BankPed[1] = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
|
||||||
if Config.Debug then print("Ped Created for Ticket Trade") end
|
if Config.Debug then print("Ped Created for Ticket Trade") end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -57,8 +56,9 @@ RegisterNetEvent('jim-payments:client:Charge', function(data)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
||||||
local amount = nil
|
local amount = 0
|
||||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
||||||
|
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
||||||
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
||||||
else exports['qb-menu']:openMenu({
|
else exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||||
@@ -70,7 +70,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
||||||
if img == nil then img = "" end
|
if not img then img = "" end
|
||||||
exports['qb-menu']:openMenu({
|
exports['qb-menu']:openMenu({
|
||||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||||
@@ -82,5 +82,5 @@ RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent(
|
|||||||
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(resource)
|
AddEventHandler('onResourceStop', function(resource)
|
||||||
if resource == GetCurrentResourceName() then exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed) end
|
if resource == GetCurrentResourceName() then exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed[1]) end
|
||||||
end)
|
end)
|
||||||
@@ -6,7 +6,7 @@ print("Jim-Payments v2.4 - Payments Script by Jimathy")
|
|||||||
|
|
||||||
Config = {}
|
Config = {}
|
||||||
|
|
||||||
Config.Debug = false
|
Config.Debug = true
|
||||||
|
|
||||||
Config.Manage = true -- "true" if using qb-management
|
Config.Manage = true -- "true" if using qb-management
|
||||||
-- "false" if using qb-bossmenu
|
-- "false" if using qb-bossmenu
|
||||||
|
|||||||
Reference in New Issue
Block a user