From: LegendaryGuard Date: Fri, 16 Jun 2023 18:05:21 +0000 (+0200) Subject: Add cvar to display player number alongside their name in the chat X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a6dea9c38438a630bc94e5ff7ac80d05075d32b7;p=xonotic%2Fxonotic-data.pk3dir.git Add cvar to display player number alongside their name in the chat --- diff --git a/qcsrc/server/chat.qc b/qcsrc/server/chat.qc index 5a72b5977..d37bdca9c 100644 --- a/qcsrc/server/chat.qc +++ b/qcsrc/server/chat.qc @@ -90,6 +90,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc if (source) namestr = playername(source.netname, source.team, (autocvar_g_chat_teamcolors && IS_PLAYER(source))); + if (autocvar_g_chat_show_playerid) + namestr = strcat(namestr, " ^9#", itos(etof(source)), "^7"); + string colorprefix = (strdecolorize(namestr) == namestr) ? "^3" : "^7"; string msgstr = "", cmsgstr = ""; diff --git a/qcsrc/server/chat.qh b/qcsrc/server/chat.qh index a921f61ec..7d7a730f4 100644 --- a/qcsrc/server/chat.qh +++ b/qcsrc/server/chat.qh @@ -17,6 +17,7 @@ bool autocvar_g_chat_team_allowed; int autocvar_g_chat_nospectators; bool autocvar_g_chat_teamcolors; bool autocvar_g_chat_tellprivacy; +bool autocvar_g_chat_show_playerid; const float NUM_NEAREST_ENTITIES = 4; entity nearest_entity[NUM_NEAREST_ENTITIES]; diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 819ef7a50..0225e1ff0 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -383,6 +383,7 @@ set g_chat_spectator_allowed 1 "allow spectators to communicate via in-game chat set g_chat_team_allowed 1 "allow players to communicate via in-game team chat" set g_chat_teamcolors 0 "colorize nicknames in team color for chat" set g_chat_tellprivacy 1 "when disabled, tell messages are also sent to the server console log... otherwise they're kept private between players." +set g_chat_show_playerid 0 "when enabled, show the player numbers next to their names in the chat" set g_nick_flood_timeout 120 "time after which nick flood protection resets (set to 0 to disable nick flood checking)" set g_nick_flood_penalty 0.5 "duration of the nick flood penalty" set g_nick_flood_penalty_yellow 3 "number of changes to allow before warning and movement blocking"