Okay, there are some stuff I've noticed about your weapon code. First, the secondary attack:
void CFuckfinger::SecondaryAttack(void)
{
void;
}
If your weapon does not have a secondary attack, then it is useless to override it in your weapon class, also that
void;
thingy is useless (maybe you meant
return;
?)
Now onto the reload:
void CFuckfinger::Reload(void)
{
// Ammo check and actual reload code here
if (iResult)
{
m_flTimeWeaponIdle + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
}
}
The problem here is that you calculate the next weapon idle time but you never assign the result, you missed a
m_flTimeWeaponIdle =
And finally the weapon idle code :
void CFuckfinger::WeaponIdle(void)
{
// Reset empty sound, autoaim and "time to idle check" code here
if (m_iClip != 0)
{
int iAnim;
float flRand = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 0, 1);
if (flRand <= 0.5)
{
iAnim = FUCKFINGER_IDLE;
m_flTimeWeaponIdle + 70.0 / 30.0;
}
else if (flRand <= 0.7)
{
iAnim = FUCKFINGER_IDLE;
m_flTimeWeaponIdle + 60.0 / 16.0;
}
else
{
iAnim = FUCKFINGER_IDLE;
m_flTimeWeaponIdle + 88.0 / 30.0;
}
SendWeaponAnim(iAnim, 1);
}
}
There are 3 problems here, the first one is the identical to the reload problem (you calculate the next idle times but you never assign them). The second problem is that you forgot
UTIL_WeaponTimeBase()
in the calculation which is the current game time. And the final problem is that you are randomly picking one of 3 possibles scenarios but all of them play the same idle animation (the idle time being the only difference). You could simplify your
WeaponIdle
function to something like this:
void CFuckfinger::WeaponIdle()
{
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
// Play idle animation only if it is time to do so and the clip/magazine isn't empty
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() || m_iClip <= 0 )
return;
SendWeaponAnim( FUCKFINGER_IDLE );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; // Assuming your idle animation duration is 3 seconds
}
Next time when you post code here, post it in a code block so that's it's easier for everyone to read, see the
formatting help wiki page for details.