Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "extdll.h"
- #include "util.h"
- #include "cbase.h"
- #include "monsters.h"
- #include "weapons.h"
- #include "nodes.h"
- #include "player.h"
- LINK_ENTITY_TO_CLASS( weapon_beretta, CBeretta );
- void CBeretta::Spawn( )
- {
- pev->classname = MAKE_STRING("weapon_beretta"); // hack to allow for old names
- Precache( );
- SET_MODEL(ENT(pev), "models/w_Beretta.mdl"); // This should be your own weapon model
- m_iId = WEAPON_BERETTA;
- m_iDefaultAmmo = 17; // this could be replaced with EXAMPLE_DEFAULT_GIVE if you had defined it
- FallInit();// get ready to fall down.
- }
- void CBeretta::Precache( void )
- {
- // Again, you must replace these precache models and sounds with your own models and sounds
- PRECACHE_MODEL("models/v_Beretta.mdl");
- PRECACHE_MODEL("models/w_Beretta.mdl");
- PRECACHE_MODEL("models/p_Beretta.mdl");
- PRECACHE_SOUND("items/9mmclip1.wav");
- PRECACHE_SOUND("items/clipinsert1.wav");
- PRECACHE_SOUND("items/cliprelease1.wav");
- PRECACHE_SOUND ("weapons/hks1.wav");
- PRECACHE_SOUND ("weapons/hks2.wav"); PRECACHE_SOUND ("weapons/hks3.wav");
- // this is to hook your client-side event
- m_usBerettaFire = PRECACHE_EVENT( 1, "events/beretta.sc" );
- }
- int CBeretta::GetItemInfo(ItemInfo *p)
- {
- p->pszName = STRING(pev->classname);
- p->pszAmmo1 = "9mm";
- p->iMaxAmmo1 = 200;
- p->iMaxClip = -1; // means that there is no clip
- p->iSlot = 1;
- p->iPosition = 2;
- p->iFlags = 0;
- p->iId = m_iId = WEAPON_BERETTA;
- p->iWeight = BERETTA_WEIGHT; // weight is for autoswitching, so it doesn't really matter much
- p->pszAmmo2 = NULL; // no secondary ammo
- p->iMaxAmmo2 = -1;
- return 1;
- }
- int CBeretta::AddToPlayer( CBasePlayer *pPlayer )
- {
- if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
- {
- MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
- WRITE_BYTE( m_iId );
- MESSAGE_END();
- return TRUE;
- }
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement