From 31cac161d1fab1085f7c5cbba5d5bc9e0ce9006b Mon Sep 17 00:00:00 2001 From: Cleverson Date: Thu, 10 Aug 2023 16:28:05 -0300 Subject: [PATCH] Add Winner to player stats --- MatchStats/MatchStats.cpp | 13 +++++++++++++ MatchStats/MatchStats.h | 1 + 2 files changed, 14 insertions(+) diff --git a/MatchStats/MatchStats.cpp b/MatchStats/MatchStats.cpp index 1fea42a..de46328 100644 --- a/MatchStats/MatchStats.cpp +++ b/MatchStats/MatchStats.cpp @@ -180,6 +180,18 @@ void CMatchStats::Cvar_DirectSet(struct cvar_s* var, const char* value) // Set rounds played this->m_Match.TotalRounds = (this->m_Match.Score[TERRORIST] + this->m_Match.Score[CT]); + // Loop player list + for (auto& Player : this->m_Player) + { + // Clear winner of match + Player.second.Winner = 0; + // If is in winner team + if (Player.second.Team == this->m_Match.Winner) + { + Player.second.Winner = 1; + } + } + // Export data this->ExportData(); break; @@ -1207,6 +1219,7 @@ void CMatchStats::ExportData() {"DisconnectTime",Player.second.DisconnectTime}, {"Name",Player.second.Name}, {"Team",Player.second.Team}, + {"Winner",Player.second.Winner}, // // Player stats {"Frags",PlayerStats.Frags}, diff --git a/MatchStats/MatchStats.h b/MatchStats/MatchStats.h index 6720241..06b44ac 100644 --- a/MatchStats/MatchStats.h +++ b/MatchStats/MatchStats.h @@ -266,6 +266,7 @@ typedef struct S_PLAYER_DATA // Player Data std::string Name; // BETA: Player Name int Team; // BETA: Plyer Team + int Winner; // BETA: Is Winner of match // Player Stats std::map Stats;