Skip to content

Commit 0eab70a

Browse files
committed
fix IsAlive()
1 parent 7f64986 commit 0eab70a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/demoinfocs/common/player.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ func (p *Player) SteamID32() uint32 {
6565

6666
// IsAlive returns true if the player is alive.
6767
func (p *Player) IsAlive() bool {
68-
s1LifeState := p.Entity.Property("m_lifeState")
68+
s2IsAlive := p.Entity.Property("m_bPawnIsAlive")
6969

70-
return p.Health() > 0 || (s1LifeState != nil && s1LifeState.Value().Int() == 0)
70+
if s2IsAlive != nil {
71+
return s2IsAlive.Value().BoolVal()
72+
}
73+
74+
return p.Health() > 0 || getInt(p.Entity, "m_lifeState") == 0
7175
}
7276

7377
// IsBlinded returns true if the player is currently flashed.

0 commit comments

Comments
 (0)