hotfix: fix getNearbyPlayers function with vector3 as source

This commit is contained in:
TheFantomas
2023-08-15 18:00:44 +02:00
parent ecc7d122e3
commit 741ee9c1f5
+11
View File
@@ -9,7 +9,9 @@ local function getNearbyPlayers(source, closest, distance, ignore)
local count = 0
local playerPed
local playerCoords
if not distance then distance = 100 end
if type(source) == 'number' then
playerPed = GetPlayerPed(source)
@@ -26,6 +28,15 @@ local function getNearbyPlayers(source, closest, distance, ignore)
end
end
if type(source) == 'vector3' then
playerCoords = source
if not playerCoords then
error("Received nil value (playerCoords); perhaps source is nil at first place?")
return result
end
end
for _, xPlayer in pairs(ESX.Players) do
if not ignore or not ignore[xPlayer.source] then
local entity = GetPlayerPed(xPlayer.source)