Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Respawn Kill
#1
Code:
void CDisc::DiscTouch ( CBaseEntity *pOther )
{
    // Push players backwards
    if ( pOther->IsPlayer() )
    {
 if ( ((CBaseEntity*)m_hOwner) == pOther )
 {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_fDontTouchOwner < gpGlobals->time)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;// Play catch sound
&nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));

&nbsp; &nbsp;ReturnToThrower();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;
&nbsp;}
&nbsp;else if ( m_fDontTouchEnemies < gpGlobals->time)
&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( pev->team != pOther->pev->team )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;((CBasePlayer*)pOther)->m_LastHitGroup = HITGROUP_GENERIC;

&nbsp; &nbsp;// Do freeze seperately so you can freeze and shatter a person with a single shot
&nbsp; &nbsp;if ( m_iPowerupFlags &amp; POW_FREEZE &amp;&amp; ((CBasePlayer*)pOther)->m_iFrozen == FALSE )
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Freeze the player and make them glow blue
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->Freeze();

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// If it's not a decap, return now. If it's a decap, continue to shatter
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( !m_bDecapitate )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp; &nbsp;m_fDontTouchEnemies = gpGlobals->time + 2.0;
&nbsp; &nbsp; &nbsp;return;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp; &nbsp;}

&nbsp; &nbsp;// Decap or push
&nbsp; &nbsp;if (m_bDecapitate)
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Decapitate!
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( m_bTeleported )
&nbsp; &nbsp; &nbsp;((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->Decapitate( ((CBaseEntity*)m_hOwner)->pev );

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fDontTouchEnemies = gpGlobals->time + 0.5;
&nbsp; &nbsp;}
&nbsp; &nbsp;else
&nbsp; &nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Play thwack sound
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch( RANDOM_LONG(0,2) )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2:
&nbsp; &nbsp; &nbsp;EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
&nbsp; &nbsp; &nbsp;break;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Push the player
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector vecDir = pev->velocity.Normalize();
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pOther->pev->flags &amp;= ~FL_ONGROUND;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Shield flash only if the player isnt frozen
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( ((CBasePlayer*)pOther)->m_iFrozen == false )
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp; &nbsp; &nbsp;pOther->pev->renderfx = kRenderFxGlowShell;
&nbsp; &nbsp; &nbsp;pOther->pev->rendercolor.x = 255;
&nbsp; &nbsp; &nbsp;pOther->pev->renderamt = 150;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_hLastPlayerToHitMe = m_hOwner;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_flLastDiscHit = gpGlobals->time;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CBasePlayer*)pOther)->m_flLastDiscBounces = m_iBounces;
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( m_bTeleported )
&nbsp; &nbsp; &nbsp;((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;

&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fDontTouchEnemies = gpGlobals->time + 2.0;
&nbsp; &nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}

Hmm. Seems to me that the else if ( m_fDontTouchEnemies &lt; gpGlobals-&gt;time) also needs to check if a player is dead, since they shouldn't be touched either. Don't know if that has been cured already?:)
Reply


Messages In This Thread
Respawn Kill - by Guest - 07-29-2003, 03:48 PM
Respawn Kill - by Guest - 07-29-2003, 03:52 PM
Respawn Kill - by evil_admin - 07-29-2003, 09:42 PM
Respawn Kill - by Guest - 07-30-2003, 02:22 AM
Respawn Kill - by kermit - 08-09-2003, 10:55 PM
Respawn Kill - by Gwarsbane - 08-09-2003, 11:20 PM
Respawn Kill - by kermit - 08-09-2003, 11:49 PM
Respawn Kill - by kermit - 08-10-2003, 01:28 AM
Respawn Kill - by Guest - 08-10-2003, 10:19 AM

Forum Jump:


Users browsing this thread: 5 Guest(s)