diff -r 1f97873475e8 -r 3bb2c9cb63d2 core/smn_core.cpp --- a/core/smn_core.cpp Fri Jan 04 16:05:26 2008 +0000 +++ b/core/smn_core.cpp Fri Jan 04 16:20:25 2008 +0000 @@ -371,12 +371,35 @@ static cell_t SetFailState(IPluginContext *pContext, const cell_t *params) { char *str; + CPlugin *pPlugin; + pContext->LocalToString(params[1], &str); + pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext()); + + if (params[0] == 1) + { + pPlugin->SetErrorState(Plugin_Error, "%s", str); + + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str); + } + else + { + char buffer[2048]; - CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext()); - pPlugin->SetErrorState(Plugin_Error, "%s", str); + g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1); + if (pContext->GetContext()->n_err != SP_ERROR_NONE) + { + pPlugin->SetErrorState(Plugin_Error, "%s", str); + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "Formatting error (%s)", str); + } + else + { + pPlugin->SetErrorState(Plugin_Error, "%s", buffer); + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer); + } + } - return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str); + return 0; } static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)