File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,25 @@ func (p *Player) Weapons() []*Equipment {
196
196
return res
197
197
}
198
198
199
+ // FlashbangCount returns the amount of flashbangs the player currently has in his inventory.
200
+ func (p * Player ) FlashbangCount () int {
201
+ if p .demoInfoProvider .IsSource2 () {
202
+ pawn := p .PlayerPawnEntity ()
203
+ if pawn == nil {
204
+ return 0
205
+ }
206
+
207
+ flashCountProp , ok := pawn .PropertyValue ("m_pWeaponServices.m_iAmmo.0014" )
208
+ if ! ok {
209
+ return 0
210
+ }
211
+
212
+ return int (flashCountProp .S2UInt64 ())
213
+ }
214
+
215
+ return p .Entity .PropertyValueMust ("m_iAmmo.015" ).Int ()
216
+ }
217
+
199
218
// IsSpottedBy returns true if the player has been spotted by the other player.
200
219
// This is NOT "Line of Sight" / FOV - look up "CSGO TraceRay" for that.
201
220
// May not behave as expected with multiple spotters.
You can’t perform that action at this time.
0 commit comments