Raised This Month: $51 Target: $400
 12% 

[SM] includes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-03-2015 , 12:18   [SM] includes
Reply With Quote #1

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...
KissLick is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-03-2015 , 12:49   Re: [SM] includes
Reply With Quote #2

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

Last edited by kadet.89; 07-03-2015 at 14:43.
kadet.89 is offline
Send a message via Skype™ to kadet.89
psychonic

BAFFLED
Join Date: May 2008
Old 07-03-2015 , 13:06   Re: [SM] includes
Reply With Quote #3

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.

Last edited by psychonic; 07-03-2015 at 13:07.
psychonic is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-03-2015 , 15:46   Re: [SM] includes
Reply With Quote #4

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...
KissLick is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-03-2015 , 15:50   Re: [SM] includes
Reply With Quote #5

Quote:
Originally Posted by KissLick View Post
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
__________________

Last edited by WildCard65; 07-03-2015 at 15:52.
WildCard65 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-03-2015 , 15:53   Re: [SM] includes
Reply With Quote #6

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 View Post
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
KissLick is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-03-2015 , 16:00   Re: [SM] includes
Reply With Quote #7

Quote:
Originally Posted by KissLick View Post
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).
__________________

Last edited by WildCard65; 07-03-2015 at 16:00.
WildCard65 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-03-2015 , 16:14   Re: [SM] includes
Reply With Quote #8

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

Last edited by KissLick; 07-03-2015 at 16:15.
KissLick is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:24.


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