if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")", strMessage);
localcmd(strMessage);
}
+
+string autocvar__cl_hook_print;
+
// CSQC_Parse_Print : Provides the print string in the first parameter that the server provided. To execute standard behavior, simply execute print with the string.
void CSQC_Parse_Print(string strMessage)
{
if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")", strMessage);
- print(ColorTranslateRGB(strMessage));
+ if (autocvar__cl_hook_print != "") {
+ localcmd("\n", autocvar__cl_hook_print, " ", console_encode(strMessage), "\n");
+ } else {
+ print(ColorTranslateRGB(strMessage));
+ }
}
// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
case MSG_INFO:
{
- print(
+ #ifdef CSQC
+ void(string) echo = CSQC_Parse_Print;
+ #else
+ void(string, ...) echo = print;
+ #endif
+ echo(
Local_Notification_sprintf(
notif.nent_string,
notif.nent_args,
SOUND(SPAWN, "misc/spawn");
SOUND(TALK, "misc/talk");
+SOUND(TALK2, "misc/talk2");
SOUND(TELEPORT, "misc/teleport");
return input;
}
+ERASEABLE
+string console_encode(string input)
+{
+ input = strreplace("$", "$$", input);
+ input = strreplace("\r", "\\r", input);
+ input = strreplace("\n", "\\n", input);
+ input = strreplace("\"", "\\\"", input);
+ input = sprintf("\"%s\"", input);
+ return input;
+}
+
+ERASEABLE
+string console_decode(string input)
+{
+ input = substring(input, 1, -2);
+ input = strreplace("\\r", "\r", input);
+ input = strreplace("\\n", "\n", input);
+ input = strreplace("\\\"", "\"", input);
+ return input;
+}
+
ERASEABLE
void cvar_describe(string name, string desc)
{
// generated file; do not modify
#include <menu/command/menu_cmd.qc>
+#include <menu/command/notice.qc>
// generated file; do not modify
#include <menu/command/menu_cmd.qh>
+#include <menu/command/notice.qh>
--- /dev/null
+#include "notice.qh"
+
+#include <common/sounds/all.qh>
+
+noref string autocvar__cl_hook_print = "menu_cmd notice";
+
+GENERIC_COMMAND(notice, "Append a notice to chat")
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ string s = console_decode(substring(command, argv_start_index(1), argv_end_index(-1)));
+ for (int i = 0, n = tokenizebyseparator(s, "\n"); i < n; ++i)
+ {
+ string s = ColorTranslateRGB(argv(i));
+ int c = str2chr(s, 0);
+ if (c == 1 || c == 3) {
+ // visible in chat
+ s = substring(s, 1, -1);
+ if (c == 1) {
+ entity snd;
+ if (str2chr(s, 0) == '\r') {
+ s = substring(s, 1, -1);
+ snd = SND_TALK2;
+ } else {
+ snd = SND_TALK;
+ }
+ localsound(Sound_fixpath(snd));
+ }
+ s = strcat("^3", s);
+ } else {
+ // not visible in chat
+ s = strcat("^7", s);
+ }
+ print(s, "\n");
+ }
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " notice message");
+ LOG_INFO(" Where 'message' is the message to append.");
+ return;
+ }
+ }
+}
--- /dev/null
+#pragma once