Update extension.cpp

This commit is contained in:
zaCade 2019-05-20 21:25:06 +02:00
parent 310f5373d3
commit 4980a3c067

View File

@ -100,12 +100,21 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag
// Skip game id // Skip game id
NewBuf += 2; 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 // Correct playercount
int NumPlayers = playerhelpers->GetNumPlayers(); memset(NewBuf, iPlayers, 1);
NumPlayers -= 1; // Subtract SourceTV
memset(NewBuf, NumPlayers, 1);
// Reset Pointer // Reset Pointer
NewBuf = OldBuf; NewBuf = OldBuf;