Merge pull request #1832 from seltonmt012/perf/pickup-closest-player

perf(es_extended/client): only look up the closest player when the pickup prompt is used
This commit is contained in:
_Not_
2026-08-14 19:44:56 -05:00
committed by GitHub
+2 -1
View File
@@ -372,7 +372,6 @@ if not Config.CustomInventory then
while true do
local Sleep = 1500
local playerCoords = GetEntityCoords(ESX.PlayerData.ped)
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
for pickupId, pickup in pairs(pickups) do
local distance = #(playerCoords - pickup.coords)
@@ -383,6 +382,8 @@ if not Config.CustomInventory then
if distance < 1 then
if IsControlJustReleased(0, 38) then
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
if IsPedOnFoot(ESX.PlayerData.ped) and (closestDistance == -1 or closestDistance > 3) and not pickup.inRange then
pickup.inRange = true