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.
60 lines
1.1 KiB
60 lines
1.1 KiB
5 years ago
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||
|
//
|
||
|
// Purpose:
|
||
|
//
|
||
|
// $NoKeywords: $
|
||
|
//
|
||
|
//=============================================================================//
|
||
|
|
||
|
#include "cbase.h"
|
||
|
#include "items.h"
|
||
|
#include "cs_player.h"
|
||
|
|
||
|
|
||
|
class CItemKevlar : public CItem
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
DECLARE_CLASS( CItemKevlar, CItem );
|
||
|
|
||
|
void Spawn( void )
|
||
|
{
|
||
|
Precache( );
|
||
|
BaseClass::Spawn( );
|
||
|
}
|
||
|
|
||
|
void Precache( void )
|
||
|
{
|
||
|
PrecacheScriptSound( "BaseCombatCharacter.ItemPickup2" );
|
||
|
}
|
||
|
|
||
|
bool MyTouch( CBasePlayer *pBasePlayer )
|
||
|
{
|
||
|
CCSPlayer *pPlayer = dynamic_cast< CCSPlayer* >( pBasePlayer );
|
||
|
if ( !pPlayer )
|
||
|
{
|
||
|
Assert( false );
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
pPlayer->SetArmorValue( 100 );
|
||
|
|
||
|
if ( pPlayer->IsDead() == false )
|
||
|
{
|
||
|
CPASAttenuationFilter filter( pBasePlayer );
|
||
|
EmitSound( filter, entindex(), "BaseCombatCharacter.ItemPickup2" );
|
||
|
|
||
|
CSingleUserRecipientFilter user( pPlayer );
|
||
|
UserMessageBegin( user, "ItemPickup" );
|
||
|
WRITE_STRING( "item_kevlar" );
|
||
|
MessageEnd();
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
LINK_ENTITY_TO_CLASS( item_kevlar, CItemKevlar );
|
||
|
|
||
|
|