[Include] MAX_PLAYERS Loops - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] MAX_PLAYERS Loops (
/showthread.php?tid=420650)
-
Kaliber - 06.03.2013
deleted
Re: MAX_PLAYERS Loops -
greentarch - 06.03.2013
Uhmmm .. there is already foreach ( or y_iterate ) for this
Link to foreach :
https://sampforum.blast.hk/showthread.php?tid=92679
And, you can use y_hook for hooking callbacks too!
Anyways, it's a nice work as it's your second release on the forums
AW: Re: MAX_PLAYERS Loops -
Kaliber - 06.03.2013
Quote:
Originally Posted by greentarch
Uhmmm .. there is already foreach ( or y_iterate ) for this
|
This Include from ****** works completely different!
mfg.
Re: MAX_PLAYERS Loops -
MP2 - 06.03.2013
Nice work, but as said foreach is much better. If only ID 499 is connected, this is still going to loop through the first 499 IDs which aren't connected
Re: MAX_PLAYERS Loops -
TheArcher - 06.03.2013
The classic example of having variables, loops etc.. faster just #undef MAX_PLAYERS and #define MAX_PLAYERS (SERVER_SLOT)...on this case you re-define MAX_PLAYERS and should work faster. Another example for loops can be
pawn Код:
for(new i=0; i< GetMaxPlayers(); i++)
a faster loop.
As above users said y_iterate is much faster.
Re: MAX_PLAYERS Loops -
Maxips2 - 06.03.2013
rather do it like this
pawn Код:
for(new i, j = GetMaxPlayers(); i < j; i++)
And yeah, cosider taking a look at y_iterate, it is very efficient, not just for player looping (there are examples for different usages)
AW: Re: MAX_PLAYERS Loops -
Kaliber - 06.03.2013
Quote:
Originally Posted by TheArcher
pawn Код:
for(new i=0; i< GetMaxPlayers(); i++)
a faster loop.
|
This isnt faster, because you call a Funktion, to use a Makro it's much faster!
I know foreach, but the system how it works is totally different and so its doesnt matter!
Re: MAX_PLAYERS Loops -
Pottus - 07.03.2013
Useless dude.
Re: AW: Re: MAX_PLAYERS Loops -
JaKe Elite - 07.03.2013
Calling a function doesn't mean it is slow.