mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Added menu on payment
The menu when cashing in receipts was added while testing stuff, I may expand it on this more
This commit is contained in:
24
client.lua
24
client.lua
@@ -1,7 +1,6 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
PlayerJob = {}
|
||||
|
||||
local onDuty = false
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
|
||||
@@ -23,14 +22,14 @@ AddEventHandler('QBCore:Client:SetDuty', function(duty)
|
||||
end)
|
||||
|
||||
--Keeps track of duty on script restarts
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job onDuty = PlayerJob.onduty end) end end)
|
||||
AddEventHandler('onResourceStart', function(resource)
|
||||
if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job onDuty = PlayerJob.onduty end) end end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
local jobroles = {}
|
||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
||||
Wait(500)
|
||||
exports['qb-target']:AddBoxZone("JimBank", vector3(251.75, 222.17, 106.2), 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=false, minZ = 105.75, maxZ = 107.29, },
|
||||
{ options = { { type = 'server', event = "jim-payments:Tickets:Sell", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles }, },
|
||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
||||
exports['qb-target']:AddBoxZone("JimBank", vector3(251.75, 222.17, 106.2), 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=true, minZ = 105.75, maxZ = 107.29, },
|
||||
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } },
|
||||
distance = 2.0
|
||||
})
|
||||
end)
|
||||
@@ -51,3 +50,16 @@ RegisterNetEvent('jim-payments:client:Charge', function()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
||||
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
||||
else exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = PlayerJob.label.." Ticket Payment", txt = "Do you want trade your tickets for payment?" },
|
||||
{ header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
||||
{ header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, })
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
||||
|
||||
Reference in New Issue
Block a user