From a335196d107883408258b8efeca80c12dfa7249c Mon Sep 17 00:00:00 2001 From: Taso Date: Mon, 27 Sep 2021 16:42:32 -0400 Subject: [PATCH] feat(server/functions): Add GetQBPlayers() fn A wrapper that returns an array of QB Player instances. Mainly to provide a better solution to the GetPlayers() -> GetPlayer pattern seen everywhere. --- server/functions.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/functions.lua b/server/functions.lua index b3da399..16a052b 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -71,6 +71,11 @@ function QBCore.Functions.GetPlayers() return sources end +-- Will return an array of QB Player class instances +-- unlike the GetPlayers() wrapper which only returns IDs +function QBCore.Functions.GetQBPlayers() + return QBCore.Players +end -- Paychecks (standalone - don't touch) function PaycheckLoop() @@ -293,4 +298,4 @@ function QBCore.Functions.IsLicenseInUse(license) end end return false -end \ No newline at end of file +end