Skip to content

Commit ddd20da

Browse files
committed
fix: add missing exploit fix for tf player
this was in CSGO and other games
1 parent 8d7fa0f commit ddd20da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/game/server/tf/tf_player.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3077,6 +3077,8 @@ void CTFPlayer::Precache()
30773077
BaseClass::Precache();
30783078
}
30793079

3080+
ConVar sv_max_usercmd_future_ticks( "sv_max_usercmd_future_ticks", "8", 0, "Prevents clients from running usercmds too far in the future." );
3081+
30803082
//-----------------------------------------------------------------------------
30813083
// Purpose: Allow pre-frame adjustments on the player
30823084
//-----------------------------------------------------------------------------
@@ -3089,6 +3091,14 @@ void CTFPlayer::PlayerRunCommand( CUserCmd *ucmd, IMoveHelper *moveHelper )
30893091
if ( !sv_runcmds.GetInt() )
30903092
return;
30913093

3094+
// don't run commands in the future
3095+
if ( !IsEngineThreaded() &&
3096+
( ucmd->tick_count > (gpGlobals->tickcount + sv_max_usercmd_future_ticks.GetInt() ) ) )
3097+
{
3098+
DevMsg( "Client cmd out of sync (delta %i).\n", ucmd->tick_count - gpGlobals->tickcount );
3099+
return;
3100+
}
3101+
30923102
if ( m_Shared.InCond( TF_COND_HALLOWEEN_KART ) )
30933103
{
30943104
m_Shared.CreateVehicleMove( gpGlobals->frametime, ucmd );

0 commit comments

Comments
 (0)