From b8a03b353ffeebb939b053a0e8c30af28d56eeb9 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 28 Jun 2024 20:06:40 +1000 Subject: [PATCH] join: display translated notifications for relevant failures --- notifications.cfg | 1 + qcsrc/common/notifications/all.inc | 1 + qcsrc/server/client.qc | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/notifications.cfg b/notifications.cfg index ee486bd42..bc2693c21 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -499,6 +499,7 @@ seta notification_CENTER_JOIN_PREVENT_MINIGAME "1" "0 = off, 1 = centerprint" seta notification_CENTER_JOIN_PREVENT_QUEUE "1" "0 = off, 1 = centerprint" seta notification_CENTER_JOIN_PREVENT_QUEUE_TEAM_CONFLICT "1" "0 = off, 1 = centerprint" seta notification_CENTER_JOIN_PREVENT_QUEUE_TEAM "1" "0 = off, 1 = centerprint" +seta notification_CENTER_JOIN_PREVENT_VERSIONMISMATCH "1" "0 = off, 1 = centerprint" seta notification_CENTER_KEEPAWAY_DROPPED "1" "0 = off, 1 = centerprint" seta notification_CENTER_KEEPAWAY_PICKUP "1" "0 = off, 1 = centerprint" seta notification_CENTER_KEEPAWAY_PICKUP_SELF "1" "0 = off, 1 = centerprint" diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 23cf5e3e7..60a9e2449 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -724,6 +724,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(ITEM_WEAPON_PRIMORSEC, N_ENABLE, 0, 3, "item_wepname f2primsec f3primsec", CPID_ITEM, "item_centime 0", _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "") MSG_CENTER_NOTIF(ITEM_WEAPON_UNAVAILABLE, N_ENABLE, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^F1%s^BG is ^F4not available^BG on this map"), "") + MSG_CENTER_NOTIF(JOIN_PREVENT_VERSIONMISMATCH, N_ENABLE, 0, 0, "", CPID_PREVENT_JOIN, "0 0", _("^K1Your Xonotic version is incompatible with the server's version!"), "") MSG_CENTER_NOTIF(JOIN_NOSPAWNS, N_ENABLE, 0, 0, "", CPID_PREVENT_JOIN, "0 0", _("^K1No spawnpoints available!\nHope your team can fix it..."), "") MSG_CENTER_NOTIF(JOIN_PLAYBAN, N_ENABLE, 0, 0, "", CPID_PREVENT_JOIN, "0 0", BOLD(_("^K1You aren't allowed to play because you are banned in this server")), "") MSG_CENTER_NOTIF(JOIN_PREVENT, N_ENABLE, 0, 1, "f1", CPID_PREVENT_JOIN, "0 0", _("^K1You may not join the game at this time.\nThis match is limited to ^F2%s^BG players."), "") diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index dbb62150a..b25948142 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2227,9 +2227,17 @@ bool queuePlayer(entity this, int team_index) bool joinAllowed(entity this, int team_index) { - if (CS(this).version_mismatch) return false; + if (CS(this).version_mismatch) + { + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT_VERSIONMISMATCH); + return false; + } if (time < CS(this).jointime + MIN_SPEC_TIME) return false; - if (teamplay && lockteams) return false; + if (teamplay && lockteams) + { + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_LOCKED); + return false; + } if (QueueNeeded(this)) { -- 2.39.2