[saco] Implement CPlayerPed::StartGoggles()

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

View File

@ -2,6 +2,7 @@
#include "../main.h" #include "../main.h"
#include "util.h" #include "util.h"
#include "keystuff.h" #include "keystuff.h"
#include "task.h"
extern CGame *pGame; extern CGame *pGame;
@ -165,6 +166,19 @@ WEAPON_SLOT_TYPE * CPlayerPed::FindWeaponSlot(DWORD dwWeapon)
//----------------------------------------------------------- //-----------------------------------------------------------
void CPlayerPed::StartGoggles()
{
if (HasGoggles()) return;
if (FindWeaponSlot( 44 ) == NULL && FindWeaponSlot( 45 ) == NULL)
GiveWeapon( 44, 1 ); // Prevents crashing due to lack of animations.
CTaskGoggles* pGoggles = new CTaskGoggles();
pGoggles->ApplyToPed( this );
m_bGoggleState = TRUE;
}
//-----------------------------------------------------------
void CPlayerPed::StopGoggles() void CPlayerPed::StopGoggles()
{ {
if (!m_pPed || !HasGoggles()) return; if (!m_pPed || !HasGoggles()) return;

View File

@ -23,6 +23,7 @@ public:
WEAPON_SLOT_TYPE * GetCurrentWeaponSlot(); WEAPON_SLOT_TYPE * GetCurrentWeaponSlot();
WEAPON_SLOT_TYPE * FindWeaponSlot(DWORD dwWeapon); WEAPON_SLOT_TYPE * FindWeaponSlot(DWORD dwWeapon);
void StartGoggles();
void StopGoggles(); void StopGoggles();
BOOL HasGoggles(); BOOL HasGoggles();