void CWeaponAWP::SecondaryAttack() { #ifndef CLIENT_DLL CMomentumPlayer *pPlayer = GetPlayerOwner(); if (pPlayer == nullptr) { Assert(pPlayer != nullptr); return; } if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV()) { pPlayer->SetFOV(pPlayer, 40, 0.15f); } else if (pPlayer->GetFOV() == 40) { pPlayer->SetFOV(pPlayer, 10, 0.08f); } else { pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV(), 0.1f); } //pPlayer->ResetMaxSpeed(); #endif #ifndef CLIENT_DLL // If this isn't guarded, the sound will be emitted twice, once by the server and once by the client. // Let the server play it since if only the client plays it, it's liable to get played twice cause of // a prediction error. joy. EmitSound("Default.Zoom"); // let the bots hear the rifle zoom IGameEvent * event = gameeventmanager->CreateEvent("weapon_zoom"); if (event) { event->SetInt("userid", pPlayer->GetUserID()); gameeventmanager->FireEvent(event); } #endif m_flNextSecondaryAttack = gpGlobals->curtime + 0.3; m_zoomFullyActiveTime = gpGlobals->curtime + 0.15; // The worst zoom time from above. }
void CHEGrenadeProjectile::Detonate() { BaseClass::Detonate(); // tell the bots an HE grenade has exploded CMomentumPlayer *player = static_cast<CMomentumPlayer*>(GetThrower()); if ( player ) { IGameEvent * event = gameeventmanager->CreateEvent( "hegrenade_detonate" ); if ( event ) { event->SetInt( "userid", player->GetUserID() ); event->SetFloat( "x", GetAbsOrigin().x ); event->SetFloat( "y", GetAbsOrigin().y ); event->SetFloat( "z", GetAbsOrigin().z ); gameeventmanager->FireEvent( event ); } } }
void CFlashbangProjectile::Detonate() { RadiusFlash(GetAbsOrigin(), this, GetThrower(), 4, CLASS_NONE, DMG_BLAST); EmitSound("Flashbang.Explode"); // tell the bots a flashbang grenade has exploded CMomentumPlayer *player = static_cast<CMomentumPlayer*>(GetThrower()); if (player) { IGameEvent * event = gameeventmanager->CreateEvent("flashbang_detonate"); if (event) { event->SetInt("userid", player->GetUserID()); event->SetFloat("x", GetAbsOrigin().x); event->SetFloat("y", GetAbsOrigin().y); event->SetFloat("z", GetAbsOrigin().z); gameeventmanager->FireEvent(event); } } UTIL_Remove(this); }