From a36dafb9068f5bd73b56b6947b207dd86146da5a Mon Sep 17 00:00:00 2001 From: Michael Flaherty Date: Tue, 18 Apr 2017 04:29:47 -0700 Subject: [PATCH] Add PrintToConsoleAll (#601) --- plugins/include/console.inc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/include/console.inc b/plugins/include/console.inc index 0c30d516..2ea3b5f3 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -210,6 +210,28 @@ native void PrintToServer(const char[] format, any ...); */ native void PrintToConsole(int client, const char[] format, any ...); + +/** + * Sends a message to every client's console. + * + * @param format Formatting rules. + * @param ... Variable number of format parameters. + */ +stock void PrintToConsoleAll(const char[] format, any ...) +{ + char buffer[254]; + + for (int i = 1; i <= MaxClients; i++) + { + if (IsClientInGame(i)) + { + SetGlobalTransTarget(i); + VFormat(buffer, sizeof(buffer), format, 2); + PrintToConsole(i, "%s", buffer); + } + } +} + /** * Reples to a message in a command. *