From bc13c9d34b40f9dda959111b61a3b34749cb5aa0 Mon Sep 17 00:00:00 2001 From: Linden Date: Sun, 23 May 2021 22:18:27 +1000 Subject: [PATCH] feat(server/functions): Add a function to retrieve all xPlayer data If people need to loop through xPlayers, they should use this --- server/functions.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/functions.lua b/server/functions.lua index 46993bde..4e8da7ea 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -227,6 +227,16 @@ ESX.GetPlayers = function() return sources end +ESX.GetExtendedPlayers = function() + local xPlayers = {} + + for k,v in pairs(ESX.Players) do + xPlayers[k] = v + end + + return xPlayers +end + ESX.GetPlayerFromId = function(source) return ESX.Players[tonumber(source)] end