diff --git a/sourcemm/CSmmAPI.cpp b/sourcemm/CSmmAPI.cpp index 4437fe7..0f336d2 100644 --- a/sourcemm/CSmmAPI.cpp +++ b/sourcemm/CSmmAPI.cpp @@ -454,14 +454,9 @@ void CSmmAPI::ClientConPrintf(edict_t *client, const char *fmt, ...) void CSmmAPI::LoadAsVSP() { - char path[260]; - if (!GetFileOfAddress(CreateInterface, path, sizeof(path))) - { - /* Failed! */ - } char command[350]; g_VspListener.SetLoadable(true); - UTIL_Format(command, sizeof(command), "plugin_load \"%s\"\n", path); + UTIL_Format(command, sizeof(command), "plugin_load \"%s\"\n", g_SmmPath.c_str()); g_Engine.engine->ServerCommand(command); } diff --git a/sourcemm/sourcemm.cpp b/sourcemm/sourcemm.cpp index 4fbe007..cb48a30 100644 --- a/sourcemm/sourcemm.cpp +++ b/sourcemm/sourcemm.cpp @@ -50,6 +50,7 @@ SourceHook::CSourceHookImpl g_SourceHook; SourceHook::ISourceHook *g_SHPtr = &g_SourceHook; SourceHook::String g_ModPath; SourceHook::String g_BinPath; +SourceHook::String g_SmmPath; PluginId g_PLID = Pl_Console; /* Technically, SourceMM is the "Console" plugin... :p */ bool bInFirstLevel = true; bool gParsedGameInfo = false; @@ -249,6 +250,8 @@ SMM_API void *CreateInterface(const char *iface, int *ret) return NULL; } + g_SmmPath.assign(smmPath); + /* Get value of -game from command line, defaulting to hl2 as engine seems to do */ gameDir = CommandLine()->ParmValue("-game", "hl2"); diff --git a/sourcemm/sourcemm.h b/sourcemm/sourcemm.h index 90b00a8..b61f9eb 100644 --- a/sourcemm/sourcemm.h +++ b/sourcemm/sourcemm.h @@ -102,6 +102,9 @@ extern SourceHook::String g_ModPath; /** @brief Path to server binary */ extern SourceHook::String g_BinPath; +/** @brief Path to SourceMM binary */ +extern SourceHook::String g_SmmPath; + /** @brief Global variable for SourceHook macros */ extern SourceHook::ISourceHook *g_SHPtr;