Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why are we using/wasting so many loops?
#21
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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)