Update extension.cpp

This commit is contained in:
zaCade 2019-05-20 17:54:40 +02:00
parent 571c1e0409
commit 310f5373d3

View File

@ -62,6 +62,55 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag
if (memcmp(buf, A2S_INFO_REPLY, 5) == 0)
{
g_pSM->LogMessage(myself, "A2S_INFO_REPLY: %s", buf);
char *NewBuf;
char *OldBuf;
NewBuf = new char[len];
memcpy(NewBuf, buf, len);
OldBuf = NewBuf;
// Skip header and protocol
NewBuf += 5;
// Skip server name
while(*NewBuf)
NewBuf++;
NewBuf++;
// Skip map name
while(*NewBuf)
NewBuf++;
NewBuf++;
// Skip folder
while(*NewBuf)
NewBuf++;
NewBuf++;
// Skip game name
while(*NewBuf)
NewBuf++;
NewBuf++;
// Skip game id
NewBuf += 2;
// Correct playercount
int NumPlayers = playerhelpers->GetNumPlayers();
NumPlayers -= 1; // Subtract SourceTV
memset(NewBuf, NumPlayers, 1);
// Reset Pointer
NewBuf = OldBuf;
return DETOUR_STATIC_CALL(Detour_SendTo)(s, NewBuf, len, flags, to, tolen);
}
if (memcmp(buf, A2S_PLAYER_REPLY, 5) == 0)