The Place to Start


Removing a PlayerItem 
ShockMan
Easy


Removing a PlayerItem
This isnt much of a tutorial but more of a code snippet. It gives you the code to remove a 

player item by name.

Add this new prototype to player.h:



virtual void Spawn( void );

void Pain( void );

//ShockMan

BOOL RemoveNamedPlayerItem ( const char *pszItemName );

//ShockMan



Put this somewhere in player.cpp:



/*======================================

Remove Player Item

Created by ShockMan!

Assembled into Tutorial by BigGuy

Thanks for the info ShockMan

======================================*/

BOOL CBasePlayer::RemoveNamedPlayerItem( const char *pszItemName )

{

      CBasePlayerItem *pItem;

      int i;



      for ( i = 0 ; i < MAX_ITEM_TYPES ; i++ )

      {

           pItem = m_rgpPlayerItems[ i ];



           while (pItem)

           {

                 if ( !strcmp(pszItemName, STRING(pItem->pev->classname ) ) )

                 {

                    RemovePlayerItem ( pItem );

                    return TRUE;

                 }

                    pItem = pItem->m_pNext;

           }

      }

           return FALSE;

}





Then just call it something like this: 



	pPlayer->RemoveNamedPlayerItem( "weapon_minigun" );



Any questions or suggestions should be sent to me: shockman@redgenesis.com