This may sound dumb, But im new to this so excuse me. Im stuck trying to figure out how i can call GMod/Source/engine function from my module. I Have found some stuff on source sdk but everything is way outdated for me to use. Any links/help would be greatly appreciated. Thanks.
Download [URL="https://github.com/ValveSoftware/source-sdk-2013/tree/master/mp/src/public"]this[/URL] folder and add it as an include directory ([B]C/C++ > General > Additional Include Directories[/B]).
Download [URL="https://github.com/ValveSoftware/source-sdk-2013/tree/master/mp/src/lib/public"]this[/URL] folder and add any libs needed as dependencies ([B]Linker > General > Additional Library Dependencies[/B] and [B]Linker > Input[/B]).
Set [B]C/C++ > Code Generation > Runtime Library[/B] to [B]Multi-threaded (/MT)[/B].
[QUOTE=man with hat;49797046]Download [URL="https://github.com/ValveSoftware/source-sdk-2013/tree/master/mp/src/public"]this[/URL] folder and add it as an include directory ([B]C/C++ > General > Additional Include Directories[/B]).
Download [URL="https://github.com/ValveSoftware/source-sdk-2013/tree/master/mp/src/lib/public"]this[/URL] folder and add any libs needed as dependencies ([B]Linker > General > Additional Library Dependencies[/B] and [B]Linker > Input[/B]).
Set [B]C/C++ > Code Generation > Runtime Library[/B] to [B]Multi-threaded (/MT)[/B]).[/QUOTE]
Thanks, Helps alot. What headers should I include though? All of them, Or specific.
[QUOTE=0V3RR1D3;49797061]Thanks, Helps alot. What headers should I include though? All of them, Or specific.[/QUOTE]
You don't need to include anything other than whatever you're gonna use. If you wanna just give it a test run and have it print a simple message, you can include [B]tier0/dbg.h[/B] and use
[cpp]Msg("Hello world\n");[/cpp]
That will print to the game console.
[QUOTE=man with hat;49797069]You don't need to include anything other than whatever you're gonna use. If you wanna just give it a test run and have it print a simple message, you can include [B]tier0/dbg.h[/B] and use
[cpp]Msg("Hello world\n");[/cpp]
That will print to the game console.[/QUOTE]
Thanks for the help, The functions show up as being defined but when ever I try to build using the function Msg("Test") inf my MODULE_OPEN it throws this error
[IMG]https://i.gyazo.com/5711ffdeb2d192f605a0e38c08ae6911.png[/IMG]
[QUOTE=0V3RR1D3;49797096]Thanks for the help, The functions show up as being defined but when ever I try to build using the function Msg("Test") inf my MODULE_OPEN it throws this error
[IMG]https://i.gyazo.com/5711ffdeb2d192f605a0e38c08ae6911.png[/IMG][/QUOTE]
You need to list tier0.lib as a dependency.
[IMG]http://i.imgur.com/ECQKiUk.png[/IMG]
Wherever you saved tier0.lib, also put that directory in [B]Linker > General > Additional Library Dependencies[/B].
[QUOTE=man with hat;49797103]You need to list tier0.lib as a dependency.
[IMG]http://i.imgur.com/ECQKiUk.png[/IMG]
Wherever you saved tier0.lib, also put that directory in [B]Linker > General > Additional Library Dependencies[/B].[/QUOTE]
Now its complaining that is cannot open input file 'tier0.lib'
Never mind I did it to /mp/src/lib by accident. I really apreciate your help man! One last thing though, Is there a wiki or documetation for source functions like the gmod wiki?
[QUOTE=0V3RR1D3;49797112]Now its complaining that is cannot open input file 'tier0.lib'
Never mind I did it to /mp/src/lib by accident. I really apreciate your help man! One last thing though, Is there a wiki or documetation for source functions like the gmod wiki?[/QUOTE]
Other than the Valve Developer site, I don't know.
[url]https://developer.valvesoftware.com/wiki/Main_Page[/url]
AlliedModders is pretty helpful, I think, but it's sort of targeted towards a specific mod. Good as a reference for info, though.
[url]https://forums.alliedmods.net/[/url]
Alright, Well I cannot thank you enough, I had been here nearly 2 hours trying to solve this. Thank you!
[editline]23rd February 2016[/editline]
Hey man, Sorry to re-open this, Im trying to access the engine to excute a client console command. I have included these two files
[CODE]#include "public/cdll_int.h"
#include "game/client/cdll_client_int.h"[/CODE]
Then I tried to do this
[CODE]engine->ClientCmd("say Hello!\n");[/CODE]
But it give me this error (I Have included all the libs in the lib folder)
[IMG]https://i.gyazo.com/92d0f216d1e969714fe8650490266e29.png[/IMG]
You don't need that second include. Show full code.
This is probably the way to go: [URL]https://github.com/glua/SourceSDK[/URL]
Glua also has a base module, to make things more convenient: [url]https://github.com/glua/module-base[/url]
Hopefully these still work.
This is what i do
[IMG]http://i.imgur.com/WPr3hdL.png[/IMG]
[QUOTE=0V3RR1D3;49797139]-errors-[/QUOTE]
You can't use the global 'engine' defined in the source headers, you'll need to find the class instance yourself. Specifically for that class, you can use Valve's interface system.
[code]
// Sys_GetFactory, CreateInterfaceFn and VENGINE_CLIENT_INTERFACE_VERSION are defined in the SDK though VENGINE_CLIENT_INTERFACE_VERSION might be out of date
CreateInterfaceFn engineInterface = Sys_GetFactory( "engine.dll" );
IVEngineClient* myEngineRef = (IVEngineClient*)engineInterface( VENGINE_CLIENT_INTERFACE_VERSION, NULL );
[/code]
[QUOTE=Lapin_b0t;49802799]This is what i do
[IMG]http://i.imgur.com/WPr3hdL.png[/IMG][/QUOTE]
He never said he wanted the warning function and you also included no typedef definition. And your function has no support for vararg parameters that Warning does - how is this useful to him?
Sorry, you need to Log In to post a reply to this thread.