Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "items.h"
  10. #include "cs_player.h"
  11. class CItemNvgs : public CItem
  12. {
  13. public:
  14. DECLARE_CLASS( CItemNvgs, CItem );
  15. void Spawn( void )
  16. {
  17. Precache( );
  18. BaseClass::Spawn( );
  19. }
  20. void Precache( void )
  21. {
  22. PrecacheScriptSound( "BaseCombatCharacter.ItemPickup2" );
  23. }
  24. bool MyTouch( CBasePlayer *pBasePlayer )
  25. {
  26. CCSPlayer *pPlayer = dynamic_cast< CCSPlayer* >( pBasePlayer );
  27. if ( !pPlayer )
  28. {
  29. Assert( false );
  30. return false;
  31. }
  32. pPlayer->m_bHasNightVision = true;
  33. if ( pPlayer->IsAlive() )
  34. {
  35. CBroadcastRecipientFilter filter;
  36. if (pPlayer->GetTeamNumber() == TEAM_CT)
  37. {
  38. // Play the CT Suit sound
  39. EmitSound(filter, entindex(), "Player.EquipArmor_CT");
  40. }
  41. else
  42. {
  43. // Play the T Suit sound
  44. EmitSound(filter, entindex(), "Player.EquipArmor_T");
  45. }
  46. //EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
  47. }
  48. return true;
  49. }
  50. };
  51. LINK_ENTITY_TO_CLASS( item_nvgs, CItemNvgs );