Skip to content

Commit 1f8bda3

Browse files
committed
Fixed getting wrong player
1 parent 38ccf35 commit 1f8bda3

1 file changed

Lines changed: 28 additions & 18 deletions

File tree

AuroraGSI-RL/AuroraGSI.cpp

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,35 @@ void AuroraGSI::UpdateState(ServerWrapper wrapper)
8383

8484

8585
auto players = wrapper.GetPRIs();
86-
if (players.Count() > 0 ) {
87-
PriWrapper local = players.Get(0);
88-
86+
for (int i = 0; i < players.Count(); i++) {
87+
auto local = players.Get(i);
8988
if (!local.IsNull()) {
90-
GameState.Player.Score = local.GetMatchScore();
91-
GameState.Player.Goals = local.GetMatchGoals();
92-
GameState.Player.Assists = local.GetMatchAssists();
93-
GameState.Player.Saves = local.GetMatchSaves();
94-
GameState.Player.Shots = local.GetMatchShots();
95-
96-
if (!local.GetTeam().IsNull())
97-
GameState.Player.Team = local.GetTeam().GetTeamIndex();
98-
else
99-
GameState.Player.Team = -1;
100-
101-
if (!local.GetCar().IsNull() && !local.GetCar().GetBoostComponent().IsNull())
102-
GameState.Player.CurrentBoostAmount = local.GetCar().GetBoostComponent().GetCurrentBoostAmount();
103-
else
104-
GameState.Player.CurrentBoostAmount = -1;
89+
if (local.GetUniqueId().ID == this->gameWrapper->GetSteamID()) {
90+
GameState.Player.Score = local.GetMatchScore();
91+
GameState.Player.Goals = local.GetMatchGoals();
92+
GameState.Player.Assists = local.GetMatchAssists();
93+
GameState.Player.Saves = local.GetMatchSaves();
94+
GameState.Player.Shots = local.GetMatchShots();
95+
96+
if (!local.GetTeam().IsNull())
97+
GameState.Player.Team = local.GetTeam().GetTeamIndex();
98+
else
99+
GameState.Player.Team = -1;
100+
101+
if (!local.GetCar().IsNull() && !local.GetCar().GetBoostComponent().IsNull())
102+
GameState.Player.CurrentBoostAmount = local.GetCar().GetBoostComponent().GetCurrentBoostAmount();
103+
else
104+
GameState.Player.CurrentBoostAmount = -1;
105+
}
106+
}
107+
else {
108+
GameState.Player.Score = -1;
109+
GameState.Player.Goals = -1;
110+
GameState.Player.Assists = -1;
111+
GameState.Player.Saves = -1;
112+
GameState.Player.Shots = -1;
113+
GameState.Player.Team = -1;
114+
GameState.Player.CurrentBoostAmount = -1;
105115
}
106116
}
107117

0 commit comments

Comments
 (0)