diff --git a/extension.cpp b/extension.cpp index 87d0b6b..c77ccd3 100644 --- a/extension.cpp +++ b/extension.cpp @@ -100,12 +100,21 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag // Skip game id NewBuf += 2; + // Calculate playercount + int iPlayers = 0; + + for (int index = 0; index <= SM_MAXPLAYERS; index++) + { + IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(index); + + if (pPlayer != NULL && pPlayer->IsConnected() && !pPlayer->IsSourceTV()) + { + iPlayers += 1; + } + } + // Correct playercount - int NumPlayers = playerhelpers->GetNumPlayers(); - - NumPlayers -= 1; // Subtract SourceTV - - memset(NewBuf, NumPlayers, 1); + memset(NewBuf, iPlayers, 1); // Reset Pointer NewBuf = OldBuf;