[saco] Implement CPlayerPed::HasAmmoForCurrentWeapon()

This commit is contained in:
RD42 committed 2024-05-03 22:10:53 +08:00
1 parent 9894fd3ec7
commit 3e2c80c2b1
2 files changed
+19

No files matched your search

+18
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) {
+1
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();