Browse Source

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

botox
BotoX 1 year ago
parent
commit
1671ef96de
  1. 6
      src/engine/baseclientstate.cpp
  2. 4
      src/engine/cvar.cpp

6
src/engine/baseclientstate.cpp

@ -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;

4
src/engine/cvar.cpp

@ -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)

Loading…
Cancel
Save