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 CItemKevlar : public CItem
  12. {
  13. public:
  14. DECLARE_CLASS( CItemKevlar, 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->SetArmorValue( 100 );
  33. pPlayer->RecalculateCurrentEquipmentValue();
  34. if ( pPlayer->IsAlive() )
  35. {
  36. CBroadcastRecipientFilter filter;
  37. if (pPlayer->GetTeamNumber() == TEAM_CT)
  38. {
  39. // Play the CT Suit sound
  40. EmitSound(filter, entindex(), "Player.EquipArmor_CT");
  41. }
  42. else
  43. {
  44. // Play the T Suit sound
  45. EmitSound(filter, entindex(), "Player.EquipArmor_T");
  46. }
  47. //EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
  48. }
  49. return true;
  50. }
  51. };
  52. LINK_ENTITY_TO_CLASS( item_kevlar, CItemKevlar );