SA-MP Forums Archive
Added a few arrays, .amx size got 400kb bigger - 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: Added a few arrays, .amx size got 400kb bigger (/showthread.php?tid=524404)



Added a few arrays, .amx size got 400kb bigger - IKnowWhatIAmDoing - 06.07.2014

stock ReturnNumber(amount)
{
new name[15]; //
switch(amount)
{
case 0..99: name= "Blah1";
case 100..249: name= "Blah2";
case 250..499: name= "Blah3";
case 500..999: name= "Blah4";
case 1000..2499: name= "Blah5";
case 2500..4999: name= "Blah6";
case 5000..9999: name= "Blah7";
default: name= "Blah8" ;
}
return name;
}

So I added a few checks like this (roughly 5 of them), and my .amx size got really big (400kb bigger than usual). I also don't call them very often. (2-3 times max)

And the max array size I gave for them is like 35 or something. So is there anyway to decrease my .amx size? But by using these functions?

Ps. It didn't affect RAM, at all.

Oh and, I'm using them on dialogs and some textdraws, and client messages, as a string to return


Re: Added a few arrays, .amx size got 400kb bigger - Ihateyou - 06.07.2014

doing "case 1..9999:" will produce 10000 'if' statements in the compile if I remember correctly..

and why you worry so much about amx size btw?


Re: Added a few arrays, .amx size got 400kb bigger - IKnowWhatIAmDoing - 06.07.2014

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
doing "case 1..9999:" will produce 10000 'if' statements in the compile if I remember correctly..

and why you worry so much about amx size btw?
Uploading that shit takes long then, I want to find a way around so that's why I'm asking. ye I got a shit upload speed


Re: Added a few arrays, .amx size got 400kb bigger - Jefff - 06.07.2014

pawn Код:
stock ReturnNumber(amount)
{
    new name[15]; //
   
    if(0 <= amount <= 99)           name = "Blah1";
    else if(100 <= amount <= 249)   name = "Blah2";
    else if(250 <= amount <= 499)   name = "Blah3";
    else if(500 <= amount <= 999)   name = "Blah4";
    else if(1000 <= amount <= 2499) name = "Blah5";
    else if(2500 <= amount <= 4999) name = "Blah6";
    else if(5000 <= amount <= 9999) name = "Blah7";
    else                            name = "Blah8";

    return name;
}



Re: Added a few arrays, .amx size got 400kb bigger - IKnowWhatIAmDoing - 06.07.2014

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
stock ReturnNumber(amount)
{
    new name[15]; //
   
    if(0 <= amount <= 99)           name = "Blah1";
    else if(100 <= amount <= 249)   name = "Blah2";
    else if(250 <= amount <= 499)   name = "Blah3";
    else if(500 <= amount <= 999)   name = "Blah4";
    else if(1000 <= amount <= 2499) name = "Blah5";
    else if(2500 <= amount <= 4999) name = "Blah6";
    else if(5000 <= amount <= 9999) name = "Blah7";
    else                            name = "Blah8";

    return name;
}
What the... It really decreased it. Infact I replaced it with the one I use now and my .amx size got 50kb less.

I've been feeding a snake in my bed all the time, thanks a lot mate!