void CHornet :: OnTeleport( void ) { MESSAGE_BEGIN( MSG_ALL, SVC_TEMPENTITY ); WRITE_BYTE( TE_KILLBEAM ); WRITE_ENTITY( entindex() ); MESSAGE_END(); IgniteTrail(); }
void CShambler :: CastLightning( void ) { if( !m_iAttackCount ) { // plays a ligtning sound EMIT_SOUND( edict(), CHAN_WEAPON, "shambler/sboom.wav", 1.0, ATTN_NORM ); } if( pev->owner ) { // remove lightning (if present) CBaseEntity *pLightning = CBaseEntity::Instance( pev->owner ); if( pLightning ) UTIL_Remove( pLightning ); pev->owner = NULL; } if( m_iAttackCount > 2 && g_iSkillLevel != SKILL_NIGHTMARE ) return; if (m_hEnemy == NULL) return; pev->effects |= EF_MUZZLEFLASH; m_iAttackCount++; // count shoots AI_Face (); // Lightning bolt effect TraceResult trace; Vector vecOrg = pev->origin + Vector(0,0,40); // adjust lightning origin Vector vecDir = (m_hEnemy->pev->origin + Vector(0,0,16) - vecOrg).Normalize(); UTIL_TraceLine( vecOrg, pev->origin + vecDir * 600, ignore_monsters, ENT(pev), &trace ); MESSAGE_BEGIN( MSG_BROADCAST, gmsgTempEntity ); WRITE_BYTE( TE_LIGHTNING1 ); WRITE_ENTITY( entindex() ); WRITE_COORD( vecOrg.x ); WRITE_COORD( vecOrg.y ); WRITE_COORD( vecOrg.z ); WRITE_COORD( trace.vecEndPos.x ); WRITE_COORD( trace.vecEndPos.y ); WRITE_COORD( trace.vecEndPos.z ); MESSAGE_END(); // Do damage CBasePlayer::LightningDamage(pev->origin, trace.vecEndPos, this, 10, vecDir ); }
void Message::Send() { msgparam *pParam = NULL; for (size_t i=1; i<=m_CurParam; i++) { pParam = m_Params[i]; switch (pParam->type) { case arg_byte: WRITE_BYTE(pParam->v.iData); break; case arg_char: WRITE_CHAR(pParam->v.iData); break; case arg_short: WRITE_SHORT(pParam->v.iData); break; case arg_long: WRITE_LONG(pParam->v.iData); break; case arg_angle: WRITE_ANGLE(pParam->v.fData); break; case arg_coord: WRITE_COORD(pParam->v.fData); break; case arg_string: WRITE_STRING(pParam->szData.chars()); break; case arg_entity: WRITE_ENTITY(pParam->v.iData); break; } } }
void CGrenade::C4Think( void ) { if( !IsInWorld() ) { UTIL_Remove( this ); return; } pev->nextthink = gpGlobals->time + 0.12; if( m_flNextFreq <= gpGlobals->time ) { m_flNextFreq = gpGlobals->time + m_flNextFreqInterval; m_flNextFreqInterval *= 0.9; switch( m_iC4Beep ) { case 0 : { m_flAttenu = 1.5; m_sBeepName = "weapons/c4_beep1.wav"; if( UTIL_IsGame( "czero" ) ) { MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 1 ); WRITE_STRING( "bombticking" ); WRITE_BYTE( 255 ); WRITE_SHORT( 140 ); WRITE_SHORT( 0 ); MESSAGE_END(); } break; } case 1 : { m_flAttenu = 1.0; m_sBeepName = "weapons/c4_beep2.wav"; if( UTIL_IsGame( "czero" ) ) { MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 1 ); WRITE_STRING( "bombticking" ); WRITE_BYTE( 255 ); WRITE_SHORT( 70 ); WRITE_SHORT( 0 ); MESSAGE_END(); } break; } case 2 : { m_flAttenu = 0.8; m_sBeepName = "weapons/c4_beep3.wav"; if( UTIL_IsGame( "czero" ) ) { MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 1 ); WRITE_STRING( "bombticking" ); WRITE_BYTE( 255 ); WRITE_SHORT( 40 ); WRITE_SHORT( 0 ); MESSAGE_END(); } break; } case 3 : { m_flAttenu = 0.5; m_sBeepName = "weapons/c4_beep4.wav"; if( UTIL_IsGame( "czero" ) ) { MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 1 ); WRITE_STRING( "bombticking" ); WRITE_BYTE( 255 ); WRITE_SHORT( 30 ); WRITE_SHORT( 0 ); MESSAGE_END(); } break; } case 4 : { m_flAttenu = 0.2; m_sBeepName = "weapons/c4_beep5.wav"; if( UTIL_IsGame( "czero" ) ) { MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 1 ); WRITE_STRING( "bombticking" ); WRITE_BYTE( 255 ); WRITE_SHORT( 20 ); WRITE_SHORT( 0 ); MESSAGE_END(); } break; } } ++m_iC4Beep; } if( m_flNextBeep <= gpGlobals->time ) { m_flNextBeep = gpGlobals->time + 1.4; EMIT_SOUND( ENT( pev ), CHAN_VOICE, m_sBeepName, VOL_NORM, m_flAttenu ); // TODO: Adds support for bots. // TheBots->OnEvent( EVENT_BOMB_BEEP, this, NULL ); } if( m_flNextBlink <= gpGlobals->time ) { m_flNextBlink = gpGlobals->time + 2.0; MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_GLOWSPRITE ); WRITE_COORD( pev->origin.x ); WRITE_COORD( pev->origin.y ); WRITE_COORD( pev->origin.z + 5.0 ); WRITE_SHORT( g_sModelIndexC4Glow ); WRITE_BYTE( 1 ); WRITE_BYTE( 3 ); WRITE_BYTE( 255 ); MESSAGE_END(); } if( m_flC4Blow <= gpGlobals->time ) { // TODO: Adds support for bots. // TheBots->OnEvent( EVENT_BOMB_EXPLODED, NULL, NULL ); MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 0 ); MESSAGE_END(); if( m_pentCurBombTarget ) { CBaseEntity *pEntity = CBaseEntity::Instance( m_pentCurBombTarget->pev ); if( pEntity ) { CBaseEntity* pPlayer = CBaseEntity::Instance( pev->owner ); if( pPlayer ) { pEntity->Use( pPlayer, this, USE_TOGGLE, 0 ); } } } CBasePlayer* pPlayer = (CBasePlayer *)CBaseEntity::Instance( pev->owner ); if( pPlayer ) { pPlayer->pev->frags += 3; } MESSAGE_BEGIN( MSG_ALL, gmsgBombPickup ); MESSAGE_END(); g_pGameRules->m_fBombDropped = FALSE; if( pev->waterlevel ) UTIL_Remove( this ); else SetThink( &CGrenade::Detonate2 ); } if( m_fStartDefuse ) { CBasePlayer* pDefuser = (CBasePlayer *)((CBaseEntity *)m_hDefuser); if( pDefuser && m_flDefuseCountDown > gpGlobals->time ) { BOOL isOnGround = !!( pDefuser->pev->flags & FL_ONGROUND ); if( m_flNextDefuseTime < gpGlobals->time || !isOnGround ) { if( !isOnGround ) { ClientPrint( m_hDefuser->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground" ); } pDefuser->ResetMaxSpeed(); pDefuser->SetProgressBarTime( 0 ); pDefuser->m_fBombDefusing = FALSE; m_fStartDefuse = FALSE; m_flDefuseCountDown = 0.0; // TODO: Adds support for bots. // TheBots->OnEvent( EVENT_DEFUSE_ABORTED, NULL, NULL ); } } else { // TODO: Adds support for bots. // TheBots->OnEvent( EVENT_BOMB_DEFUSED, pDefuser, NULL ); Broadcast( "BOMBDEF" ); MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR ); WRITE_BYTE( 9 ); WRITE_BYTE( DRC_CMD_EVENT ); WRITE_SHORT( ENTINDEX( this->edict() ) ); WRITE_SHORT( NULL ); WRITE_ENTITY( DRC_FLAG_FINAL | DRC_FLAG_FACEPLAYER | DRC_FLAG_DRAMATIC | 15 ); MESSAGE_END(); UTIL_LogPrintf( "\"%s<%i><%s><CT>\" triggered \"Defused_The_Bomb\"\n", STRING( pDefuser->pev->netname ), GETPLAYERAUTHID( pDefuser->edict() ), GETPLAYERUSERID( pDefuser->edict() ) ); UTIL_EmitAmbientSound( ENT( pev ), pev->origin, "weapons/c4_beep5.wav", 0, ATTN_NONE, SND_STOP, 0 ); EMIT_SOUND( ENT( pDefuser->pev ), CHAN_WEAPON, "weapons/c4_disarmed.wav", 0.8, ATTN_NORM ); UTIL_Remove( this ); m_fJustBlew = TRUE; pDefuser->ResetMaxSpeed(); pDefuser->m_fBombDefusing = FALSE; MESSAGE_BEGIN( MSG_ALL, gmsgScenarioIcon ); WRITE_BYTE( 0 ); MESSAGE_END(); if( g_pGameRules->IsCareer() ) { // TODO: Adds support for bots. //TheCareerTasks->HandleEvents( EVEN_BOMB_DEFUSED, pDefuser, NULL ); } g_pGameRules->m_bBombDefused = TRUE; g_pGameRules->CheckWinConditions(); pDefuser->pev->frags += 3; MESSAGE_BEGIN( MSG_ALL, gmsgBombPickup ); MESSAGE_END(); g_pGameRules->m_fBombDropped = FALSE; m_fStartDefuse = FALSE; } } }
void CGrenade::Explode2( TraceResult* pTrace, int bitsDamageType ) { pev->model = iStringNull; // invisible pev->solid = SOLID_NOT; // intangible pev->takedamage = DAMAGE_NO; UTIL_ScreenShake( pTrace->vecEndPos, 25.0, 150.0, 1.0, 3000.0 ); g_pGameRules->m_bTargetBombed = true; if( g_pGameRules->IsCareer() ) { // TODO: implements this. // TheCareerTasks->LatchRoundEndMessage(); } m_fJustBlew = TRUE; g_pGameRules->CheckWinConditions(); if( pTrace->flFraction != 1.0 ) { pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * ( pev->dmg - 24 ) * 0.6 ); } bool isInWater = UTIL_PointContents( pev->origin ) == CONTENTS_WATER; MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_SPRITE ); WRITE_COORD( pev->origin.x ); WRITE_COORD( pev->origin.y ); WRITE_COORD( pev->origin.z - 10.0 ); WRITE_SHORT( g_sModelIndexFireball3 ); WRITE_BYTE( ( pev->dmg - 275 ) * 0.6 ); WRITE_BYTE( 150 ); MESSAGE_END(); MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_SPRITE ); WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -10, 10 ) ); WRITE_SHORT( g_sModelIndexFireball2 ); WRITE_BYTE( ( pev->dmg - 275 ) * 0.6 ); WRITE_BYTE( 150 ); MESSAGE_END(); MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_SPRITE ); WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -10, 10 ) ); WRITE_SHORT( g_sModelIndexFireball3 ); WRITE_BYTE( ( pev->dmg - 275 ) * 0.6 ); WRITE_BYTE( 150 ); MESSAGE_END(); MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_SPRITE ); WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -512, 512 ) ); WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -10, 10 ) ); WRITE_SHORT( g_sModelIndexFireball ); WRITE_BYTE( ( pev->dmg - 275 ) * 0.6 ); WRITE_BYTE( 150 ); MESSAGE_END(); EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25 ); CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 ); entvars_t *pevOwner; if ( pev->owner ) pevOwner = VARS( pev->owner ); else pevOwner = NULL; pev->owner = NULL; // Can't traceline attack owner if this is set. // TODO: Fix me. //RadiusDamage( pev, pevOwner, pev->dmg, g_pGameRules->m_flBombRadius, CLASS_NONE, bitsDamageType ); if( g_pGameRules->IsCareer() ) { // TODO: implements this. // TheCareerTasks->UnlatchRoundEndMessage(); } MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR ); WRITE_BYTE( 9 ); WRITE_BYTE( DRC_CMD_EVENT ); WRITE_SHORT( ENTINDEX( this->edict() ) ); WRITE_SHORT( NULL ); WRITE_ENTITY( DRC_FLAG_FINAL | 15 ); MESSAGE_END(); UTIL_DecalTrace( pTrace, RANDOM_FLOAT( 0 , 1 ) < 0.5 ? DECAL_SCORCH1 : DECAL_SCORCH2 ); switch ( RANDOM_LONG( 0, 2 ) ) { case 0: EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris1.wav", 0.55, ATTN_NORM ); break; case 1: EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris2.wav", 0.55, ATTN_NORM ); break; case 2: EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris3.wav", 0.55, ATTN_NORM ); break; } pev->effects |= EF_NODRAW; SetThink( &CGrenade::Smoke2 ); pev->velocity = g_vecZero; pev->nextthink = gpGlobals->time + 0.85; if( !isInWater ) { int sparkCount = RANDOM_LONG( 0, 3 ); for( int i = 0; i < sparkCount; i++ ) { Create( "spark_shower", pev->origin, pTrace->vecPlaneNormal, NULL ); } } }
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */ { WRITE_ENTITY(params[1]); return 1; }