mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Fix for data being nil
This commit is contained in:
@@ -38,7 +38,7 @@ Citizen.CreateThread(function()
|
|||||||
{ 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 })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('jim-payments:client:Charge', function()
|
RegisterNetEvent('jim-payments:client:Charge', function(data)
|
||||||
if not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
|
if not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
|
||||||
local onlineList = {}
|
local onlineList = {}
|
||||||
local nearbyList = {}
|
local nearbyList = {}
|
||||||
@@ -48,14 +48,13 @@ RegisterNetEvent('jim-payments:client:Charge', function()
|
|||||||
for i = 1, #onlineList do
|
for i = 1, #onlineList do
|
||||||
if onlineList[i].value == GetPlayerServerId(v) then
|
if onlineList[i].value == GetPlayerServerId(v) then
|
||||||
if v ~= PlayerId() then
|
if v ~= PlayerId() then
|
||||||
nearbyList[#nearbyList+1] = onlineList[i]
|
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||||
nearbyList[#nearbyList].text = nearbyList[#nearbyList].text..' ('..math.floor(dist+0.05)..'m)'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dist = nil
|
dist = nil
|
||||||
end
|
end
|
||||||
if data.img ~= nil then img = data.img else img = "" end
|
if data.img == nil then img = "" else img = data.img end
|
||||||
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||||
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send",
|
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send",
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|||||||
Reference in New Issue
Block a user