Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
Tittle says it all could i call an include inside other include?
I want to make an include which will have all my server global variables. Could i include it to another include i use? or it will cause errors ?
Posts: 511
Threads: 13
Joined: Jun 2012
Reputation:
0
12.02.2016, 09:00
(
Последний раз редактировалось Sawalha; 12.02.2016 в 10:27.
)
that's normal, you can, and no errors will be occurred as long as directories declaring in the script is correct. (if there were includes in various directories)
Posts: 6,242
Threads: 8
Joined: Jun 2008
Read up a lot on it.
You can, you just have to be careful, and plan a bit more.
It can however make things more confusing, so it is a double edged sword.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
A file only gets included once unless you specifically tell the compiler to include it a second time. It is however not smart to split up your mode by declaration type (e.g. all variables in one include and all forward declarations in another). It is far more useful to split up by functionality, e.g. all house stuff in one include and all vehicle stuff in another.
Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
Thanks and one more question. Can i call for example onplayerdeath in 2 different includes but for different functionality?
Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
Ok and how can i use global static inside an include? i want to move my admin command and calling it through an include and i am using some global statics inside the command and it is causing errors. I tried to create an include seperately only for these global statics and call it but i noticed it is causing errors calling an include which has global statics.
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
I really doubt you understand how static works, global statics are for that file and that file only, so if you have static blabla; in one of your includes you can't use it whereever you include it, if you want to use a static var it should be declared in same file.