hud ammo fix

This commit is contained in:
erorcun 2021-01-13 23:07:12 +03:00
parent 011a9cc775
commit a844cbbc3d
1 changed files with 6 additions and 12 deletions

View File

@ -509,10 +509,10 @@ void CHud::Draw()
/* /*
DrawAmmo DrawAmmo
*/ */
uint32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition; int32 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
uint32 AmmoInClip = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoInClip; int32 AmmoInClip = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoInClip;
uint32 TotalAmmo = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoTotal; int32 TotalAmmo = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_nAmmoTotal;
uint32 Ammo, Clip; int32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000) if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo); sprintf(sTemp, "%d", TotalAmmo);
@ -520,18 +520,12 @@ void CHud::Draw()
if (WeaponType == WEAPONTYPE_FLAMETHROWER) { if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
Clip = AmmoInClip / 10; Clip = AmmoInClip / 10;
if ((TotalAmmo - AmmoInClip) / 10 <= 9999) Ammo = Min((TotalAmmo - AmmoInClip) / 10, 9999);
Ammo = (TotalAmmo - AmmoInClip) / 10;
else
Ammo = 9999;
} }
else { else {
Clip = AmmoInClip; Clip = AmmoInClip;
if ((TotalAmmo - AmmoInClip) > 9999) Ammo = Min(TotalAmmo - AmmoInClip, 9999);
Ammo = 9999;
else
Ammo = TotalAmmo - AmmoInClip;
} }
sprintf(sTemp, "%d-%d", Ammo, Clip); sprintf(sTemp, "%d-%d", Ammo, Clip);