08.07.2012, 15:49
Hello.
I'm trying to create a gamemode, and instead of writing all the script in the gamemode's .pwn file itself, what I'm doing is leaving that .pwn file almost blank, creating my own includes with ALS callback hooks, and then adding those includes in the .pwn file. For example I have an include for the player classes, another for the vehicle spawns, another for the gang zones, another for weapons, another for detecting certain cheats...
I'm doing this because I find several advantages in it:
I'm trying to create a gamemode, and instead of writing all the script in the gamemode's .pwn file itself, what I'm doing is leaving that .pwn file almost blank, creating my own includes with ALS callback hooks, and then adding those includes in the .pwn file. For example I have an include for the player classes, another for the vehicle spawns, another for the gang zones, another for weapons, another for detecting certain cheats...
I'm doing this because I find several advantages in it:
- I can have my code more organized because different things are each one in its own file, instead of all of them mixed up.
- It allows me to more a modular design, like a Lego, in which I can add or remove certain features by just adding or removing an include, instead of having to dive in an ocean of hundreds of lines. It's more plug and play like.
- If I want to change something of a certain feature I only have to edit an include, and I can locate the necessary code lines more easily in a small file than in a whole gamemode.
- If someday I want to create another gamemode, but import some features of my current one, I just have to add the necessary includes.