[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
#2

Yet another unuseful and undocumented tutorial..
1/99999999999999999999999999999999999999.
Reply
#3

Unuseful? For big script it's a flawless way to organize it.
Undocumented? I wrote, what is going on and there is no need to comment the code, as it is very simple(and the code is just a example). What else do ya need?
Reply
#4

Maybe someone is intrested....
Reply
#5

5/5 Good
Reply
#6

Maybe someone is intrested....
Reply
#7

Quote:
Originally Posted by oliver12
View Post
Hello!
If you have any questions or you find a language mistake(This isn't my mother tongue), then feel free to write it here.
The entire thing is a language mistake.
Reply
#8

WTH is this really?
Reply
#9

wth is this??
new RahaAntud[MAX_PLAYERS];
new Registreeritud[MAX_PLAYERS];
new Sisselogitud[MAX_PLAYERS];
new Justlogitud[MAX_PLAYERS];

maybe this is your mother's language lol! sorry but you call this a tutorial?? i have a large script but i would not call

this tutorial you just said do this and that but you did not explain anything just wanting +Rep from tutorial thats

not gonna help buddy learn more then make tutorial
Reply
#10

This is not for rep -.- . It's just that i've worked with PPC lately and I found out, that ц,д,ь,х can't be used in includes. So if ju just don't want to mix it all up, this is the solution.
@ Nirzor
new RahaAntud[MAX_PLAYERS];
new Registreeritud[MAX_PLAYERS];
new Sisselogitud[MAX_PLAYERS];
new Justlogitud[MAX_PLAYERS];
As I wrote, this was just an example.
And What do ya else need? What else is there to explain? I gave a way to make well organized script, without using real .inc includes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)