From 6fc40c7c4963acd1ccac174342268e3bfbd8ff89 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Fri, 29 Sep 2023 23:11:12 +0200 Subject: [PATCH] Update functions.lua --- [core]/es_extended/client/functions.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 19e21ac2..d8c20a17 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -426,13 +426,14 @@ function ESX.Game.GetPlayers(onlyOtherPlayers, returnKeyValue, returnPeds) local active = GetActivePlayers() for i=1, #active do - local ped = GetPlayerPed(active[i]) + local currentPlayer = active[i] + local ped = GetPlayerPed(currentPlayer) - if DoesEntityExist(ped) and ((onlyOtherPlayers and active[i] ~= myPlayer) or not onlyOtherPlayers) then + if DoesEntityExist(ped) and ((onlyOtherPlayers and currentPlayer ~= myPlayer) or not onlyOtherPlayers) then if returnKeyValue then - players[active[i]] = ped + players[currentPlayer] = ped else - players[#players + 1] = returnPeds and ped or active[i] + players[#players + 1] = returnPeds and ped or currentPlayer end end end