triggerNotify()

This commit is contained in:
Jim Shield
2022-08-22 22:13:56 +01:00
committed by GitHub
parent 6b4c6a6779
commit 8fcde5867c
5 changed files with 65 additions and 61 deletions

View File

@@ -1,4 +1,5 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
PlayerJob = {}
PlayerGang = {}
@@ -58,7 +59,7 @@ end)
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
--Check if player is using /cashregister command
if not outside and not onDuty and data.gang == nil then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, "Not Clocked in!", "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.List then -- If nearby player list is wanted:
--Retrieve a list of nearby players from server
@@ -77,7 +78,7 @@ RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
end
end
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' }
@@ -102,7 +103,7 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
--Check if player is allowed to use /cashregister command
local allowed = false
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
if not allowed then TriggerEvent("QBCore:Notify", "You don't have the required job", "error") return end
if not allowed then triggerNotify(nil, "You don't have the required job", "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.FineJobList then -- If nearby player list is wanted:
@@ -122,7 +123,7 @@ RegisterNetEvent('jim-payments:client:PolCharge', function()
end
end
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
if not nearbyList[1] then triggerNotify(nil, "No one near by to charge", "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = "# Person's ID #" }
@@ -143,7 +144,7 @@ RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
--Get ticket info
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
local amount = Citizen.Await(p)
if not amount then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") amount = 0 return end
if not amount then triggerNotify(nil, "You don't have any tickets to trade", "error") amount = 0 return end
local sellable = false
local name = "" local label = ""
--Check/adjust for job/gang names