mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
hotfix: fix getNearbyPlayers function with vector3 as source
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user