[saco] Implement CPlayerPed::HasAmmoForCurrentWeapon()

This commit is contained in:
RD42 2024-05-03 22:10:53 +08:00
parent 9894fd3ec7
commit 3e2c80c2b1
2 changed files with 19 additions and 0 deletions

View File

@ -133,6 +133,24 @@ WEAPON_SLOT_TYPE * CPlayerPed::GetCurrentWeaponSlot()
//-----------------------------------------------------------
BOOL CPlayerPed::HasAmmoForCurrentWeapon()
{
if(m_pPed) {
WEAPON_SLOT_TYPE * WeaponSlot = GetCurrentWeaponSlot();
if(!WeaponSlot) return TRUE;
// Melee types always have ammo.
if( WeaponSlot->dwType <= WEAPON_CANE ||
WeaponSlot->dwType == WEAPON_PARACHUTE ) return TRUE;
if(!WeaponSlot->dwAmmo) return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------
WORD CPlayerPed::GetAmmo()
{
if(m_pPed) {

View File

@ -22,6 +22,7 @@ public:
void SetArmedWeapon(int iWeaponType, bool bUnk);
WEAPON_SLOT_TYPE * GetCurrentWeaponSlot();
WEAPON_SLOT_TYPE * FindWeaponSlot(DWORD dwWeapon);
BOOL HasAmmoForCurrentWeapon();
void StartGoggles();
void StopGoggles();