16-02-2007, 09:18 AM
i actually havent tested this but "array.length" is used to find the length of an array, i assume that is the highest index.
//declare
public player()
for i = 1 to player().length
//Procedure goes here
next i
if that doesnt work then
When the server send the "loginok" packet, increase player().length +1 and send a packet. (decrease by 1 when a player logs out and send packet)
Another way could be
for i = 1 to max_players
if player(index).name = "" then
exit for
else
//procedure goes here
next i
//declare
public player()
for i = 1 to player().length
//Procedure goes here
next i
if that doesnt work then
When the server send the "loginok" packet, increase player().length +1 and send a packet. (decrease by 1 when a player logs out and send packet)
Another way could be
for i = 1 to max_players
if player(index).name = "" then
exit for
else
//procedure goes here
next i