@FiveM_Indonesia
Yes, my post is updated to reflect.
General Comment for anyone else
As of two days ago, The es_extended resource was updated on github.
If you or anyone else is uncertain about what to do, just redownload it again.
If anyone would like to learn about it, the commit change is Here .
The red shows what it used to be.
The green shows what it is now using the new native.
Lets keep all keep this thread clean from specific questions about a specific resource(s) and put it on the track of how to use the new native.
It’d be great if we could get something like this for server-side too
I wonder, what is the difference between your solution and “just” setting max player in config to 128?
This seems to be working just fine for our players so far…
Teach me, Senpai!
Aside from any further benefits of not having to go back in and change it again if you decided to change slot count.
Think of it in another manner.
In the OP
Rather than calling the native NetworkIsPlayerActive x amount of times in the loop.
“x” being your slot count
It calls the new native once, returning only active players anyway.
Providing you an index of players that existed at the time of the calling.
So rather than your computer asking the server, “hey, does this player exist?” 128 times.
It just asks, “yo, can i get that index again?”
At least, this is what I have taken from it.
I could be slightly wrong in some aspects.
3 Likes
This would of been so nice to know a long time ago… Lol
where would i put this i need your help please…
zee
May 22, 2020, 2:20pm
17
Put it anywhere applicable, assuming it’s still compatible with whatever ESX version you’re running. If you don’t know how to do it, learn. I’m not here to do it for you.
1 Like
When I drop items, it drops to the whole server with es_extended. Any idea how to fix this? Onesync Infinity.
2 Likes
The same trouble, items can be picked up by any player, everyone can see
TigoDEV
November 4, 2020, 8:58am
20
ESX.GetPlayers()
Will returns all players founded in ESX.Players
table and does also the trick.
Only difference is, that GetActivePlayers()
is a FiveM native and available in all projects, ESX.GetPlayers()
is only available in es_extended
2 Likes
Din4J
December 13, 2020, 12:17pm
21
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…
how to write this in C# ?
List<dynamic> players = API.GetActivePlayers();
foreach (int i in players)
{
// ...
}
Haven’t tested but should work.
Its returning 0
List<dynamic> players = API.GetActivePlayers();
foreach (int number in players)
{
Main.SendChatMessage("b", number.ToString(),255,0,0);
}
if ur using oneSync-infinity, this won’t work properly as “infinity” has it’s own client resource control
1 Like
Disquse
January 4, 2021, 11:53am
28
Because you’re alone on a server? Or nobody else in your radius?
1 Like
GurraG
March 16, 2021, 8:50pm
29
do you know how to fix it then? get it from server side? if so how?
i,player in ipairs(GetActivePlayers()) do
local ped = GetPlayerPed(player)
– do stuff
end