Just found another thing that will decrease FPS in OneSync Infinity for no reason in the same file:
auto steam = GetSteam();
int playerCount = 0;
for (int i = 0; i < 256; i++)
{
// NETWORK_IS_PLAYER_ACTIVE
if (NativeInvoke::Invoke<0xB8DFD30D6973E135, bool>(i))
{
++playerCount;
}
}
static int lastPlayerCount;
if (playerCount != lastPlayerCount)
{
if (steam)
{
steam->SetRichPresenceValue(1, fmt::sprintf("%d player%s", playerCount, (playerCount != 1) ? "s" : ""));
}
OnRichPresenceSetValue(1, fmt::sprintf("%d player%s", playerCount, (playerCount != 1) ? "s" : ""));
lastPlayerCount = playerCount;
}
I’m guessing it’s showing in the Steam Friend List how many players are playing in the server you are in (Which I never saw working for some reason), in a very stupid way, because, Firstly: FiveM themselves told us to use GetActivePlayers instead of looping 256 and check who’s active(in here).
Secondly: This is checks the online players from the client-side, which in OneSync Infinity will show only the players inside the client ‘focus zone’ (350 units away from them), and won’t count all of the players. which probably needs fixing too.
Thirdly:
static int lastPlayerCount;
Is it supposed to be a static variable?? I thought you wanted it to change every time the count is different, now it will always be like the first count and will never change… (Maybe it’s supposed to be like that, I’m just asking because it’s looks weird to me)
Again, I don’t know how to fix it due it’s in c++, but I guess it helped you in some sort of way.