Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
server crash bug
#8
Well here's the entire function I was looking at.
Code:
void CDiscArena::CountDownThink( void )
{
    // Freeze everyone until there's 3 seconds to go
    if ( m_iSecondsTillStart == 3 )
    {
 for ( int i = 0; i < (m_iPlayersPerTeam * 2); i++ )
 {
 &nbsp;&nbsp;&nbsp;&nbsp;//.ASM : white disc haxxx...
 &nbsp;&nbsp;&nbsp;&nbsp;// if the player is "dead" during the round countdown,
 &nbsp;&nbsp;&nbsp;&nbsp;// then bring the bastard back...
 &nbsp;&nbsp;&nbsp;&nbsp;if(!m_hCombatants[i]->IsAlive())
   m_hCombatants[i]->Spawn();
 &nbsp;&nbsp;&nbsp;&nbsp;// end .ASM

 &nbsp;&nbsp;&nbsp;&nbsp;if (m_hCombatants[i])
   ((CBaseEntity*)m_hCombatants[i])->pev->maxspeed = 320;
 }
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;m_iSecondsTillStart--;

&nbsp;&nbsp;&nbsp;&nbsp;// Play countdown VOX
&nbsp;&nbsp;&nbsp;&nbsp;if (m_iSecondsTillStart < 5)
&nbsp;&nbsp;&nbsp;&nbsp;{
 // Speech
 for ( int i = 0; i < (m_iPlayersPerTeam * 2); i++ )
 {
 &nbsp;&nbsp;&nbsp;&nbsp;if (m_hCombatants[i])
   ((CBasePlayer*)(CBaseEntity*)m_hCombatants[i])->ClientHearVox( g_szCountDownVox[ m_iSecondsTillStart ] );
 }
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;// Send the message to the clients in the arena
&nbsp;&nbsp;&nbsp;&nbsp;for ( int i = 1; i <= gpGlobals->maxClients; i++ )
&nbsp;&nbsp;&nbsp;&nbsp;{
 CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );

 if (pPlayer &amp;&amp; (pPlayer->pev->groupinfo &amp; pev->groupinfo) &amp;&amp; pPlayer->m_bHasDisconnected != TRUE)
 {
 &nbsp;&nbsp;&nbsp;&nbsp;MESSAGE_BEGIN( MSG_ONE, gmsgStartRnd, NULL, pPlayer->edict() );
   WRITE_BYTE( m_iCurrRound );
   WRITE_BYTE( m_iSecondsTillStart );
   WRITE_BYTE( 0 );
 &nbsp;&nbsp;&nbsp;&nbsp;MESSAGE_END();
 }
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;if (m_iSecondsTillStart)
&nbsp;&nbsp;&nbsp;&nbsp;{
 pev->nextthink = gpGlobals->time + 1.0;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;{
 m_iArenaState = ARENA_BATTLE_IN_PROGRESS;

 // Enable powerups
 CBaseEntity *pFunc = NULL;
 while ((pFunc = UTIL_FindEntityByClassname( pFunc, "item_powerup" )) != NULL)
 {
 &nbsp;&nbsp;&nbsp;&nbsp;((CDiscwarPowerup*)pFunc)->Enable();
 }

 pev->nextthink = gpGlobals->time + 1.0;
 SetThink( BattleThink );
&nbsp;&nbsp;&nbsp;&nbsp;}
}



Could just add the disconnect check to the one? Its been awhile since my C++ class but.

Code:
if(!m_hCombatants[i]->IsAlive() &amp;&amp; m_bHasDisconnected != TRUE)
m_hCombatants[i]->Spawn();
// end .ASM


That should work? Think they both would work :P


EDIT*
Code:
// Freeze everyone until there's 3 seconds to go
&nbsp;&nbsp;&nbsp;&nbsp;if ( m_iSecondsTillStart == 3 )
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;for ( int i = 0; i < (m_iPlayersPerTeam * 2); i++ )
&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CBasePlayer *pPlayer = ((CBasePlayer*)(CBaseEntity*)m_hCombatants[i]);

&nbsp;//.ASM : white disc haxxx...
&nbsp;// if the player is "dead" during the round countdown,
&nbsp;// then bring the bastard back...
&nbsp;if(!m_hCombatants[i]->IsAlive() &amp;&amp; pPlayer->m_bHasDisconnected != TRUE)

&nbsp; m_hCombatants[i]->Spawn();
&nbsp;// end .ASM
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_hCombatants[i])
&nbsp; &nbsp;((CBaseEntity*)m_hCombatants[i])->pev->maxspeed = 320;
&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}


Edited again. Had the wrong For statement :P
&lt;@Miagi&gt; !8 Am I spamming?
&lt;@ChanServ&gt; Miagi: Yes.
&lt;@Miagi&gt; !8 Should I stop?
&lt;@ChanServ&gt; Miagi: Oh, please, PLEASE, make it stop!

Reply


Messages In This Thread
server crash bug - by _Acid_Head_ - 09-25-2004, 12:11 AM
server crash bug - by FuzzyShoting - 09-25-2004, 04:28 AM
server crash bug - by _Acid_Head_ - 09-25-2004, 06:44 AM
server crash bug - by jabbahunt - 09-25-2004, 07:26 AM
server crash bug - by Gwarsbane - 09-25-2004, 09:59 AM
server crash bug - by Miagi - 09-25-2004, 10:38 AM
server crash bug - by kermit - 09-25-2004, 03:05 PM
server crash bug - by Miagi - 09-25-2004, 03:31 PM
server crash bug - by Miagi - 09-25-2004, 04:24 PM
server crash bug - by kermit - 09-25-2004, 04:36 PM
server crash bug - by kermit - 09-25-2004, 04:39 PM
server crash bug - by RushJet1 - 09-25-2004, 08:55 PM
server crash bug - by _Acid_Head_ - 09-25-2004, 09:38 PM
server crash bug - by GRITS - 09-25-2004, 09:43 PM
server crash bug - by _Acid_Head_ - 09-25-2004, 09:51 PM
server crash bug - by Miagi - 09-25-2004, 10:34 PM
server crash bug - by Pique - 09-27-2004, 02:34 PM
server crash bug - by kermit - 09-27-2004, 04:47 PM
server crash bug - by _Acid_Head_ - 09-28-2004, 04:31 PM
server crash bug - by RushJet1 - 09-28-2004, 05:28 PM
server crash bug - by Guest - 09-28-2004, 06:29 PM
server crash bug - by _Acid_Head_ - 09-28-2004, 07:40 PM
server crash bug - by enzymo - 10-02-2004, 06:01 AM
server crash bug - by Miagi - 10-10-2004, 03:15 PM
server crash bug - by Miagi - 11-06-2004, 06:37 PM
server crash bug - by Pique - 11-06-2004, 10:34 PM
server crash bug - by Miagi - 11-06-2004, 10:54 PM
server crash bug - by kermit - 11-07-2004, 04:49 AM
server crash bug - by FuzzyShoting - 11-07-2004, 05:19 AM
server crash bug - by Guest - 11-21-2004, 06:32 AM
server crash bug - by Miagi - 11-21-2004, 02:03 PM
server crash bug - by Miagi - 11-21-2004, 03:23 PM
server crash bug - by Miagi - 11-21-2004, 03:51 PM
server crash bug - by Pique - 11-21-2004, 04:24 PM
server crash bug - by GRITS - 11-21-2004, 08:29 PM
server crash bug - by Miagi - 11-22-2004, 05:03 PM
server crash bug - by evil_admin - 11-22-2004, 05:28 PM
server crash bug - by Miagi - 11-22-2004, 05:47 PM
server crash bug - by Miagi - 11-27-2004, 02:14 PM
server crash bug - by evil_admin - 11-27-2004, 02:32 PM
server crash bug - by Miagi - 11-28-2004, 12:50 AM
server crash bug - by Miagi - 02-11-2005, 10:26 PM
server crash bug - by Miagi - 04-01-2005, 10:56 PM
server crash bug - by GRITS - 04-02-2005, 12:58 AM
server crash bug - by Miagi - 04-02-2005, 12:01 PM
server crash bug - by NITRO! - 04-02-2005, 12:02 PM

Forum Jump:


Users browsing this thread: 14 Guest(s)