SA-MP Forums Archive
Loops Question - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Loops Question (/showthread.php?tid=373164)



Loops Question - Admigo - 29.08.2012

Hello All,

Whats better?
One big loop or multiple small loops?
I need this because i am using much variables as timers.
I need to fix the lag in my server.

Thanks Admigo


Re: Loops Question - Roko_foko - 29.08.2012

One big loop.
About Timers the case is different ( more smaller timers, and make sure they are not executing at same time ).


Re: Loops Question - Admigo - 29.08.2012

What stuff can make your server slower like: Players moving bad or chat is sending the message slower?
Because this is my problem with my server. After playing like 10 minutes that lag will be in server.


Re: Loops Question - [ABK]Antonio - 29.08.2012

Quote:
Originally Posted by admigo
Посмотреть сообщение
What stuff can make your server slower like: Players moving bad or chat is sending the message slower?
Because this is my problem with my server. After playing like 10 minutes that lag will be in server.
If it's not due to your / host connection - I would go with smaller loops that are in separate functions that are spaced from each other a little


Re: Loops Question - playbox12 - 29.08.2012

It really depends on the amount of iterations in your loop and the stuff you do inside it. Do not place stuff under OnPlayerUpdate without any form of scheduling code. (only if you know what your doing). If you execute certain loops on a regular interval I'd say having multiple smaller loops is better because there'd be gaps in between where the server can do something else.


Re: Loops Question - Admigo - 29.08.2012

Does a loop needs to have a return 1 or 0?
I have much incoming connections.