My confusing issue. [ FILES ]
#1

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.





Reply
#2

Can you explain that again in full sentences please? Maybe at some point actually say what the error is?
Reply
#3

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.
Reply
#4

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.
Reply
#5

It seems to be fixed:

I changed the includes to this:

#include "/NEWCNR94/player/loops.pwn" //
Reply
#6

The problem is probably that you are using "/" instead of "\" - something I've mentioned hundreds of times in the past.
Reply
#7

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.
Reply
#8

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:

pawn Код:
printf("hi");
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.
Reply
#9

So it should be?

#include "\NEWCNR94\player\loops.pwn"

Thanks ******.
Reply
#10

Yes, or when using "\" your original "..\gamemodes\" will work as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)