2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-28 03:35:19 +01:00

engine: server: add cvar to not expose current player list, or if server has a password

This commit is contained in:
Alibek Omarov 2024-07-07 01:59:56 +03:00
parent a0b72d3995
commit 7d0467863c
3 changed files with 5 additions and 2 deletions

View File

@ -468,6 +468,7 @@ extern convar_t sv_log_outofband;
extern convar_t sv_allow_autoaim;
extern convar_t sv_aim;
extern convar_t sv_allow_testpacket;
extern convar_t sv_expose_player_list;
//===========================================================
//

View File

@ -147,8 +147,8 @@ CVAR_DEFINE_AUTO( sv_userinfo_penalty_multiplier, "2", FCVAR_ARCHIVE, "penalty t
CVAR_DEFINE_AUTO( sv_userinfo_penalty_attempts, "4", FCVAR_ARCHIVE, "if max attempts count was exceeded, penalty time will be increased" );
CVAR_DEFINE_AUTO( sv_fullupdate_penalty_time, "1", FCVAR_ARCHIVE, "allow fullupdate command only once in this timewindow (set 0 to disable)" );
CVAR_DEFINE_AUTO( sv_log_outofband, "0", FCVAR_ARCHIVE, "log out of band messages, can be useful for server admins and for engine debugging" );
CVAR_DEFINE_AUTO( sv_allow_testpacket, "1", FCVAR_ARCHIVE, "allow generating and sending a big blob of data to test maximum packet size" );
CVAR_DEFINE_AUTO( sv_expose_player_list, "1", FCVAR_ARCHIVE, "expose player list through packets that don't require connection" );
//============================================================================
/*
@ -973,6 +973,7 @@ void SV_Init( void )
Cvar_RegisterVariable( &sv_fullupdate_penalty_time );
Cvar_RegisterVariable( &sv_log_outofband );
Cvar_RegisterVariable( &sv_allow_testpacket );
Cvar_RegisterVariable( &sv_expose_player_list );
// when we in developer-mode automatically turn cheats on
if( host_developer.value ) Cvar_SetValue( "sv_cheats", 1.0f );

View File

@ -129,7 +129,8 @@ static void SV_SourceQuery_Players( netadr_t from )
SV_GetPlayerCount( &client_count, &bot_count );
client_count += bot_count; // bots are counted as players in this reply
if( client_count <= 0 )
// respect players privacy
if( client_count <= 0 || !sv_expose_player_list.value || !COM_CheckStringEmpty( sv_password.string ))
return;
MSG_Init( &buf, "TSourceEngineQueryPlayers", answer, sizeof( answer ));