From c554eef3b9a9263fd3b9f1ca6fa9be1a8e1d1863 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 9 Jul 2025 17:44:13 +0500 Subject: [PATCH] engine: client: add ability to disable prepending [Xash3D] tag to the nickname when connecting to GoldSrc servers --- engine/client/cl_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 7796d23d..9a109bbf 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -97,6 +97,7 @@ static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FI CVAR_DEFINE_AUTO( rate, "25000", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" ); static CVAR_DEFINE_AUTO( cl_ticket_generator, "revemu2013", FCVAR_ARCHIVE, "you wouldn't steal a car" ); +static CVAR_DEFINE_AUTO( cl_advertise_engine_in_name, "1", FCVAR_ARCHIVE|FCVAR_PRIVILEGED, "add [Xash3D] to the nickname when connecting to GoldSrc servers" ); client_t cl; client_static_t cls; @@ -1097,7 +1098,7 @@ static void CL_SendConnectPacket( connprotocol_t proto, int challenge ) Info_RemoveKey( cls.userinfo, "cl_maxpayload" ); name = Info_ValueForKey( cls.userinfo, "name" ); - if( Q_strnicmp( name, "[Xash3D]", 8 )) + if( cl_advertise_engine_in_name.value && Q_strnicmp( name, "[Xash3D]", 8 )) Info_SetValueForKeyf( cls.userinfo, "name", sizeof( cls.userinfo ), "[Xash3D]%s", name ); MSG_Init( &send, "GoldSrcConnect", send_buf, sizeof( send_buf )); @@ -3042,9 +3043,8 @@ void CL_UpdateInfo( const char *key, const char *value ) MSG_WriteString( &cls.netchan.message, cls.userinfo ); break; case PROTO_GOLDSRC: - if( !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 )) + if( cl_advertise_engine_in_name.value && !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 )) { - // always prepend [Xash3D] on GoldSrc protocol :) CL_ServerCommand( true, "setinfo \"%s\" \"[Xash3D]%s\"\n", key, value ); break; } @@ -3359,6 +3359,7 @@ static void CL_InitLocal( void ) cl.resourcesonhand.pNext = cl.resourcesonhand.pPrev = &cl.resourcesonhand; Cvar_RegisterVariable( &cl_ticket_generator ); + Cvar_RegisterVariable( &cl_advertise_engine_in_name ); Cvar_RegisterVariable( &showpause ); Cvar_RegisterVariable( &mp_decals );