The first loop you posted (for(new i = 0; i < GetMaxPlayers(); i++)) is slower than for(new i = 0; i < MAX_PLAYERS; i++)), because it has to call the GetMaxPlayers() function not once, but a lot more.
Generally, for loop speeds, I'd say the fastest is this:
pawn Код:
for(new i = 0; i != MAX_PLAYERS; i++)
// However, on top of you script, do this:
#undef MAX_PLAYERS
#define MAX_PLAYERS x
// where x is the amount of slots your server has
Then comes this:
pawn Код:
for(new i = 0, slots = GetMaxPlayers(); i != slots; i++)
And then the one that calls GetMaxPlayers every iteration:
pawn Код:
for(new i = 0; i != GetMaxPlayers(); i++)
However, for the fastest player loops (in most cases), I'd recommend that you look up the foreach include by ******. It uses a system alike linked lists.