15.10.2014, 05:47
(
Последний раз редактировалось Pottus; 15.10.2014 в 06:22.
)
Modular approach is key and as Mionee mentioned look at S&S it's the way a script should be written YSI is another good example.
I will give you an example with your clothing script.
So what you want to do is break it down your going to have the following.
data (Information about usable objects, playerdata, enums)
core functions
commands
textdraws
database
That should will be enough to make the module easy to manage a quick tip when it comes to using y_hooks is include all these sequentially in your gamemode for example.
Order matters when doing this by putting the data first your variables will be recognized by all other includes. Now the only real issue with breaking it down so much is you lose some ability to encapsulate your code with the static modifier. If you want to increase your encapsulation you would need combine includes so this is something to keep in mind when deciding how you want your system to be modularized. With a clothing system there is going to be a lot code so it is a good idea to use several includes.
I will give you an example with your clothing script.
So what you want to do is break it down your going to have the following.
data (Information about usable objects, playerdata, enums)
core functions
commands
textdraws
database
That should will be enough to make the module easy to manage a quick tip when it comes to using y_hooks is include all these sequentially in your gamemode for example.
pawn Код:
#include "gamemode\clothing\clothingdata.pwn"
#include "gamemode\clothing\clothingcore.pwn"
#include "gamemode\clothing\clothingcommands.pwn"
#include "gamemode\clothing\clothingtextdraws.pwn"
#include "gamemode\clothing\clothingdatabase.pwn"