SA-MP Forums Archive
Stock - 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: Stock (/showthread.php?tid=612111)



Stock - Micko123 - 14.07.2016

So this gamemode i am editing has 208 stocks. All textdraws, objects everything is in stock. Is that bad and is it going to slow things down??


Re: Stock - Micko123 - 14.07.2016

Guys I need answer because this is urgent


Re: Stock - Dayrion - 14.07.2016

Stock is useless if you don't make an include. Remove the keyword stock.


Re: Stock - GangstaaSunny - 14.07.2016

Hello Micko123,
stocks are just there to tell the compiler to ignore warnings/erros inside of it if the stock is not used.


Re: Stock - Micko123 - 14.07.2016

Well is it going to infect gamemode's speed in game and could there be any invisible errors or warnings?


Re: Stock - Freaksken - 14.07.2016

stock means that if that function is not used in your script, it will not be added to the .amx while compiling.
So if you have this:
Код:
//In OnPlayerCommandText
if(!strcmp(cmdtext, "/mycommand", true) {
    Func1();
    Func2();
    return 1;
}

//Somewhere in your script
Func1() {
    //Do something
}

stock Func2() {
    //Do something
}

stock Func3() {
    //Do something
}

Func4() {
    //Do something
}
So if you don't use a function, but don't want to delete it, declare it stock.


Re: Stock - Flake. - 14.07.2016

They're not necessary, if you return warnings/errors upon removing them it's a sign of useless/unneeded code.

edit: Freaksken beat me too it and elaborated better :^)


Re: Stock - Micko123 - 14.07.2016

Thank you guys for answers but one more question. This gm has 55280 lines. When i try to compile, compiler stuck. It is showing liike it is compiling but nothing happens. I left it there for 20 min and still same. What could be the problem? I re-downliaded pawn few times and still the same


Re: Stock - Freaksken - 14.07.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
Thank you guys for answers but one more question. This gm has 55280 lines. When i try to compile, compiler stuck. It is showing liike it is compiling but nothing happens. I left it there for 20 min and still same. What could be the problem? I re-downliaded pawn few times and still the same
Pawno (the standard Pawn IDE) was not built for large scripts. Try using another compiler.
The other possibility could be that you have an error somewhere.


Re: Stock - Freaksken - 14.07.2016

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Pawno isn't the compiler, pawncc is and it's likely another IDE would just use pawncc. What you're probably getting mixed up with is Zeex's compiler which was patched to support longer lines (not longer scripts, pawncc can handle a lot more than 50k lines).
You're right, even though I wasn't thinking "compiler", that's what my hands decided to type . If you change the word compiler in my sentence to IDE, it should make sense .

EDIT:
This is what I meant.