From 4bc31cc88b99e283b0a52792fccfc01a255cb370 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:10:40 +0800 Subject: [PATCH] [saco] Reorder functions in playerped.cpp --- saco/game/playerped.cpp | 101 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 72489d5..e4d1308 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -620,7 +620,6 @@ VEHICLE_TYPE * CPlayerPed::GetGtaVehicle() return (VEHICLE_TYPE *)m_pPed->pVehicle; } -//----------------------------------------------------------- //----------------------------------------------------------- void CPlayerPed::GiveWeapon(int iWeaponID, int iAmmo) @@ -928,56 +927,6 @@ void CPlayerPed::HandsUp() //----------------------------------------------------------- -WORD CPlayerPed::GetAmmo() -{ - if(m_pPed) { - WEAPON_SLOT_TYPE * WeaponSlot = GetCurrentWeaponSlot(); - - if(!WeaponSlot) return -1; - - // Melee types always have ammo. - if( WeaponSlot->dwType <= WEAPON_CANE || - WeaponSlot->dwType == WEAPON_PARACHUTE ) return -1; - - return (WORD)WeaponSlot->dwAmmo; - } - return 0; -} - -//----------------------------------------------------------- - -WEAPON_SLOT_TYPE * CPlayerPed::FindWeaponSlot(DWORD dwWeapon) -{ - if (m_pPed) - { - BYTE i; - for (i = 0; i < 13; i++) - { - if (m_pPed->WeaponSlots[i].dwType == dwWeapon) return &m_pPed->WeaponSlots[i]; - } - } - return NULL; -} - -//----------------------------------------------------------- - -void CPlayerPed::SetAnimationSet(PCHAR szAnim) -{ - if(m_pPed) { - ScriptCommand(&set_actor_animation_set,m_dwGTAId,szAnim); - } -} - -//----------------------------------------------------------- - -void CPlayerPed::SetMoney(int iAmount) -{ - ScriptCommand(&set_actor_money,m_dwGTAId,0); - ScriptCommand(&set_actor_money,m_dwGTAId,iAmount); -} - -//----------------------------------------------------------- - void CPlayerPed::StartJetpack() { if(!m_pPed) return; @@ -1063,6 +1012,56 @@ BOOL CPlayerPed::HasGoggles() //----------------------------------------------------------- +WORD CPlayerPed::GetAmmo() +{ + if(m_pPed) { + WEAPON_SLOT_TYPE * WeaponSlot = GetCurrentWeaponSlot(); + + if(!WeaponSlot) return -1; + + // Melee types always have ammo. + if( WeaponSlot->dwType <= WEAPON_CANE || + WeaponSlot->dwType == WEAPON_PARACHUTE ) return -1; + + return (WORD)WeaponSlot->dwAmmo; + } + return 0; +} + +//----------------------------------------------------------- + +WEAPON_SLOT_TYPE * CPlayerPed::FindWeaponSlot(DWORD dwWeapon) +{ + if (m_pPed) + { + BYTE i; + for (i = 0; i < 13; i++) + { + if (m_pPed->WeaponSlots[i].dwType == dwWeapon) return &m_pPed->WeaponSlots[i]; + } + } + return NULL; +} + +//----------------------------------------------------------- + +void CPlayerPed::SetAnimationSet(PCHAR szAnim) +{ + if(m_pPed) { + ScriptCommand(&set_actor_animation_set,m_dwGTAId,szAnim); + } +} + +//----------------------------------------------------------- + +void CPlayerPed::SetMoney(int iAmount) +{ + ScriptCommand(&set_actor_money,m_dwGTAId,0); + ScriptCommand(&set_actor_money,m_dwGTAId,iAmount); +} + +//----------------------------------------------------------- + float CPlayerPed::GetAimZ() { if(m_pPed) {