From: TimePath Date: Fri, 6 Apr 2018 11:21:35 +0000 (+1000) Subject: Chat: parse lines in CSQC_Parse_Print, killsprees send multiple messages X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=847e6b4ee337d8a238d661b7023e4092c787f8cd;p=xonotic%2Fxonotic-data.pk3dir.git Chat: parse lines in CSQC_Parse_Print, killsprees send multiple messages --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c0c04e7cd..163bbce22 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -917,23 +917,25 @@ void CSQC_Parse_Print(string strMessage) if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")", strMessage); if (autocvar__cl_hook_print != "") { int flags = NOTICE_SILENT; - string s = substring(strMessage, 0, -2); // remove trailing \n - int c = str2chr(s, 0); - if (c == 1 || c == 2 || c == 3) { - s = substring(s, 1, -1); - if (c == 1) { - flags &= ~NOTICE_SILENT; - if (str2chr(s, 0) == '\r') { - s = substring(s, 1, -1); - flags |= NOTICE_PRIVATE; + for (int i = 0, n = tokenizebyseparator(strMessage, "\n"); i < n; ++i) { + string s = substring(argv(i), 0, -1); + int c = str2chr(s, 0); + if (c == 1 || c == 2 || c == 3) { + s = substring(s, 1, -1); + if (c == 1) { + flags &= ~NOTICE_SILENT; + if (str2chr(s, 0) == '\r') { + s = substring(s, 1, -1); + flags |= NOTICE_PRIVATE; + } } + if (c != 2) { + flags |= NOTICE_CHAT; + } + s = strcat("^3", s); } - if (c != 2) { - flags |= NOTICE_CHAT; - } - s = strcat("^3", s); + localcmd("\n", autocvar__cl_hook_print, " ", console_encode(s), " ", itos(flags), "\n"); } - localcmd("\n", autocvar__cl_hook_print, " ", console_encode(s), " ", itos(flags), "\n"); } else { print(ColorTranslateRGB(strMessage)); }