Creating simple pickup: Difference between revisions
Jump to navigation
Jump to search
Note:This was made for Orange Box version
Special thanks to SecobMod Team: Updating the code
NikoDash2020 (talk | contribs) mNo edit summary |
(fixed basically everything) |
||
Line 1: | Line 1: | ||
{{Note|This was made for Orange Box version}} | |||
------- | ------- | ||
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject".<br> | |||
Now replace it with the following code: | |||
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject". | |||
< | |||
<source lang=cpp> | <source lang=cpp> | ||
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize ) | void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize ) | ||
Line 26: | Line 11: | ||
BaseClass::PickupObject(pObject,bLimitMassAndSize); | BaseClass::PickupObject(pObject, bLimitMassAndSize); | ||
// Can't be picked up if NPCs are on me | // Can't be picked up if NPCs are on me | ||
Line 35: | Line 20: | ||
ClearActiveWeapon(); | ClearActiveWeapon(); | ||
Weapon_Switch( Weapon_OwnsThisType( " | Weapon_Switch( Weapon_OwnsThisType( "nameofyourweaponentity" ) ); | ||
PlayerPickupObject( this, pObject ); | PlayerPickupObject( this, pObject ); | ||
Line 41: | Line 26: | ||
</source> | </source> | ||
{{Special thanks|SecobMod Team|Updating the code}} | |||
[[Category:Programming]] | [[Category:Programming]] |
Latest revision as of 06:05, 11 September 2022

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 );
}
