I previously was using the existing HL weapon ents as my weapons in my mod, but they were recoded to be a completely different one. This looked stupid in the console "Draco has killed SomeGuy with Squeak" when I shot them with a silenced pistol;) . I found out how to actually get your own weapons working, So I tried it, my first one, a little SMG, worked well, even used a new ammo type. Now came time to convert another over, not so good this time. Using the same code, names changed from "Cyclone" to "AR34" and the weapon selection position set on more than the last, same code otherwise, and when I go to play it, the gun can't be switched to. I ended u dropping all other guns to see it, the ammo hud said 0 in clip, 0 in reserve, and the gun just keeps trying to reload.
I have tried for the last 2 days to get this bastard to work, any ideas? Here's my ar34.cpp --------------------------------------------------------------------------------------------------------------------- #include "extdll.h" #include "util.h" #include "cbase.h" #include "monsters.h" #include "weapons.h" #include "nodes.h" #include "player.h" #include "soundent.h" #include "gamerules.h" enum ar34_e { AR34_IDLE = 0, AR34_FIRE, AR34_RELOAD, AR34_DRAW, AR34_DOWN }; LINK_ENTITY_TO_CLASS( weapon_ar34, CAR34 ); void CAR34::Spawn( ) { pev->classname = MAKE_STRING("weapon_ar34"); // hack to allow for old names Precache( ); SET_MODEL(ENT(pev), "models/w_ar34.mdl"); m_iId = WEAPON_AR34; m_iDefaultAmmo = AR34_DEFAULT_GIVE; FallInit();// get ready to fall down. } void CAR34::Precache( void ) { PRECACHE_MODEL("models/v_ar34.mdl"); PRECACHE_MODEL("models/w_ar34.mdl"); PRECACHE_MODEL("models/p_ar34.mdl"); m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shellTE_MODEL m_iClipModel = PRECACHE_MODEL ("models/w_9mmARclip.mdl");//clip model PRECACHE_MODEL("models/w_9mmARclip.mdl"); PRECACHE_SOUND( "ar34/ar34_fire.wav" ); PRECACHE_SOUND( "ar34/ar34_reload.wav" ); PRECACHE_SOUND ("weapons/357_cock1.wav"); m_usAr34Fire = PRECACHE_EVENT( 1, "events/ar34.sc" ); } int CAR34::GetItemInfo(ItemInfo *p) { p->pszName = STRING(pev->classname); p->pszAmmo1 = "Automatics"; p->iMaxAmmo1 = AR34_MAX_CARRY; p->pszAmmo2 = NULL; p->iMaxAmmo2 = 0; p->iMaxClip = AR34_MAX_CLIP; p->iSlot = 3; p->iPosition = 4; p->iFlags = 0; p->iId = m_iId = WEAPON_AR34; p->iWeight = AR34_WEIGHT; return 1; } int CAR34::AddToPlayer( CBasePlayer *pPlayer ) { if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) ) { return TRUE; } return FALSE; } BOOL CAR34::Deploy( ) { return DefaultDeploy( "models/v_ar34.mdl", "models/p_ar34.mdl", AR34_DRAW, "onehanded" ); } void CAR34::PrimaryAttack() { if (m_iClip <= 0) { PlayEmptySound(); m_flNextPrimaryAttack = 0.15; return; } m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; m_iClip--; m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); Vector vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_6DEGREES, 8192, BULLET_PLAYER_MP5, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed ); int flags; #if defined( CLIENT_WEAPONS ) flags = FEV_NOTHOST; #else flags = 0; #endif // PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usAr34Fire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1; } void CAR34::SecondaryAttack( void ) { } void CAR34::Reload( void ) { if ( m_pPlayer->ammo_automatic <= 0 ) return; DefaultReload( AR34_MAX_CLIP, AR34_RELOAD, 2 ); if (m_iClip != AR34_MAX_CLIP) { UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle ); Vector vecShellVelocity = m_pPlayer->pev->velocity + gpGlobals->v_right * RANDOM_FLOAT(-10,10) + gpGlobals->v_up * 0 + gpGlobals->v_forward * 23; EjectBrass ( pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_up * -22 + gpGlobals->v_forward * 10 + gpGlobals->v_right * 2 , vecShellVelocity, pev->angles.x, m_iClipModel, TE_BOUNCE_SHELL ); } } void CAR34::WeaponIdle( void ) { ResetEmptySound( ); m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); SendWeaponAnim( AR34_IDLE ); } ----------------------------------------------------- -- Draco _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders