Update extension.cpp

This commit is contained in:
zaCade 2019-05-22 19:23:55 +02:00
parent 7c92f9e5ba
commit 227f3a6c05

View File

@ -142,14 +142,14 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag
{ {
char PlayerReply[1024 * 6]; char PlayerReply[1024 * 6];
bf_write PlayerReplyPacket(PlayerReply, sizeof(PlayerReply)); bf_write PlayerReplyPacket(PlayerReply, sizeof(PlayerReply));
PlayerReplyPacket.Reset(); // Build up the packet as a bitbuffer so we can use the nice helper functions to do the work for us PlayerReplyPacket.Reset(); // Build up the packet as a bitbuffer so we can use the nice helper functions to do the work for us
PlayerReplyPacket.WriteLong(-1); // FF FF FF FF PlayerReplyPacket.WriteLong(-1); // FF FF FF FF
PlayerReplyPacket.WriteByte(68); // 44 PlayerReplyPacket.WriteByte(68); // 44
int iPlayers = 0; int iPlayers = 0;
PlayerInfo PlayerList[SM_MAXPLAYERS]; PlayerInfo PlayerList[SM_MAXPLAYERS];
for (int index = 0; index <= SM_MAXPLAYERS; index++) for (int index = 0; index <= SM_MAXPLAYERS; index++)
@ -158,7 +158,7 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag
if (pPlayer != NULL && pPlayer->IsConnected() && pPlayer->IsInGame() && !pPlayer->IsSourceTV()) if (pPlayer != NULL && pPlayer->IsConnected() && pPlayer->IsInGame() && !pPlayer->IsSourceTV())
{ {
memcpy(PlayerList[iPlayers].Name, pPlayer->GetName(), len); memcpy(PlayerList[iPlayers].Name, pPlayer->GetName(), 32);
IPlayerInfo *pInfo = pPlayer->GetPlayerInfo(); IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
@ -177,9 +177,9 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag
iPlayers++; iPlayers++;
} }
} }
PlayerReplyPacket.WriteByte(iPlayers); // Number of players PlayerReplyPacket.WriteByte(iPlayers); // Number of players
for (int index = 0; index < iPlayers; index++) for (int index = 0; index < iPlayers; index++)
{ {
PlayerReplyPacket.WriteByte(index); PlayerReplyPacket.WriteByte(index);