View Full Version : Include Help

12/08/2013, 07:22 AM
Is it bad to make 7 or so includes just for Stocks,New functions,Commands,colors etc?

12/08/2013, 07:34 AM
No it isn't. In fact, doing this would be a great way to organize your code. Just remember one thing, don't name the includes for your CMDs, or stocks with a .inc, do a .pwn, and include them like this:


#include <a_samp>
#include <sscanf2>
#include <streamer>
#include <zcmd> // or whichever processor.
// other normal includes,

// now, your includes for better script optimization

// first, make a folder where you will be placing your includes.
// in this instance, i will name the folder 'script'
// place colors first, as you might use them in your other ones, then right after, stocks, as you would use them
// then publics, as you will also use them.
#include "script\stocks.pwn"
#include "script\publics.pwn"
#include "script\commands.pwn"
#include "script\other.pwn"

Now, inside of the stocks.pwn would look like:

stock GetPlayernameEx(playerid)
// Code.
// any other stocks in here.

And publics.pwn would look the same, only you would be placing the publics that you would have in there.
And commands.pwn would look the same, only you would be placing your self-made commands in there. etc (zcmd) CMD:blabla, etc.

You can have a lot more if you want, it would be easier to find a stock if you did it like this, or a public, and so there forth.

12/08/2013, 07:39 AM
Oh cool,thanks

12/08/2013, 08:33 AM
Ya this will help you out but remember order in which you include includes makes a difference for instance if you have includes that use gamemode variables that include needs to be placed after all your variables try and use the following structure.

1) Main includes <a_samp> and plugins

2) Pre-processor directives

3) System includes - For instance a streamer these are non gamemode variable dependent

4) Gamemode variables

5) System includes - Variable dependent these are usually commands and possibly might use some non variable dependent includes

6) Code

Oh and 7) y_hooks! y_hooks! y_hooks! http://forum.sa-mp.com/showthread.php?t=166016 absolutely your best friend