Why can't you?
Type S4_Vector3
X as float
Y as float
Z as float
EndType
Type S4_Player
dbMeshID as Integer
dbTexID as Integer
pos as S4_Vector3
EndType
Global Dim S4_PlayerList() as S4_Player
Clear Array S4_PlayerList()
LoadPlayer(1.0, 2.0, 3.0)
for i = 0 to array count( S4_PlayerList() )
print i; " - "; S4_PlayerList(i).pos.X; " / ";S4_PlayerList(i).pos.Y; " / ";S4_PlayerList(i).pos.Z
next
print "Done"
wait key
end
Function LoadPlayer(pX#, pY#, pZ#)
local tCount as integer
tCount = -1
local tPlayer as S4_Player
tPlayer.pos.X = pX#
tPlayer.pos.Y = pY#
tPlayer.pos.Z = pZ#
array insert at bottom S4_PlayerList()
tCount = get array size(S4_PlayerList()) - 1
S4_PlayerList(tCount) = tPlayer
endfunction
... and due to the fact that arrays have a 'current' item, and that item is set to point to newly inserted items, you could simplify the function a little:
Function LoadPlayer(pX#, pY#, pZ#)
local tPlayer as S4_Player
tPlayer.pos.X = pX#
tPlayer.pos.Y = pY#
tPlayer.pos.Z = pZ#
array insert at bottom S4_PlayerList()
S4_PlayerList() = tPlayer
endfunction
[edit]
This makes it clear to me that there's some other code causing the original problem.