Semi or Burst fire
Hi
This is a simple tutorial about adding semi-auto or burst fire mode to a weapon. I will use the weapon_pistol.cpp as the basis of the tutorial. Look up this part at the declaration of the pistol class. The extra lines are bold.
private: CNetworkVar( float, m_flSoonestPrimaryAttack ); CNetworkVar( float, m_flLastAttackTime ); CNetworkVar( float, m_flAccuracyPenalty ); CNetworkVar( int, m_nNumShotsFired );
private: CWeaponPistol( const CWeaponPistol & ); };
IMPLEMENT_NETWORKCLASS_ALIASED( WeaponPistol, DT_WeaponPistol )
BEGIN_NETWORK_TABLE( CWeaponPistol, DT_WeaponPistol )
- ifdef CLIENT_DLL
RecvPropTime( RECVINFO( m_flSoonestPrimaryAttack ) ), RecvPropTime( RECVINFO( m_flLastAttackTime ) ), RecvPropFloat( RECVINFO( m_flAccuracyPenalty ) ), RecvPropInt( RECVINFO( m_nNumShotsFired ) ),
- else
SendPropTime( SENDINFO( m_flSoonestPrimaryAttack ) ), SendPropTime( SENDINFO( m_flLastAttackTime ) ), SendPropFloat( SENDINFO( m_flAccuracyPenalty ) ), SendPropInt( SENDINFO( m_nNumShotsFired ) ),
- endif
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( CWeaponPistol ) END_PREDICTION_DATA()