]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Welcome message: fix broken version check by giving the client time to send its versi...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 7acbfe6cbafb20b4b0ee7ec41441e79828153dc7..d1f6e1b8d102d67570dd1b2e09a37ed93c94bacf 100644 (file)
@@ -1286,6 +1286,40 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
        }
 }
 
+NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
+{
+       bool force_centerprint = ReadByte();
+       string hostname = ReadString();
+       string ver = ReadString();
+       string modifications = ReadString();
+       string cache_mutatormsg = ReadString();
+       string mutator_msg = ReadString();
+       string motd = ReadString();
+
+       string msg = "";
+       msg = strcat(msg, ver);
+       msg = strcat(msg, "^8\n\n", _("match type is "), " ^1", MapInfo_Type_ToText(gametype), "^8\n");
+       if(modifications != "")
+               msg = strcat(msg, "^8\n", _("active modifications:"), " ^3", modifications, "^8\n");
+       if (cache_mutatormsg != "")
+               msg = strcat(msg, "\n\n^8", _("special gameplay tips:"), " ^7", cache_mutatormsg);
+       msg = strcat(msg, mutator_msg); // trust that the mutator will do proper formatting
+       if (motd != "")
+               msg = strcat(msg, "\n\n^8", _("MOTD:"), " ^7", motd);
+
+       if (!force_centerprint && !isdemo() && cvar("_menu_welcome_dialog_available") && autocvar_cl_welcome_in_menu_dialog)
+       {
+               string welcomedialog_args;
+               welcomedialog_args = strcat("HOSTNAME \"", hostname, "\"");
+               msg = MakeConsoleSafe(strreplace("\n", "\\n", msg));
+               welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\"");
+               localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+       }
+       else
+               centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", msg), -1, 0);
+       return true;
+}
+
 string _getcommandkey(string cmd_name, string command, bool forcename)
 {
        string keys;