[Tutorial] How to make a modular GM/FS
#1

Hello!
I want to show you, how to make a modular GM or FS today. First I ask and answer some hot questions.
1)Wait, what we are going do do actually?
We gonna make file name.pwn (ex: defined.pwn) and then we just add(or "include") it to GM'. Easy.

2)Why is it usefull?
There are many reasons. The mains ones are:
1.It keeps te mainscript little.
2.It's alot of easier to find something, if you have a huge script.
3.If you share the script with someone, then you don't have to send all teh code everytime, when you change something.
4.If one of your files(GM/FS) leaks, it's not a problem, because it's not gonan work without others.
3)And how we gonna do it then?
For beginning, let's assume you have a FS/GM with many CMD's and NEW's.
1.Open your GM/FS(now I call it G/F) and go to the desired place(ex: Go to your G/F beginning, where most likely you have all global NEW's) I have for example those:
PHP Code:
new RahaAntud[MAX_PLAYERS];
new 
Registreeritud[MAX_PLAYERS];
new 
Sisselogitud[MAX_PLAYERS];
new 
Justlogitud[MAX_PLAYERS];
//new Text:Textdraw0;
new Text:Textdraw1
2. Cut them
3. Open a empty PWN file(Erase it empty) ja paste those lines there.
Now the file looks like:
PHP Code:
new Rahaantud[MAX_PLAYERS];
new 
Registreeritud[MAX_PLAYERS];
new 
Sisselogitud[MAX_PLAYERS];
new 
Justlogitud[MAX_PLAYERS];
//new Text:Textdraw0;
new Text:Textdraw1
Nothing else.
4. Now save the file to gamemodes folder(You can make a folder inside there too, like parts or extras)
5. Now there, where you deleted those lines, weire:
PHP Code:
#include "../gamemodes/((IF you decided to make a foler, then add the path here))/filename.pwn" 
With that we added it to G/F.
6. Compile and check, is it working.
7. Be proud of yourself .
PS! Allways you have to "include" them in the same spot, where you copied the lines.

I think it's all.
Credits:
oliver12 - wrote the tutorial.

If you have any questions or you find a language mistake(This isn't my mother tongue), then feel free to write it here.
Reply


Messages In This Thread
How to make a modular GM/FS - by oliver12 - 19.08.2012, 18:39
Re: How to make a modular GM/FS - by im - 19.08.2012, 21:19
Re: How to make a modular GM/FS - by oliver12 - 20.08.2012, 05:27
Re: How to make a modular GM/FS - by oliver12 - 22.08.2012, 18:37
Re: How to make a modular GM/FS - by Team_PRO - 23.08.2012, 11:26
Re: How to make a modular GM/FS - by oliver12 - 28.08.2012, 15:29
Re: How to make a modular GM/FS - by Redirect Left - 28.08.2012, 15:33
Re: How to make a modular GM/FS - by Lordzy - 28.08.2012, 15:33
Re: How to make a modular GM/FS - by Nirzor - 28.08.2012, 15:44
Re: How to make a modular GM/FS - by oliver12 - 28.08.2012, 17:59

Forum Jump:


Users browsing this thread: 1 Guest(s)