diff --git a/core/msvc8/sourcemod_mm.vcproj b/core/msvc8/sourcemod_mm.vcproj
index 7b30ebd9..c05a59b0 100644
--- a/core/msvc8/sourcemod_mm.vcproj
+++ b/core/msvc8/sourcemod_mm.vcproj
@@ -681,6 +681,10 @@
RelativePath="..\smn_console.cpp"
>
+
+
diff --git a/core/smn_core.cpp b/core/smn_core.cpp
new file mode 100644
index 00000000..bc7b342a
--- /dev/null
+++ b/core/smn_core.cpp
@@ -0,0 +1,35 @@
+/**
+ * ===============================================================
+ * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
+ * ===============================================================
+ *
+ * This file is not open source and may not be copied without explicit
+ * written permission of AlliedModders LLC. This file may not be redistributed
+ * in whole or significant part.
+ * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
+ *
+ * Version: $Id$
+ */
+
+#include "sm_globals.h"
+#include "sourcemod.h"
+
+static cell_t ThrowError(IPluginContext *pContext, const cell_t *params)
+{
+ char buffer[512];
+
+ g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
+
+ if (pContext->GetContext()->n_err == SP_ERROR_NONE)
+ {
+ pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer);
+ }
+
+ return 0;
+}
+
+REGISTER_NATIVES(coreNatives)
+{
+ {"ThrowError", ThrowError},
+ {NULL, NULL},
+};
diff --git a/core/vm/sp_vm_engine.cpp b/core/vm/sp_vm_engine.cpp
index 49d6fa25..9f884da1 100644
--- a/core/vm/sp_vm_engine.cpp
+++ b/core/vm/sp_vm_engine.cpp
@@ -31,7 +31,7 @@
using namespace SourcePawn;
-#define ERROR_MESSAGE_MAX 23
+#define ERROR_MESSAGE_MAX 25
static const char *g_ErrorMsgTable[] =
{
NULL,
@@ -59,6 +59,7 @@ static const char *g_ErrorMsgTable[] =
"Maximum number of parameters reached",
"Native detected error",
"Plugin not runnable",
+ "Call was aborted",
};
SourcePawnEngine::SourcePawnEngine()
diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc
index fb0d3299..64ccb7db 100644
--- a/plugins/include/sourcemod.inc
+++ b/plugins/include/sourcemod.inc
@@ -37,7 +37,6 @@ struct Plugin
#include
#include
#include
-#include
/**
* Declare this as a struct in your plugin to expose its information.
@@ -106,6 +105,18 @@ forward OnGameFrame();
*/
native Handle:GetMyHandle();
+
+/**
+ * Aborts the current callback and throws an error. This function
+ * does not return in that no code is executed following it.
+ *
+ * @param format String format.
+ * @param ... Format arguments.
+ * @noreturn
+ * @error Always!
+ */
+native ThrowError(const String:fmt[], {Handle,Float,String,_}:...);
+
/**
* Logs a generic message to the HL2 logs.
*
@@ -210,3 +221,4 @@ native GetCurrentMap(String:buffer[], maxlength);
#include
#include
+#include
diff --git a/public/sourcepawn/sp_vm_types.h b/public/sourcepawn/sp_vm_types.h
index 9e04a143..2ba21ffd 100644
--- a/public/sourcepawn/sp_vm_types.h
+++ b/public/sourcepawn/sp_vm_types.h
@@ -62,6 +62,7 @@ typedef uint32_t funcid_t; /**< Function index code */
#define SP_ERROR_PARAMS_MAX 22 /**< Maximum number of parameters reached */
#define SP_ERROR_NATIVE 23 /**< Error originates from a native */
#define SP_ERROR_NOT_RUNNABLE 24 /**< Function or plugin is not runnable */
+#define SP_ERROR_ABORTED 25 /**< Function call was aborted */
//Hey you! Update the string table if you add to the end of me! */
/**********************************************