-
| Hi Markus! I'm setting team members to my struct from event  BUT using  Score update log with  1
0
1
0
2
0
3
0
3
1
3
2
4
2
4
3
4
4
4
5
4
6
4
7
4
8
4
9
4
10
4
11
TEAM SWITCH
4
11
4
11
5
11
6
11
6
12
6
13
6
14
6
15
6
16Score update log with  ...
1
0
1
0
2
0
3
0
3
1
3
2
4
2
4
3
4
4
4
5
4
6
4
7
4
8
4
9
4
10
4
11
TEAM SWITCH
4
11
4
11
5
11
6
11
6
12
6
13
6
14
6
15
16
0
 | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
| Hi @ysomad - can you please include your code? Thanks! 🙂 | 
Beta Was this translation helpful? Give feedback.
-
| Not sure is it a bug or I don't understand the behavior of the MatchStartedChanged event. type parser struct {
	demoinfocs.Parser
	match         *match
}
type match struct {
	team1        matchTeam
	team2        matchTeam
}
type matchTeam struct {
	score          int
        side common.Team
	playerSteamIDs []uint64
}
func (p *parser) parse() {
  // or doing the same thing on events.MatchStartedChanged
  p.RegisterEventHandler(func(_ events.MatchStart) {
        gs := p.GameState()
        t := gs.TeamTerrorists()
	p.match.setTeam1(newMatchTeam(t.ClanName(), t.Flag(), t.Team(), t.Members()))
	ct := gs.TeamCounterTerrorists()
	p.match.setTeam2(newMatchTeam(ct.ClanName(), ct.Flag(), ct.Team(), ct.Members()))
  })
  // acts weird if using with MatchStartedChanged event handler
  p.RegisterEventHandler(func(e events.ScoreUpdated) {
	switch e.TeamState.Team() {
	case p.match.team1.side:
		p.match.team1.score = e.NewScore
	case p.match.team2.side:
		p.match.team2.score = e.NewScore
	}
  })
} | 
Beta Was this translation helpful? Give feedback.
-
| Do not update teams if MatchStarted was already true / if MatchStarted is set to false p.RegisterEventHandler(func(e events.MatchStartedChanged) {
              if e.OldIsStarted || !e.NewIsStarted {
                       return
             }
                p.setTeams(p.GameState())
        }) | 
Beta Was this translation helpful? Give feedback.
Do not update teams if MatchStarted was already true / if MatchStarted is set to false