aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/client.cpp
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/game/server/client.cpp
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.tar.xz
source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/game/server/client.cpp')
-rw-r--r--mp/src/game/server/client.cpp73
1 files changed, 71 insertions, 2 deletions
diff --git a/mp/src/game/server/client.cpp b/mp/src/game/server/client.cpp
index f500ad5e..eced1df1 100644
--- a/mp/src/game/server/client.cpp
+++ b/mp/src/game/server/client.cpp
@@ -57,6 +57,60 @@ extern bool IsInCommentaryMode( void );
ConVar *sv_cheats = NULL;
+enum eAllowPointServerCommand {
+ eAllowNever,
+ eAllowOfficial,
+ eAllowAlways
+};
+
+#ifdef TF_DLL
+// The default value here should match the default of the convar
+eAllowPointServerCommand sAllowPointServerCommand = eAllowOfficial;
+#else
+eAllowPointServerCommand sAllowPointServerCommand = eAllowAlways;
+#endif // TF_DLL
+
+void sv_allow_point_servercommand_changed( IConVar *pConVar, const char *pOldString, float flOldValue )
+{
+ ConVarRef var( pConVar );
+ if ( !var.IsValid() )
+ {
+ return;
+ }
+
+ const char *pNewValue = var.GetString();
+ if ( V_strcasecmp ( pNewValue, "always" ) == 0 )
+ {
+ sAllowPointServerCommand = eAllowAlways;
+ }
+#ifdef TF_DLL
+ else if ( V_strcasecmp ( pNewValue, "official" ) == 0 )
+ {
+ sAllowPointServerCommand = eAllowOfficial;
+ }
+#endif // TF_DLL
+ else
+ {
+ sAllowPointServerCommand = eAllowNever;
+ }
+}
+
+ConVar sv_allow_point_servercommand ( "sv_allow_point_servercommand",
+#ifdef TF_DLL
+ // The default value here should match the default of the convar
+ "official",
+#else
+ // Other games may use this in their official maps, and only TF exposes IsValveMap() currently
+ "always",
+#endif // TF_DLL
+ FCVAR_NONE,
+ "Allow use of point_servercommand entities in map. Potentially dangerous for untrusted maps.\n"
+ " disallow : Always disallow\n"
+#ifdef TF_DLL
+ " official : Allowed for valve maps only\n"
+#endif // TF_DLL
+ " always : Allow for all maps", sv_allow_point_servercommand_changed );
+
void ClientKill( edict_t *pEdict, const Vector &vecForce, bool bExplode = false )
{
CBasePlayer *pPlayer = static_cast<CBasePlayer*>( GetContainingEntity( pEdict ) );
@@ -569,7 +623,22 @@ void CPointServerCommand::InputCommand( inputdata_t& inputdata )
if ( !inputdata.value.String()[0] )
return;
- engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) );
+ bool bAllowed = ( sAllowPointServerCommand == eAllowAlways );
+#ifdef TF_DLL
+ if ( sAllowPointServerCommand == eAllowOfficial )
+ {
+ bAllowed = TFGameRules() && TFGameRules()->IsValveMap();
+ }
+#endif // TF_DLL
+
+ if ( bAllowed )
+ {
+ engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) );
+ }
+ else
+ {
+ Warning( "point_servercommand usage blocked by sv_allow_point_servercommand setting\n" );
+ }
}
BEGIN_DATADESC( CPointServerCommand )
@@ -600,7 +669,7 @@ void CC_DrawLine( const CCommand &args )
static ConCommand drawline("drawline", CC_DrawLine, "Draws line between two 3D Points.\n\tGreen if no collision\n\tRed is collides with something\n\tArguments: x1 y1 z1 x2 y2 z2", FCVAR_CHEAT);
//------------------------------------------------------------------------------
-// Purpose : Draw a cross at a points.
+// Purpose : Draw a cross at a points.
// Input :
// Output :
//------------------------------------------------------------------------------