SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 06/03/2013, 05:52 AM   #1
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,092
Reputation: 156
Default

deleted
__________________

Last edited by Kaliber; 03/03/2015 at 12:26 PM. Reason: Too old
Kaliber is offline   Reply With Quote
Old 06/03/2013, 06:14 AM   #2
greentarch
Big Clucker
 
Join Date: Feb 2013
Posts: 166
Reputation: 39
Default Re: MAX_PLAYERS Loops

Uhmmm .. there is already foreach ( or y_iterate ) for this
pawn Code:
foreach (new i : Player)
Link to foreach : http://forum.sa-mp.com/showthread.php?t=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
greentarch is offline   Reply With Quote
Old 06/03/2013, 06:17 AM   #3
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,092
Reputation: 156
Default AW: Re: MAX_PLAYERS Loops

Quote:
Originally Posted by greentarch View Post
Uhmmm .. there is already foreach ( or y_iterate ) for this
This Include from ****** works completely different!

mfg.
__________________
Kaliber is offline   Reply With Quote
Old 06/03/2013, 07:11 AM   #4
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,235
Reputation: 1004
Default Re: MAX_PLAYERS Loops

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
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 06/03/2013, 05:14 PM   #5
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,334
Reputation: 251
Default Re: MAX_PLAYERS Loops

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 Code:
for(new i=0; i< GetMaxPlayers(); i++)
a faster loop.

As above users said y_iterate is much faster.
__________________
TheArcher is offline   Reply With Quote
Old 06/03/2013, 05:44 PM   #6
Maxips2
Huge Clucker
 
Join Date: Oct 2008
Posts: 410
Reputation: 20
Default Re: MAX_PLAYERS Loops

rather do it like this
pawn Code:
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)
Maxips2 is offline   Reply With Quote
Old 06/03/2013, 07:54 PM   #7
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,092
Reputation: 156
Default AW: Re: MAX_PLAYERS Loops

Quote:
Originally Posted by TheArcher View Post
pawn Code:
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!
__________________
Kaliber is offline   Reply With Quote
Old 07/03/2013, 03:02 AM   #8
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,884
Reputation: 1321
Default Re: MAX_PLAYERS Loops

Useless dude.
Pottus is offline   Reply With Quote
Old 07/03/2013, 10:22 AM   #9
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,707
Reputation: 489
Default Re: AW: Re: MAX_PLAYERS Loops

Calling a function doesn't mean it is slow.
__________________
Discord: Cipher#7353
__________________


Server IP: Click me | Discord: Click me

You challenged us, What you want is what you get.
JaKe Elite is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MAX_PLAYERS micol Scripting Help 3 09/01/2013 02:53 AM
MAX_PLAYERS Kirollos Scripting Help 4 19/08/2012 11:52 AM
Bug after for(new i=0,i<MAX_PLAYERS,i++) dalkgamler Scripting Help 4 20/07/2012 08:16 PM
Max_Players Sleek420 Scripting Help 5 21/11/2011 12:35 AM
Max_Players Gigi-The-Beast Help Archive 5 13/06/2010 04:43 PM


All times are GMT. The time now is 12:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.