1.1 --- a/core/smn_core.cpp Fri Jan 04 16:05:26 2008 +0000
1.2 +++ b/core/smn_core.cpp Fri Jan 04 16:20:25 2008 +0000
1.3 @@ -371,12 +371,35 @@
1.4 static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
1.5 {
1.6 char *str;
1.7 + CPlugin *pPlugin;
1.8 +
1.9 pContext->LocalToString(params[1], &str);
1.10 + pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
1.11 +
1.12 + if (params[0] == 1)
1.13 + {
1.14 + pPlugin->SetErrorState(Plugin_Error, "%s", str);
1.15 +
1.16 + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str);
1.17 + }
1.18 + else
1.19 + {
1.20 + char buffer[2048];
1.21
1.22 - CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
1.23 - pPlugin->SetErrorState(Plugin_Error, "%s", str);
1.24 + g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
1.25 + if (pContext->GetContext()->n_err != SP_ERROR_NONE)
1.26 + {
1.27 + pPlugin->SetErrorState(Plugin_Error, "%s", str);
1.28 + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "Formatting error (%s)", str);
1.29 + }
1.30 + else
1.31 + {
1.32 + pPlugin->SetErrorState(Plugin_Error, "%s", buffer);
1.33 + return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer);
1.34 + }
1.35 + }
1.36
1.37 - return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str);
1.38 + return 0;
1.39 }
1.40
1.41 static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)