diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index a5b1ce7d..52f23dc8 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -432,23 +432,27 @@ namespace Components for (auto i = 0; i < Game::MAX_CLIENTS; ++i) { std::unordered_map playerInfo; + // Insert default values playerInfo["score"] = 0; playerInfo["ping"] = 0; playerInfo["name"] = ""; + playerInfo["test_client"] = 0; if (Dedicated::IsRunning()) { - if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue; + if (Game::svs_clients[i].header.state < Game::CS_ACTIVE) continue; + if (!Game::svs_clients[i].gentity || !Game::svs_clients[i].gentity->client) continue; playerInfo["score"] = Game::SV_GameClientNum_Score(i); playerInfo["ping"] = Game::svs_clients[i].ping; playerInfo["name"] = Game::svs_clients[i].name; + playerInfo["test_client"] = Game::svs_clients[i].bIsTestClient; } else { // Score and ping are irrelevant const auto* name = Game::PartyHost_GetMemberName(Game::g_lobbyData, i); - if (name == nullptr || *name == '\0') continue; + if (!name || !*name) continue; playerInfo["name"] = name; } diff --git a/src/Components/Modules/ServerInfo.cpp b/src/Components/Modules/ServerInfo.cpp index 0172f4a5..55ef91e3 100644 --- a/src/Components/Modules/ServerInfo.cpp +++ b/src/Components/Modules/ServerInfo.cpp @@ -220,7 +220,7 @@ namespace Components const auto* client = Game::svs_clients[i].gentity->client; const auto team = client->sess.cs.team; - if (team == Game::TEAM_SPECTATOR) + if (Game::svs_clients[i].bIsTestClient || team == Game::TEAM_SPECTATOR) { continue; } @@ -233,7 +233,7 @@ namespace Components { // Score and ping are irrelevant const auto* namePtr = Game::PartyHost_GetMemberName(reinterpret_cast(0x1081C00), i); - if (!namePtr || !namePtr[0]) continue; + if (!namePtr || !*namePtr) continue; name = namePtr; }