SA-MP Forums Archive
[Tutorial] How to make a modular GM/FS - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make a modular GM/FS (/showthread.php?tid=370336)



How to make a modular GM/FS - oliver12 - 19.08.2012

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.


Re: How to make a modular GM/FS - im - 19.08.2012

Yet another unuseful and undocumented tutorial..
1/99999999999999999999999999999999999999.


Re: How to make a modular GM/FS - oliver12 - 20.08.2012

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?


Re: How to make a modular GM/FS - oliver12 - 22.08.2012

Maybe someone is intrested....


Re: How to make a modular GM/FS - Team_PRO - 23.08.2012

5/5 Good


Re: How to make a modular GM/FS - oliver12 - 28.08.2012

Maybe someone is intrested....


Re: How to make a modular GM/FS - Redirect Left - 28.08.2012

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.


Re: How to make a modular GM/FS - Lordzy - 28.08.2012

WTH is this really?


Re: How to make a modular GM/FS - Nirzor - 28.08.2012

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


Re: How to make a modular GM/FS - oliver12 - 28.08.2012

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.