diff --git a/core/smn_console.cpp b/core/smn_console.cpp index 9fee35bd..728d1fd0 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -659,6 +659,8 @@ static cell_t sm_ServerCommand(IPluginContext *pContext, const cell_t *params) char buffer[1024]; size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1); + g_SourceMod.SetGlobalTarget(LANG_SERVER); + /* One byte for null terminator, one for newline */ buffer[len++] = '\n'; buffer[len] = '\0'; @@ -673,6 +675,8 @@ static cell_t sm_InsertServerCommand(IPluginContext *pContext, const cell_t *par char buffer[1024]; size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1); + g_SourceMod.SetGlobalTarget(LANG_SERVER); + /* One byte for null terminator, one for newline */ buffer[len++] = '\n'; buffer[len] = '\0'; @@ -703,6 +707,8 @@ static cell_t sm_ClientCommand(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Client %d is not connected", params[1]); } + g_SourceMod.SetGlobalTarget(params[1]); + char buffer[256]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); @@ -738,6 +744,8 @@ static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params) static cell_t ReplyToCommand(IPluginContext *pContext, const cell_t *params) { + g_SourceMod.SetGlobalTarget(params[1]); + /* Build the format string */ char buffer[1024]; size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 2); diff --git a/core/smn_core.cpp b/core/smn_core.cpp index 79e19afa..df817a92 100644 --- a/core/smn_core.cpp +++ b/core/smn_core.cpp @@ -60,6 +60,8 @@ static cell_t ThrowError(IPluginContext *pContext, const cell_t *params) { char buffer[512]; + g_SourceMod.SetGlobalTarget(LANG_SERVER); + g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1); if (pContext->GetContext()->n_err == SP_ERROR_NONE) diff --git a/core/smn_fakenatives.cpp b/core/smn_fakenatives.cpp index ec248837..d93473f0 100644 --- a/core/smn_fakenatives.cpp +++ b/core/smn_fakenatives.cpp @@ -119,6 +119,8 @@ static cell_t ThrowNativeError(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Not called from inside a native function"); } + g_SourceMod.SetGlobalTarget(LANG_SERVER); + char buffer[512]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); diff --git a/core/smn_filesystem.cpp b/core/smn_filesystem.cpp index 863a4ff7..a6f43d4a 100644 --- a/core/smn_filesystem.cpp +++ b/core/smn_filesystem.cpp @@ -481,6 +481,8 @@ static cell_t sm_BuildPath(IPluginContext *pContext, const cell_t *params) static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params) { + g_SourceMod.SetGlobalTarget(LANG_SERVER); + char buffer[1024]; size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1); @@ -500,6 +502,8 @@ static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params) static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params) { + g_SourceMod.SetGlobalTarget(LANG_SERVER); + char buffer[1024]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1); @@ -511,6 +515,8 @@ static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params) static cell_t sm_LogError(IPluginContext *pContext, const cell_t *params) { + g_SourceMod.SetGlobalTarget(LANG_SERVER); + char buffer[1024]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1); diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index 1932f204..005f5ceb 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -273,6 +273,8 @@ static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Client %d is not in game", client); } + g_SourceMod.SetGlobalTarget(client); + char buffer[192]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); @@ -296,6 +298,8 @@ static cell_t PrintCenterText(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Client %d is not in game", client); } + g_SourceMod.SetGlobalTarget(client); + char buffer[192]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); diff --git a/core/smn_menus.cpp b/core/smn_menus.cpp index 48d805b8..f2ba8334 100644 --- a/core/smn_menus.cpp +++ b/core/smn_menus.cpp @@ -19,6 +19,7 @@ #include "MenuStyle_Radio.h" #include "HandleSys.h" #include "PluginSys.h" +#include "sm_stringutil.h" #if defined MENU_DEBUG #include "Logger.h" #endif @@ -587,6 +588,8 @@ static cell_t SetMenuTitle(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err); } + g_SourceMod.SetGlobalTarget(LANG_SERVER); + char buffer[1024]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2); diff --git a/core/smn_player.cpp b/core/smn_player.cpp index 0345a12e..494e8add 100644 --- a/core/smn_player.cpp +++ b/core/smn_player.cpp @@ -963,6 +963,8 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params) INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(client)); IClient *pClient = static_cast(pNetChan->GetMsgHandler()); + g_SourceMod.SetGlobalTarget(client); + char buffer[256]; g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);