From 9fa0c12e02efcbec33c018e8c55801dd2c59df08 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 20 Jul 2019 13:09:42 +0200 Subject: [PATCH] =?UTF-8?q?Replaced=20MaxPlayers=20with=20GetActivePlayers?= =?UTF-8?q?=20for=20all=20babies=20=F0=9F=91=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/functions.lua | 10 ++++------ config.lua | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index f7fc4107..083a4160 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -454,15 +454,13 @@ ESX.Game.GetClosestObject = function(filter, coords) end ESX.Game.GetPlayers = function() - local maxPlayers = Config.MaxPlayers - local players = {} + local players = {} - for i=0, maxPlayers, 1 do - - local ped = GetPlayerPed(i) + for _,player in ipairs(GetActivePlayers()) do + local ped = GetPlayerPed(player) if DoesEntityExist(ped) then - table.insert(players, i) + table.insert(players, player) end end diff --git a/config.lua b/config.lua index 95cd34be..223afade 100644 --- a/config.lua +++ b/config.lua @@ -10,6 +10,5 @@ Config.DisableWantedLevel = true Config.EnableHud = true -- enable the default hud? Display current job and accounts (black, bank & cash) Config.PaycheckInterval = 7 * 60000 -Config.MaxPlayers = GetConvarInt('sv_maxclients', 32) -- set this value to 255 if you're running OneSync Config.EnableDebug = false