P47R!CK
05-28-2005, 05:47 AM
CBaseCombatWeapon* pPrimaryWeapon = gPlayers.pGetWeaponbyID( gOriginalEngine.GetLocalPlayer() , 2 );
CBaseCombatCharacter* pBaseCombat = gPlayers.pGetBaseCombat( gOriginalEngine.GetLocalPlayer() );
if ( pPrimaryWeapon && pBaseCombat )
{
m_iPrimaryAmmo = pPrimaryWeapon->m_iClip1;
m_iPrimaryAmmo_max = pBaseCombat->GetAmmoCount( pPrimaryWeapon->m_iPrimaryAmmoType );
}
Index 0 = knife
Index 1 = pistol
m_iPrimaryAmmo_max is how much ammoition you have left in general...
the real max clip gives pWeapon->GetDefaultClip1();
incase you get linker errors:
int CBaseCombatCharacter::GetAmmoCount( int iAmmoIndex ) const
{
if ( iAmmoIndex <= -1 || iAmmoIndex >=MAX_AMMO_TYPES )
return 0;
return m_iAmmo[ iAmmoIndex ];
}
CBaseCombatCharacter* pBaseCombat = gPlayers.pGetBaseCombat( gOriginalEngine.GetLocalPlayer() );
if ( pPrimaryWeapon && pBaseCombat )
{
m_iPrimaryAmmo = pPrimaryWeapon->m_iClip1;
m_iPrimaryAmmo_max = pBaseCombat->GetAmmoCount( pPrimaryWeapon->m_iPrimaryAmmoType );
}
Index 0 = knife
Index 1 = pistol
m_iPrimaryAmmo_max is how much ammoition you have left in general...
the real max clip gives pWeapon->GetDefaultClip1();
incase you get linker errors:
int CBaseCombatCharacter::GetAmmoCount( int iAmmoIndex ) const
{
if ( iAmmoIndex <= -1 || iAmmoIndex >=MAX_AMMO_TYPES )
return 0;
return m_iAmmo[ iAmmoIndex ];
}