mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user