19.08.2012, 18:39
(
Last edited by oliver12; 20/08/2012 at 05:33 AM.
)
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:
2. Cut them
3. Open a empty PWN file(Erase it empty) ja paste those lines there.
Now the file looks like:
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:
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.
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;
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;
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"
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.