The sprinting code is untouched.

Yes, I do respawn the players.  I'd like to note that I've only seen
this happen to living players.. due to the fact that the game crashes
when a player dies in debug mode -- it has an invalid velocity upon
death for some reason I've yet to debug out.  The code for resetting the
world is as follows (this is taken from
http://www.sourcewiki.org/wiki/index.php/Resetting_the_Map, with some
changes):

void CHL2MPRules::ResetWorld() {
      m_bInRestart = true;
      CBaseEntity *pEnt, *tmpEnt;

      pEnt = gEntList.FirstEnt();
      CBaseCombatWeapon *weap;
      string name;

      while (pEnt != NULL) {
          name = pEnt->GetClassname();
          if( name.rfind("weapon_") != string::npos ||
name.rfind("gear_") != string::npos ) {
              weap = (CBaseCombatWeapon *)pEnt;
              if( weap && weap->GetOwner() ) { // It's equipped, so
save it
                  pEnt = gEntList.NextEnt( pEnt );
              }
              else {
                  tmpEnt = gEntList.NextEnt( pEnt );
                  UTIL_Remove( pEnt );
                  pEnt = tmpEnt;
              }
          }
          else if (filter.ShouldCreateEntity (pEnt->GetClassname() ) )
          {
              // if we don't need to keep the entity, we remove it from
the list
              tmpEnt = gEntList.NextEnt (pEnt);
              UTIL_Remove (pEnt);
              pEnt = tmpEnt;
          }              else
          {
              // if we need to keep it, we move on to the next entity
              pEnt = gEntList.NextEnt (pEnt);
          }
      }
      gEntList.CleanupDeleteList();

      // with any unrequired entities removed, we use
MapEntity_ParseAllEntities to reparse the map entities
      // this in effect causes them to spawn back to their normal
position.
      MapEntity_ParseAllEntities( engine->GetMapEntitiesString(),
&filter, true);

      // print a message to all clients telling them that the round is
restarting
      UTIL_ClientPrintAll( HUD_PRINTCENTER, "Round restarting..." );

      g_pLastSpawn = NULL;

      // now we've got all our entities back in place and looking
pretty, we need to respawn all the players
      for (int i = 1; i <= gpGlobals->maxClients; i++ )
      {
          CBaseEntity *plr = UTIL_PlayerByIndex( i );

          if ( plr )
          {
              plr->Spawn();
          } else {
              break;
          }
      }

      m_flIntermissionEndTime = 0.0f;
      m_bInRestart = false;
}

m_bInRestart is only used for checking when the player is allowed to
spawn, to make sure they don't respawn in the middle of a round.

Thanks,
  -- Andrew Orner

Jason Houston wrote:
--
[ Picked text/plain from multipart/alternative ]
Can you paste a snippet, we can't see how everything interacts.

Whatever needs reseting would probably be reset when you respawn the
players(you do that, right? not just teleport them?). If not, take a look at
all the checks on those things, and see what might not be reset, then add
something to your spawn or whatever function to reset them.

But yes, paste a snippet, it's not like we want to steal your code :) The
resetting function and your sprint ones would be nice.

--
Draco
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to