Posted: . At: 7:35 AM. This was 4 months ago. Post ID: 18988
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


The GTA V cheats are very interesting. Here they are.


GTA V has quite a few cheats to use when you are in Debug mode, this enables interesting cheats. Below are the enums that list all of the cheat codes available in debug mode.

/src/dev_ng/game/game/cheat.h
class CCheat
{
public:

	enum eCheat
	{
		POOR_WEAPON_CHEAT = 0,
		ADVANCED_WEAPON_CHEAT,
		HEALTH_CHEAT,
		WANTED_LEVEL_UP_CHEAT,
		WANTED_LEVEL_DOWN_CHEAT,
		MONEY_UP_CHEAT,
		CHANGE_WEATHER_CHEAT,
		ANNIHILATOR_CHEAT,
		NRG900_CHEAT,
		FBI_CHEAT,
		JETMAX_CHEAT,
		COMET_CHEAT,
		TURISMO_CHEAT,
		COGNOSCENTI_CHEAT,
		SUPERGT_CHEAT,
		SANCHEZ_CHEAT,
//		SLOWNESS_TEST_CHEAT,
		NUM_CHEATS
	};

	
	// ** HOW TO ADD A NEW CHEAT **
	// 1) add a new enum above for the new cheat, and updated the enum of cheats ids in commands_misc.sch
	// 2) if it requires a function, create one and add it to m_aCheatFunctions, otherwise just add a NULL in the right place
	// 3) add a corresponding entry to m_aCheatNameIds, which is the number of the cheat id held in american.txt which is displayed when the cheat is activated
	// 4) add the pad/keyboard string to activate the cheat into m_aCheatStrings
	// 5) run the game in release / debug, and activate widget 'Game Logic/Cheat/Output file cheat hashkeys  this will generate the CHEATHASHKEYS.DAT file
	// 6) copy the contents of this file and paste into m_aCheatHashKeys
	// 7) build and run the game again and the cheat should work
	
	// ** HOW TO TEST IF A CHEAT IS ACTIVE ** 
	// call IsCheatActive() with one of the enums above

And, this is all of the actual cheats.

/src/dev_ng/game/game/cheat.cpp
	// Stick a few cheats on the keyboard to help when debugging
#if !__FINAL
	if (m_bAllowDevelopmentCheats)
	{
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_H, KEYBOARD_MODE_DEBUG, "health cheat"))
		{
			HealthCheat();
			cheatDisplayf("H - Health restored!");
		}
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_W, KEYBOARD_MODE_DEBUG, "weapon cheat") 
			REPLAY_ONLY( || CControlMgr::GetKeyboard().GetKeyJustDown(KEY_W, KEYBOARD_MODE_REPLAY, "weapon cheat")))
		{
			WeaponCheat1();
			cheatDisplayf("W - Weapons!");
		}
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_V, KEYBOARD_MODE_DEBUG, "invincibility cheat"))
		{
			CPlayerInfo::ms_bDebugPlayerInvincibleRestoreHealth = false;
			CPlayerInfo::ms_bDebugPlayerInvincible = !CPlayerInfo::ms_bDebugPlayerInvincible;
			if (CPlayerInfo::ms_bDebugPlayerInvincible)
			{
				char *pString = TheText.Get("HELP_INVIN");
				CGameStreamMgr::GetGameStream()->PostTicker( pString, false );
				cheatDisplayf("V - Invincible activated!");
			}
			else
			{
				char *pString = TheText.Get("HELP_NOINVIN");
				CGameStreamMgr::GetGameStream()->PostTicker( pString, false );
				cheatDisplayf("V - Invincible deactivated!");
			}

			if (NetworkInterface::IsGameInProgress())
				GetEventScriptNetworkGroup()->Add(CEventNetworkCheatTriggered(CEventNetworkCheatTriggered::CHEAT_INVINCIBLE));
		}
		if(CControlMgr::GetKeyboard().GetKeyJustDown(KEY_V, KEYBOARD_MODE_DEBUG_ALT, "invincibility cheat restore health"))
		{
			CPlayerInfo::ms_bDebugPlayerInvincible = false;
			CPlayerInfo::ms_bDebugPlayerInvincibleRestoreHealth = !CPlayerInfo::ms_bDebugPlayerInvincibleRestoreHealth;
			if (CPlayerInfo::ms_bDebugPlayerInvincibleRestoreHealth)
			{
				char *pString = TheText.Get("HELP_INVIN_R");
				CGameStreamMgr::GetGameStream()->PostTicker( pString, false );
				cheatDisplayf("Alt-V - Invincible + restore health activated!");
			}
			else
			{
				char *pString = TheText.Get("HELP_NOINVIN_R");
				CGameStreamMgr::GetGameStream()->PostTicker( pString, false );
				cheatDisplayf("Alt-V - Invincible + restore health deactivated!");
			}

			if (NetworkInterface::IsGameInProgress())
				GetEventScriptNetworkGroup()->Add(CEventNetworkCheatTriggered(CEventNetworkCheatTriggered::CHEAT_INVINCIBLE));
		}
		if(CControlMgr::GetKeyboard().GetKeyJustDown(KEY_V, KEYBOARD_MODE_DEBUG_SHIFT_ALT, "invincibility cheat restore armor with health"))
		{
			CPlayerInfo::ms_bDebugPlayerInvincibleRestoreArmorWithHealth = !CPlayerInfo::ms_bDebugPlayerInvincibleRestoreArmorWithHealth;
			
			char *pString = CPlayerInfo::ms_bDebugPlayerInvincibleRestoreArmorWithHealth ? TheText.Get("HELP_INV_A_ON") : TheText.Get("HELP_INV_A_OFF");
			CGameStreamMgr::GetGameStream()->PostTicker( pString, false );
			cheatDisplayf("Shift-Alt-V - Invincible + Restore Health switched modes!");
		}
		if(CControlMgr::GetKeyboard().GetKeyJustDown(KEY_W, KEYBOARD_MODE_DEBUG_CTRL, "Infinite Ammo"))
		{
			
			static int AmmoLimit = 0;
			AmmoLimit = (AmmoLimit + 1) % (2 + __BANK);
			CPed* pPlayer = CGameWorld::FindLocalPlayer();
			if (pPlayer)
			{
				if (pPlayer && pPlayer->GetInventory())
				{
					const bool shouldUseInfiniteAmmo = (AmmoLimit == 1);
					pPlayer->GetInventory()->GetAmmoRepository().SetUsingInfiniteAmmo(shouldUseInfiniteAmmo);
#if __BANK
					const bool shouldUseInfiniteClips = (AmmoLimit == 2);
					pPlayer->GetInventory()->GetAmmoRepository().SetUsingInfiniteClips(shouldUseInfiniteClips);
#endif
				}

				//Display confirmation debug text (if the HUD is enabled.)
				static const char* s_Strings[3] = {"HELP_AMMO", "HELP_AMMO_UNL", "HELP_AMMO_UNLCL"};
				char *pString = TheText.Get(s_Strings[AmmoLimit]);
				CGameStreamMgr::GetGameStream()->PostTicker( pString, false );

				cheatDisplayf("Ctrl-W - Activated: %s", TheText.Get(s_Strings[AmmoLimit]) );
			}
		}
#if __BANK && 0	// Disable this since script uses S for skipping missions so can accidently force a slow zone
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_S, KEYBOARD_MODE_DEBUG, "slowness cheat"))
		{
			CVehicle::ms_bForceSlowZone = !CVehicle::ms_bForceSlowZone;
		}
#endif
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_F3, KEYBOARD_MODE_DEBUG, "decrease wanted level"))
		{
			CCheat::WantedLevelDownCheat();
		}
		if (CControlMgr::GetKeyboard().GetKeyJustDown(KEY_F4, KEYBOARD_MODE_DEBUG, "increase wanted level"))
		{
			CCheat::WantedLevelUpCheat();
		}
	}
#endif //!__FINAL

This is how the health cheat works, this simply adds more health to the player object.

/src/dev_ng/game/game/cheat.cpp
void CCheat::HealthCheat()
{
	// Disable the health check when injured, it doens't correctly revive the player
	if( FindPlayerPed() == NULL || FindPlayerPed()->IsInjured() )
	{
		return;
	}
	cheatDisplayf("HEALTH UP");
	
	IncrementTimesCheatedStat();

	FindPlayerPed()->SetHealth( FindPlayerPed()->GetPlayerInfo()->MaxHealth );
	FindPlayerPed()->SetArmour( FindPlayerPed()->GetPlayerInfo()->MaxArmour );
	FindPlayerPed()->ClearDamageAndScars();

	// Fix car
	if (FindPlayerVehicle())
	{
		if(!FindPlayerVehicle()->IsNetworkClone())
		{
			if(FindPlayerVehicle()->GetStatus() != STATUS_WRECKED)
			{	
				FindPlayerVehicle()->SetHealth(1000.0f);
				FindPlayerVehicle()->Fix();
			}
		}
	}
	CNetworkTelemetry::CheatApplied("H");

	m_LastTimeCheatUsed[HEALTH_CHEAT] = fwTimer::GetTimeInMilliseconds();
	SetCheatActivatedMessage(HEALTH_CHEAT);

	if (NetworkInterface::IsGameInProgress())
		GetEventScriptNetworkGroup()->Add(CEventNetworkCheatTriggered(CEventNetworkCheatTriggered::CHEAT_HEALTH));
};

Interesting that the player object has 1000 health. I thought it would be 100. But this cheat also repairs the player`s vehicle. That is a very useful feature.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.