My confusing issue. [ FILES ] -
Kyle - 20.02.2014
Over the past few days I have started to seperate my gamemode into seperate files.
I have included this under OnPlayerConnect
Код:
#include "../gamemodes/NEWCNR94/player/playertextdraws.pwn" // Textdraws
#include "../gamemodes/NEWCNR94/player/removedbuildings.pwn" // RemovePlayerBuilding
#include "../gamemodes/NEWCNR94/player/loops.pwn" // RemovePlayerBuilding
The links above are the right file names.
If I purposely change the link to the file include (to a bad link), there is no error in the CnR Gamemode, if on the other hand, I try this in a blank gamemode, it does error, saying that the link is invalid / cannot find file.
removedbuildings.pwn removes some buildings and stuff, so I have gone ingame and the buildings are still there, showing that the code isn't executed, or in this case, loaded.
Can anyone help. I would appreciate it.
Re: mi sei issue -
ColeMiner - 20.02.2014
Can you explain that again in full sentences please? Maybe at some point actually say what the error is?
Re: mi sei issue -
Kyle - 20.02.2014
Quote:
Originally Posted by ColeMiner
Can you explain that again in full sentences please? Maybe at some point actually say what the error is?
|
I've edited the first post. I hope that is better.
Re: My confusing issue. [ FILES ] -
PowerPC603 - 20.02.2014
Why do you want to put #include INSIDE a callback?
Normally, those go on top of your script, not inside functions or whatever.
And you would put the entire callback inside an include, not only the code which belongs inside the callback.
Also, does this even work what you're doing, going back only 1 directory?
To get from "pawno/includes" to "gamemodes", you need to go back 2 directories, not just 1.
Re: My confusing issue. [ FILES ] -
Kyle - 20.02.2014
It seems to be fixed:
I changed the includes to this:
#include "/NEWCNR94/player/loops.pwn" //
Re: My confusing issue. [ FILES ] -
ColeMiner - 20.02.2014
The problem is probably that you are using "/" instead of "\" - something I've mentioned hundreds of times in the past.
Re: My confusing issue. [ FILES ] -
Kyle - 20.02.2014
Quote:
Originally Posted by ColeMiner
The problem is probably that you are using "/" instead of "\" - something I've mentioned hundreds of times in the past.
|
How come it works now after I removed some folders and ..'s.
Re: My confusing issue. [ FILES ] -
ColeMiner - 20.02.2014
Because the names are shorter - but that's only a stop-gap measure and likely to cause issues in the future.
Quote:
Originally Posted by PowerPC603
Why do you want to put #include INSIDE a callback?
Normally, those go on top of your script, not inside functions or whatever.
|
Not true, you can do that no problem:
f1.pwn:
f2.pwn:
pawn Код:
main()
{
#include "f1.pwn"
}
That works fine. Example:
https://github.com/Y-Less/YSI-Includ.../x11switch.inc
That is a huge automatically generated switch tree that finds out what colour was requested from its name's hash. It is part of the function "GetColourHash", defined in this file:
https://github.com/Y-Less/YSI-Includ.../y_colours.inc
If I were to place the whole code of that function in one file, it would entirely dwarf the main chunk of the code, and thus the meaning of the file. It is just a load of generated repetative code, so I separated out just part of the function. It is made worse by the fact that there are two more files for different functions in that same library:
https://github.com/Y-Less/YSI-Includ...s/x11parse.inc
https://github.com/Y-Less/YSI-Includ...urs/x11def.inc
So it is a valid technique at times.
Re: My confusing issue. [ FILES ] -
Kyle - 20.02.2014
So it should be?
#include "\NEWCNR94\player\loops.pwn"
Thanks ******.
Re: My confusing issue. [ FILES ] -
ColeMiner - 20.02.2014
Yes, or when using "\" your original "..\gamemodes\" will work as well.