Split everything up and #include <everything>?
#1

Ey ey boys and girls.

I just have a quick question. I want my codes to look as clean and good as possible, therefore I'm wondering if there's any cons by splitting up the code and include it all?

So I make one .inc for color defines, another one for other defines, one for stock functions, another one for variables, one for forwards and publics and so forth?

Will that work out just fine or isn't it worth it? Also wondering; if I include a command for instance, and that command is a zcmd command. That command is in another include, let's say commads.inc. Do I have to #include <zcmd> in that commands.inc file, or will it work since it is all included in the gamemode itself?

By the way, have a good day
Reply
#2

You shouldn't order your code by type but by functionality. It's still up to you, though.
As for your other question: no, you don't have to include zcmd in everything as long as zcmd is included in the main file above all the rest.
Reply
#3

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
You shouldn't order your code by type but by functionality. It's still up to you, though.
As for your other question: no, you don't have to include zcmd in everything as long as zcmd is included in the main file above all the rest.
By functionality as for instance?
Okay so absolutely no cons as long as I know where I store it?
Reply
#4

Quote:
Originally Posted by TheBigFive
Посмотреть сообщение
By functionality as for instance?
Okay so absolutely no cons as long as I know where I store it?
For example: if you have a script that handles vehicles, bundle everything that has to do with vehicles in there.
Reply
#5

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
For example: if you have a script that handles vehicles, bundle everything that has to do with vehicles in there.
Oh that's a good idea. Guess I'll be doing that instead
Reply
#6

You can use
pawn Код:
#include "afile"
so you don't need to put files into includes folder as you can use relative paths and keep everything in gamemodes folder (and subfolders)
Reply
#7

Don't separate it into multiple files if you want it to "look clean and good as possible".

Hooks, missing a file, etc.
Reply
#8

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Don't separate it into multiple files if you want it to "look clean and good as possible".

Hooks, missing a file, etc.
I don't get it?
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Don't separate it into multiple files if you want it to "look clean and good as possible".

Hooks, missing a file, etc.
Keep your bad advice to yourself please, a hook looks more professional if you are going for the "look", provides amazing stuff, and splitting code into files provides for way easier debugging process as you can turn off or remove an entire system with two slashes ( // )

I hope you are not one of those guys who blab about their GM being 100k lines, when I can create a system way more advanced than theirs in 1000 lines.


also OT:
The only downside to having modular code is you sometimes need to change their order as to meet all the variable requirements (if you use for example VehI in admin file, you need to include admin file after veh file so it won't throw an error) and also you can't hook cmds, other than that there are lots and lots of pros to having a modular code.
Reply
#10

Nvrm..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)