allow setting cheat cvars with sv_cheats 0 and mask them from the server (send default values)

This commit is contained in:
BotoX 2021-01-03 14:12:00 +01:00
parent 72b296661d
commit 1671ef96de
2 changed files with 8 additions and 2 deletions

View File

@ -1788,11 +1788,17 @@ bool CBaseClientState::ProcessGetCvarValue( SVC_GetCvarValue *msg )
const ConVar *pVar = g_pCVar->FindVar( msg->m_szCvarName );
if ( pVar )
{
ConVarRef sv_cheats( "sv_cheats" );
if ( pVar->IsFlagSet( FCVAR_SERVER_CANNOT_QUERY ) )
{
// The server isn't allowed to query this.
returnMsg.m_eStatusCode = eQueryCvarValueStatus_CvarProtected;
}
else if ( pVar->IsFlagSet( FCVAR_CHEAT ) && sv_cheats.GetBool() == 0 )
{
// Return default value if cheats are off and this is a cheat cvar
returnMsg.m_szCvarValue = pVar->GetDefault();
}
else
{
returnMsg.m_eStatusCode = eQueryCvarValueStatus_ValueIntact;

View File

@ -397,7 +397,7 @@ bool CCvarUtilities::IsCommand( const CCommand &args )
}
// Allow cheat commands in singleplayer, debug, or multiplayer with sv_cheats on
if ( v->IsFlagSet( FCVAR_CHEAT ) )
if ( v->IsFlagSet( FCVAR_CHEAT ) && false )
{
if ( !Host_IsSinglePlayerGame() && !CanCheat()
#if !defined(SWDS)
@ -529,7 +529,7 @@ bool CCvarUtilities::IsValidToggleCommand( const char *cmd )
}
// Allow cheat commands in singleplayer, debug, or multiplayer with sv_cheats on
if ( v->IsFlagSet( FCVAR_CHEAT ) )
if ( v->IsFlagSet( FCVAR_CHEAT ) && false )
{
if ( !Host_IsSinglePlayerGame() && !CanCheat()
#if !defined(SWDS) && !defined(_XBOX)