another types question

BlitzPlus Forums/BlitzPlus Programming/another types question

Type weapon
  Field weapontype
  Field ownerID
End Type

Type player
  Field ID
  Field w.weapon
End Type

Dim p.player(8) ;8 players

Const pistol = 1
Const rifle = 2

For ID = 1 To 8
	p(ID) = New player
	p(ID)\ID = ID
	p(ID)\w = New weapon
	p(ID)\w\weapontype = pistol
	p(ID)\w\ownerID = ID
Next



;select only player 3's weapons
For thisweapon.weapon = Each weapon
  If thisweapon\ownerID = 3 Then Print "Player 3's weapon"
Next


WaitKey()
End