Quote:
Originally Posted by Maniek
Bad!
Use:
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
|
Bad!
Use:
pawn Код:
for(new i, x = GetMaxPlayers(); i < x; i++)
// Code.
The result returned by GetMaxPlayers() will not change inbetween such a tiny loop like that (unless you change it manually), so there is no point in calling it on every iteration of the loop. Assign it to a variable, and compare it to that, instead of calling the function repeatedly for every iteration of the loop.
Quote:
Originally Posted by TheMaTrIx4057
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
is much better
than
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
|
Not neccessarily. GetMaxPlayers() (if used
correctly) will save process time because it will generally be a smaller value than MAX_PLAYERS. Most people do not update their a_samp.inc to their correct max players value that their server runs on, so therefore they are running more loops or creating more array cells than they will ever use. So -
update your a_samp.inc to your correct player count, and this will solve your problems.
~Cueball~