With changing this a have 2 big problems. Trop items can see and pick all player on the server without being near and second admin menu have problem, I can see only close players…
Good morning guys. I’ve read your suggestions and opinions many times, but I still have the same problem. I have a base QBcore, which previously only had 64 slots and everything worked fine. The problem was when we upgraded to 128 slots as we had problems with voice chat (fixed) and problem finding players that are further away (in QB-Admin). I checked the solution to change Get players() to GetActivePlayer, however QBCore is a little different and I’m not able to implement the code. Inside the functions.lua (client side) I have this code, which I believe is correct, but I don’t know how to change it without making mistakes. Anyone knowledgeable on this, who can help me?
MSCore.Functions.GetPlayers = function()
local players = {}
for _, player in ipairs(GetActivePlayers()) do
local ped = GetPlayerPed(player)
if DoesEntityExist(ped) then
table.insert(players, player)
end
end
return players
end
Testing this has left me confused. I am not getting all players connected to the server.
Tested like this: Had a script print #GetActivePlayers() every frame. Had a buddy join my server, teleported next to him.
Script kept on returning 2, fine. Then I teleported some distance away - and the script started returnin 1.
FWIW the same happens if I use the old for i = 0, 255 do loop. Is there no way to get all connected players?
The limitation here seems to be what peds my client has spawned locally. Do I need to get the player list from the server every time?
Not sure why, but that native doesn’t appear on the official native reference found here. I’m not saying you’re wrong, as I do believe you are correct, it’s just not documented for some reason.
I got incredibly confused when I could only find a client-side native, but fortunately I had the cookbook article bookmarked and found your post through it.
Are CFX natives at the top of the native reference I linked not actually natives? Or are you saying GetPlayers() is different from those?
Thanks, I wasn’t aware that documentation was a thing when I made my earlier post. I’ll use that more often now. I was previously under the impression that everything was listed in the native reference.