diff --git a/core/logic/smn_string.cpp b/core/logic/smn_string.cpp index 6fb1c1c6..6960a438 100644 --- a/core/logic/smn_string.cpp +++ b/core/logic/smn_string.cpp @@ -230,6 +230,9 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params) static char g_vformatbuf[2048]; static cell_t sm_vformat(IPluginContext *pContext, const cell_t *params) { + if (pContext->GetBaseRuntime()->AsV2() != nullptr) + return pContext->ThrowNativeError("VFormat is not supported in SourcePawn 2 plugins"); + int vargPos = static_cast(params[4]); /* Get the parent parameter array */ diff --git a/plugins/admin-flatfile.sp b/plugins/admin-flatfile.sp index c6a35cce..0c57bd84 100644 --- a/plugins/admin-flatfile.sp +++ b/plugins/admin-flatfile.sp @@ -79,7 +79,7 @@ void ParseError(const char[] format, any ...) g_LoggedFileName = true; } - VFormat(buffer, sizeof(buffer), format, 2); + FormatEx(buffer, sizeof(buffer), format, ...); LogError(" (line %d) %s", g_CurrentLine, buffer); diff --git a/plugins/basechat.sp b/plugins/basechat.sp index 0873706c..eb37eae0 100644 --- a/plugins/basechat.sp +++ b/plugins/basechat.sp @@ -403,7 +403,7 @@ void SendChatToAdmins(int from, const char[] message) void SendDialogToOne(int client, int color, const char[] text, any ...) { char message[100]; - VFormat(message, sizeof(message), text, 4); + FormatEx(message, sizeof(message), text, ...); KeyValues kv = new KeyValues("Stuff", "title", message); kv.SetColor("color", g_Colors[color][0], g_Colors[color][1], g_Colors[color][2], 255); diff --git a/plugins/include/console.inc b/plugins/include/console.inc index c13c3924..a721c979 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -226,7 +226,11 @@ stock void PrintToConsoleAll(const char[] format, any ...) if (IsClientInGame(i)) { SetGlobalTransTarget(i); +#if defined __sourcepawn2 + FormatEx(buffer, sizeof(buffer), format, ...); +#else VFormat(buffer, sizeof(buffer), format, 2); +#endif PrintToConsole(i, "%s", buffer); } } diff --git a/plugins/include/halflife.inc b/plugins/include/halflife.inc index 38626f23..670a7be9 100644 --- a/plugins/include/halflife.inc +++ b/plugins/include/halflife.inc @@ -391,7 +391,11 @@ stock void PrintToChatAll(const char[] format, any ...) if (IsClientInGame(i)) { SetGlobalTransTarget(i); +#if defined __sourcepawn2 + FormatEx(buffer, sizeof(buffer), format, ...); +#else VFormat(buffer, sizeof(buffer), format, 2); +#endif PrintToChat(i, "%s", buffer); } } @@ -422,7 +426,11 @@ stock void PrintCenterTextAll(const char[] format, any ...) if (IsClientInGame(i)) { SetGlobalTransTarget(i); +#if defined __sourcepawn2 + FormatEx(buffer, sizeof(buffer), format, ...); +#else VFormat(buffer, sizeof(buffer), format, 2); +#endif PrintCenterText(i, "%s", buffer); } } @@ -453,7 +461,11 @@ stock void PrintHintTextToAll(const char[] format, any ...) if (IsClientInGame(i)) { SetGlobalTransTarget(i); +#if defined __sourcepawn2 + FormatEx(buffer, sizeof(buffer), format, ...); +#else VFormat(buffer, sizeof(buffer), format, 2); +#endif PrintHintText(i, "%s", buffer); } } diff --git a/plugins/include/string.inc b/plugins/include/string.inc index c3851009..4670ac31 100644 --- a/plugins/include/string.inc +++ b/plugins/include/string.inc @@ -165,6 +165,7 @@ native int Format(char[] buffer, int maxlength, const char[] format, any ...); */ native int FormatEx(char[] buffer, int maxlength, const char[] format, any ...); +#if !defined __sourcepawn2 /** * Formats a string according to the SourceMod format rules (see documentation). * @note This is the same as Format(), except it grabs parameters from a @@ -181,6 +182,7 @@ native int FormatEx(char[] buffer, int maxlength, const char[] format, any ...); * @error Invalid argument index. */ native int VFormat(char[] buffer, int maxlength, const char[] format, int varpos); +#endif /** * Converts a string to an integer.