AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   [SM] includes (https://forums.alliedmods.net/showthread.php?t=265701)

KissLick 07-03-2015 12:18

[SM] includes
 
Ciao guys,

I am editing SM - core/logic/PluginSys.cpp and I have a problem with KeyValues.

In core/smn_console.cpp KeyValues works fine, but not in PluginSys.cpp.
I tried to include #include <KeyValues.h>, but compilation gives me error fatal error C1083: Cannot open include file: 'KeyValues.h': No such file or directory.

I also tried to #include "HalfLife2.h" and that gave me error \sourcemod\core\logic\../HalfLife2.h(45) : fatal error C1083: Cannot open include file: 'KeyValues.h': No such file or directory.

Can you help me please? I don't know what else should I try/do...

kadet.89 07-03-2015 12:49

Re: [SM] includes
 
You shouldn't edit the files from sdk.
Just add all the directories the compiler requires to the make file

Example for linux (Makefile):

Quote:

INCLUDE += -I$(HL2SDK)/public/tier1
Example for windows (*.vcxproj):

Quote:

<AdditionalIncludeDirectories>.........$(HL2S DK)\public\tier1;..... </AdditionalIncludeDirectories>
The parser breaks the line, so make sure that the line will be correct


If you do not know where a certain file is , open Total Commander, press ALT+F7 and set the sdk directory and the file name, it'll show you the file's directory

Are you sure that want to make an extension ?, it is a lot easier to make it all in source pawn

psychonic 07-03-2015 13:06

Re: [SM] includes
 
The logic binary (core/logic) does not include anything from the HL2SDK. It is for common or abstracted functionality that isn't dependent on the sdk. The result is that code inside core/logic gets compiled and distributed once, whereas code inside core gets compiled to 20 binaries (one per sdk).

TL;DR
You can't directly use KeyValues in the logic bin.

KissLick 07-03-2015 15:46

Re: [SM] includes
 
Can I use SMC in logic bin? I have a config which I need to load... :-(

I never tried SMC so I am even not sure how does it work...

WildCard65 07-03-2015 15:50

Re: [SM] includes
 
Quote:

Originally Posted by KissLick (Post 2315155)
Can I use SMC in logic bin? I have a config which I need to load... :-(

I never tried SMC so I am even not sure how does it work...

Yes, SMC is in TextParsers.h which is in the logic folder of SM's source which means it's compiled into the logic binary.

Edit: The pointer you use is textparsers

Edit2: This can help: https://github.com/alliedmodders/sou..._textparse.cpp

KissLick 07-03-2015 15:53

Re: [SM] includes
 
Thx god! Now I just need to find out how does SMC work and how to use it in SM core :-D Thx guys!

Quote:

Originally Posted by kadet.89 (Post 2315060)
Are you sure that want to make an extension ?, it is a lot easier to make it all in source pawn

I am trying to make my own SourceMod edition (or just fu** around SourceMod and learn, how to work with C++ in SM) :-D

WildCard65 07-03-2015 16:00

Re: [SM] includes
 
Quote:

Originally Posted by KissLick (Post 2315162)
just fu** around SourceMod and learn, how to work with C++ in SM

I have to agree with kadet, an extension would be better to f*** with as it doesn't have the risk of you breaking SM entirely. That and extensions to the SMC api(ITextParser.h).

KissLick 07-03-2015 16:14

Re: [SM] includes
 
Well, I am trying to stop some plugins from loading based on current map

map_plugins.cfg
PHP Code:

"root"
{
    
"map_a.bsp"   "config_1.cfg"
    "map_b.bsp"   "config_1.cfg"
    "map_c.bsp"   "config_1.cfg"
    "map_d.bsp"   "config_2.cfg"
    "map_e.bsp"   "config_2.cfg"
    "map_f.bsp"   "config_3.cfg"


config_1.cfg
PHP Code:

// all plugins here are prevented from loading on maps map_a, map_b and map_c

plugin_1.smx
plugin_2
.smx
plugin_3
.smx 

Of course I can load all plugins then unload some, but that's not very good way (some plugins change cvars, map etc.).
And if I put some plugins into disabled folder, there might by problems with dependencies on loading :-(

I think the best way, how to choose which plugins load in this map is in core (not sure if extension can do that, but I doupt it).

P.S.: This is big problem on multimod servers like mg+climb/course+deathrun


All times are GMT -4. The time now is 11:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.