Creating simple pickup
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject".
Now replace it with the following code:
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize )
{
// can't pick up what you're standing on
if ( GetGroundEntity() == pObject )
return;
BaseClass::PickupObject(pObject, bLimitMassAndSize);
// Can't be picked up if NPCs are on me
if ( pObject->HasNPCsOnIt() )
return;
HideViewModels();
ClearActiveWeapon();
Weapon_Switch( Weapon_OwnsThisType( "nameofyourweaponentity" ) );
PlayerPickupObject( this, pObject );
}
![](/w/images/thumb/3/3f/Special_thanks.png/16px-Special_thanks.png)