loops +Rep
#1

i am having a problem,i got alot of systems that require loops,and when i wanna loop i put like:
pawn Code:
for(new thing = 0; thing < MAX_SOMETHING; thing++)
and MAX_SOMETHING for each feature is kinda big and i cant really lower it,and when i keep it like that i get like 2 mb size to the amx,is there any way to do it better?
Reply
#2

Not really.. By adding more features to the script, It gets bigger... You can't add stuff and keep the size fixed.
I have 5+ plugins and 10 includes with 100K lines script and I get 10MB AMX file, Without any kind of LAG in game.

And actually, You can use y_iterate.. I think its faster.
Reply
#3

Use foreach, it's a much better way.(by Y_Less)
Reply
#4

What makes AMX larger is the amount of code. The line you said is just one line, the process that's big.

You can use Foreach or make a counter. Example:

PHP Code:
new objectsavaiable 0;

public 
loadObjects()
{
      (for new 
a  0MAX_OBJECTSa++) objectsavaiable++;

and use, now, this variable as max.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)