void CBasePlayer::Observer_SetMode( int iMode ){ // Just abort if we're changing to the mode we're already in if ( iMode == pev->iuser1 ) return; // is valid mode ? if ( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE ) iMode = OBS_IN_EYE; // now it is // if we are not roaming, we need a valid target to track if ( (iMode != OBS_ROAMING && iMode != OBS_MAP_FREE) && (m_hObserverTarget == NULL) ) { Observer_FindNextPlayer( false ); // if we didn't find a valid target switch to roaming if (m_hObserverTarget == NULL) { ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" ); iMode = OBS_ROAMING; } } // set spectator mode pev->iuser1 = iMode; // set target if not roaming if (iMode == OBS_ROAMING || iMode == OBS_MAP_FREE) pev->iuser2 = 0; else pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );}