add workaround for if onlineList is nil

This commit is contained in:
Jim Shield
2025-05-26 18:59:10 +01:00
parent 2e3fef8846
commit 1ca2e45a37

View File

@@ -33,8 +33,13 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
--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())
if onlineList == nil or #onlineList == 0 then
goto failed
end
for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do
local ped = GetPlayerPed(v)
local dist = #(GetEntityCoords(ped) - playerCoords)
@@ -50,6 +55,7 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
end
end
end
::failed::
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then