mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-16 22:06:02 +01:00
add workaround for if onlineList is nil
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user