diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 9a0cf63..462f80a 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -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) { diff --git a/saco/game/playerped.h b/saco/game/playerped.h index 6779d89..7ccec85 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -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();