Allow 'team spectator' during demo playback to exit follow mode

Previously all team changes were blocked during demo playback.
Now 'team spectator' (or 'team s') is allowed — it calls
StopFollowing to return to free camera. All other team changes
remain blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-24 02:42:23 +08:00
parent 8388292198
commit 40d077fe17

View file

@ -661,9 +661,17 @@ void Cmd_Team_f( gentity_t *ent ) {
int oldTeam; int oldTeam;
char s[MAX_TOKEN_CHARS]; char s[MAX_TOKEN_CHARS];
// demo playback: spectators only // demo playback: only allow "team spectator" (to exit follow mode)
if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) { if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) {
trap_SendServerCommand( ent-g_entities, "print \"Team changes disabled during demo playback.\n\"" ); char s2[MAX_TOKEN_CHARS];
if ( trap_Argc() == 2 ) {
trap_Argv( 1, s2, sizeof(s2) );
if ( !Q_stricmp( s2, "spectator" ) || !Q_stricmp( s2, "s" ) ) {
StopFollowing( ent );
return;
}
}
trap_SendServerCommand( ent-g_entities, "print \"Only spectating allowed during demo playback.\n\"" );
return; return;
} }