07-29-2003, 04:09 PM
Quote:void ClientCommand( edict_t *pEntity )
{
const char *pcmd = CMD_ARGV(0);
const char *pstr;
// Is the client spawned yet?
if ( !pEntity->pvPrivateData )
 return;
entvars_t *pev = &pEntity->v;
if ( FStrEq(pcmd, "say" ) )
{
 Host_Say( pEntity, 0 );
}
else if ( FStrEq(pcmd, "say_team" ) )
{
 Host_Say( pEntity, 1 );
}
else if ( FStrEq(pcmd, "spectate" ) )
{
 // Prevent this is the cvar is set
 if ( allow_spectators.value )
 {
  CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev);
  edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer );
  pPlayer->StartObserver( VARS(pentSpawnSpot)->origin, VARS(pentSpawnSpot)->angles);
 }
}
else if ( FStrEq(pcmd, "ob_mode" ) )
{
 CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev);
 pPlayer->ObserverInput_ChangeMode();
}
else if ( FStrEq(pcmd, "ob_prev" ) )
{
 CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev);
 pPlayer->ObserverInput_PrevPlayer();
}
else if ( FStrEq(pcmd, "ob_next" ) )
{
 CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev);
 pPlayer->ObserverInput_NextPlayer();
}
else if ( FStrEq(pcmd, "give" ) )
{
 if ( g_flWeaponCheat != 0.0)
 {
  int iszItem = ALLOC_STRING( CMD_ARGV(1) ); // Make a copy of the classname
  GetClassPtr((CBasePlayer *)pev)->GiveNamedItem( STRING(iszItem) );
 }
}
else if ( FStrEq(pcmd, "drop" ) )
{
 // player is dropping an item.
 GetClassPtr((CBasePlayer *)pev)->DropPlayerItem((char *)CMD_ARGV(1));
}
else if ( FStrEq(pcmd, "fov" ) )
{
 if ( g_flWeaponCheat && CMD_ARGC() > 1)
 {
  GetClassPtr((CBasePlayer *)pev)->m_iFOV = atoi( CMD_ARGV(1) );
 }
 else
 {
  CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"fov\" is \"%d\"\n", (int)GetClassPtr((CBasePlayer *)pev)->m_iFOV ) );
 }
}
else if ( FStrEq(pcmd, "use" ) )
{
 GetClassPtr((CBasePlayer *)pev)->SelectItem((char *)CMD_ARGV(1));
}
The client is obviously issuing that command. Therefore, wtf is behind CMD_ARGV(1) ? Not sure ... but it's got to be a bad pointer of some sort. Thinking about the multiplayer game, when you are in the Towers using the guns on rc_crossfire, you aren't allowed to move, so maybe what it does is set your body mass to some high figure so you don't actually move if hit.