Merge branch 'enhanced' of https://github.com/YimMenu/YimMenuV2 into enhanced

This commit is contained in:
maybegreat48
2025-04-07 00:50:35 -04:00
11 changed files with 272 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
#include "core/commands/Command.hpp"
#include "game/backend/Self.hpp"
namespace YimMenu::Features
{
class ClearDamage : Command
{
using Command::Command;
virtual void OnCall() override
{
Self::GetPed().ClearDamage();
}
};
static ClearDamage _ClearDamage{"cleardamage", "Clear Damage", "Clears all the dirt and blood on you."};
}
+30
View File
@@ -0,0 +1,30 @@
#include "core/commands/Command.hpp"
#include "game/gta/Stats.hpp"
namespace YimMenu::Features
{
class FillInventory : public Command
{
using Command::Command;
virtual void OnCall() override
{
Stats::SetInt("MPX_NO_BOUGHT_YUM_SNACKS", 30);
Stats::SetInt("MPX_NO_BOUGHT_HEALTH_SNACKS", 15);
Stats::SetInt("MPX_NO_BOUGHT_EPIC_SNACKS", 5);
Stats::SetInt("MPX_NUMBER_OF_CHAMP_BOUGHT", 5);
Stats::SetInt("MPX_NUMBER_OF_ORANGE_BOUGHT", 10);
Stats::SetInt("MPX_NUMBER_OF_BOURGE_BOUGHT", 10);
Stats::SetInt("MPX_NUMBER_OF_SPRUNK_BOUGHT", 10);
Stats::SetInt("MPX_MP_CHAR_ARMOUR_1_COUNT", 10);
Stats::SetInt("MPX_MP_CHAR_ARMOUR_2_COUNT", 10);
Stats::SetInt("MPX_MP_CHAR_ARMOUR_3_COUNT", 10);
Stats::SetInt("MPX_MP_CHAR_ARMOUR_4_COUNT", 10);
Stats::SetInt("MPX_MP_CHAR_ARMOUR_5_COUNT", 10);
Stats::SetInt("MPX_CIGARETTES_BOUGHT", 20);
Stats::SetInt("MPX_BREATHING_APPAR_BOUGHT", 20);
}
};
static FillInventory _FillInventory{"fillinventory", "Fill Inventory", "Fills all of your snacks and armours."};
}
+20
View File
@@ -0,0 +1,20 @@
#include "core/commands/Command.hpp"
#include "game/backend/Self.hpp"
namespace YimMenu::Features
{
class Heal : Command
{
using Command::Command;
virtual void OnCall() override
{
int maxHealth = Self::GetPed().GetMaxHealth();
int maxArmour = Self::GetPlayer().GetMaxArmour();
Self::GetPed().SetHealth(maxHealth);
Self::GetPed().SetArmour(maxArmour);
}
};
static Heal _Heal{"heal", "Heal", "Restores your health and armour."};
}
@@ -0,0 +1,22 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/backend/Self.hpp"
namespace YimMenu::Features
{
class UnlimitedOxygen : LoopedCommand
{
using LoopedCommand::LoopedCommand;
virtual void OnTick() override
{
Self::GetPed().SetMaxTimeUnderwater(INT_MAX);
}
virtual void OnDisable() override
{
Self::GetPed().SetMaxTimeUnderwater(-1.0f); // default value
}
};
static UnlimitedOxygen _UnlimitedOxygen{"unlimitedoxygen", "Unlimited Oxygen", "Allows you to stay underwater without losing oxygen."};
}
+4
View File
@@ -25,6 +25,7 @@ namespace YimMenu::Submenus
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("otr"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("noragdoll"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("noidlekick"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("unlimitedoxygen"_J));
auto clearWanted = std::make_shared<Group>("", 1);
clearWanted->AddItem(std::make_shared<ConditionalItem>("neverwanted"_J, std::make_shared<CommandItem>("clearwanted"_J), true));
@@ -38,6 +39,9 @@ namespace YimMenu::Submenus
toolsGroup->AddItem(std::make_shared<CommandItem>("skipcutscene"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("suicide"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("heal"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("cleardamage"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("fillinventory"_J));
movementGroup->AddItem(std::make_shared<BoolCommandItem>("superrun"_J));
movementGroup->AddItem(std::make_shared<BoolCommandItem>("superjump"_J));
+27
View File
@@ -208,4 +208,31 @@ namespace YimMenu
return WEAPON::HAS_PED_GOT_WEAPON(GetHandle(), hash, false);
}
int Ped::GetArmour()
{
ENTITY_ASSERT_VALID();
return PED::GET_PED_ARMOUR(GetHandle());
}
void Ped::SetArmour(int amount)
{
ENTITY_ASSERT_VALID();
PED::SET_PED_ARMOUR(GetHandle(), amount);
}
void Ped::ClearDamage()
{
ENTITY_ASSERT_VALID();
PED::CLEAR_PED_BLOOD_DAMAGE(GetHandle());
PED::CLEAR_PED_WETNESS(GetHandle());
PED::CLEAR_PED_ENV_DIRT(GetHandle());
PED::RESET_PED_VISIBLE_DAMAGE(GetHandle());
}
void Ped::SetMaxTimeUnderwater(int time)
{
ENTITY_ASSERT_VALID();
PED::SET_PED_MAX_TIME_UNDERWATER(GetHandle(), time);
}
}
+8
View File
@@ -51,5 +51,13 @@ namespace YimMenu
// teleport
void TeleportTo(const rage::fvector3& pos); // similar to SetPosition, but handles vehicles correctly
// armour
int GetArmour();
void SetArmour(int amount);
// misc
void ClearDamage();
void SetMaxTimeUnderwater(int time);
};
}
+5
View File
@@ -337,6 +337,11 @@ namespace YimMenu
});
}
int Player::GetMaxArmour()
{
return PLAYER::GET_PLAYER_MAX_ARMOUR(GetId()); // Not checking IsValid to let GetId return 0 in SP
}
bool Player::operator==(Player other)
{
return m_Handle == other.m_Handle;
+1 -1
View File
@@ -79,7 +79,7 @@ namespace YimMenu
/// <param name="coords">The position to teleport to</param>
void TeleportTo(const rage::fvector3& coords);
int GetMaxArmour();
bool operator==(Player other);
+110
View File
@@ -0,0 +1,110 @@
#include "Stats.hpp"
#include "game/gta/Natives.hpp"
namespace
{
void ConvertMPX(std::string& statName)
{
std::transform(statName.begin(), statName.end(), statName.begin(), ::tolower);
if (statName.substr(0, 3) == "mpx")
statName[2] = YimMenu::Stats::GetCharIndex() + '0';
}
}
namespace YimMenu::Stats
{
int GetCharIndex()
{
int index{};
STATS::STAT_GET_INT("MPPLY_LAST_MP_CHAR"_J, &index, -1);
return index;
}
void SetInt(std::string statName, int value)
{
ConvertMPX(statName);
STATS::STAT_SET_INT(Joaat(statName), value, TRUE);
}
void SetBool(std::string statName, bool value)
{
ConvertMPX(statName);
STATS::STAT_SET_BOOL(Joaat(statName), value, TRUE);
}
void SetFloat(std::string statName, float value)
{
ConvertMPX(statName);
STATS::STAT_SET_FLOAT(Joaat(statName), value, TRUE);
}
void SetDate(std::string statName, Date* value)
{
ConvertMPX(statName);
STATS::STAT_SET_DATE(Joaat(statName), value, sizeof(Date) / 8, TRUE);
}
void SetString(std::string statName, const char* value)
{
ConvertMPX(statName);
STATS::STAT_SET_STRING(Joaat(statName), value, TRUE);
}
int GetInt(std::string statName)
{
int value{};
ConvertMPX(statName);
STATS::STAT_GET_INT(Joaat(statName), &value, -1);
return value;
}
bool GetBool(std::string statName)
{
BOOL value{};
ConvertMPX(statName);
STATS::STAT_GET_BOOL(Joaat(statName), &value, -1);
return value;
}
float GetFloat(std::string statName)
{
float value{};
ConvertMPX(statName);
STATS::STAT_GET_FLOAT(Joaat(statName), &value, -1);
return value;
}
Date GetDate(std::string statName)
{
Date value{};
ConvertMPX(statName);
STATS::STAT_GET_DATE(Joaat(statName), &value, sizeof(Date) / 8, -1);
return value;
}
const char* GetString(std::string statName)
{
ConvertMPX(statName);
return STATS::STAT_GET_STRING(Joaat(statName), -1); // The native is null-safe
}
void SetPackedBool(int index, bool value)
{
STATS::SET_PACKED_STAT_BOOL_CODE(index, value, -1);
}
void SetPackedInt(int index, int value)
{
STATS::SET_PACKED_STAT_INT_CODE(index, value, -1);
}
bool GetPackedBool(int index)
{
return STATS::GET_PACKED_STAT_BOOL_CODE(index, -1);
}
int GetPackedInt(int index)
{
return STATS::GET_PACKED_STAT_INT_CODE(index, -1);
}
}
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include "core/util/Joaat.hpp"
namespace YimMenu::Stats
{
struct Date
{
alignas(8) int Year, Month, Day, Hour, Minute, Second, Millisecond;
};
extern int GetCharIndex();
extern void SetInt(std::string statName, int value);
extern void SetBool(std::string statName, bool value);
extern void SetFloat(std::string statName, float value);
extern void SetDate(std::string statName, Date* value);
extern void SetString(std::string statName, const char* value);
extern int GetInt(std::string statName);
extern bool GetBool(std::string statName);
extern float GetFloat(std::string statName);
extern Date GetDate(std::string statName);
extern const char* GetString(std::string statName);
extern void SetPackedBool(int index, bool value);
extern void SetPackedInt(int index, int value);
extern bool GetPackedBool(int index);
extern int GetPackedInt(int index);
}