Add ability to text formatting to set_fail_state (bug 5800, r=me)

Former-commit-id: 2af8a27164
This commit is contained in:
Vincent Herbet 2013-07-27 20:33:17 +02:00
parent f9954e5831
commit 0dd14eed43
2 changed files with 9 additions and 2 deletions

View File

@ -4054,7 +4054,14 @@ static cell AMX_NATIVE_CALL LibraryExists(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_fail_state(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_fail_state(AMX *amx, cell *params)
{ {
int len; int len;
char *str = get_amxstring(amx, params[1], 0, len); char* str;
g_langMngr.SetDefLang(LANG_SERVER); // Default language = server
if (params[0] / sizeof(cell) > 1)
str = format_amxstring(amx, params, 1, len);
else
str = get_amxstring(amx, params[1], 0, len);
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);

View File

@ -968,7 +968,7 @@ native int3();
//If you use this, your plugin will cease operating. //If you use this, your plugin will cease operating.
//This is a good idea to fatally, but gracefully, handle errors. //This is a good idea to fatally, but gracefully, handle errors.
//You can set a failed error message. //You can set a failed error message.
native set_fail_state(const err_msg[]); native set_fail_state(const fmt[], any:...);
//Returns the reference address of the variable passed in. //Returns the reference address of the variable passed in.
//This address is local to the plugin, and not a full CPU address //This address is local to the plugin, and not a full CPU address