Skip to content

Commit

Permalink
Add Winner to player stats
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileYzn committed Aug 10, 2023
1 parent 24e8353 commit 31cac16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions MatchStats/MatchStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions MatchStats/MatchStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, P_PLAYER_STATS> Stats;
Expand Down

0 comments on commit 31cac16

Please sign in to comment.