mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-10 03:43:15 +08:00
feat: a few changes
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "game/pointers/Pointers.hpp" // game import in core!
|
||||
#include "game/gta/Natives.hpp" // game import in core!
|
||||
#include "game/frontend/GUI.hpp"
|
||||
|
||||
namespace YimMenu
|
||||
{
|
||||
@@ -94,7 +95,7 @@ namespace YimMenu
|
||||
{
|
||||
while (g_Running)
|
||||
{
|
||||
if (GetForegroundWindow() == *Pointers.Hwnd && !HUD::IS_PAUSE_MENU_ACTIVE() && !HUD::IS_SOCIAL_CLUB_ACTIVE() && !m_BeingModified)
|
||||
if (GetForegroundWindow() == *Pointers.Hwnd && !HUD::IS_PAUSE_MENU_ACTIVE() && !HUD::IS_SOCIAL_CLUB_ACTIVE() && !m_BeingModified && !GUI::IsUsingKeyboard())
|
||||
{
|
||||
for (auto& [hash, link] : m_CommandHotkeys)
|
||||
{
|
||||
|
||||
+14
-10
@@ -18,17 +18,21 @@ namespace YimMenu
|
||||
{
|
||||
while (g_Running)
|
||||
{
|
||||
CPed* ped_ptr = nullptr;
|
||||
if (auto factory = *Pointers.PedFactory)
|
||||
ped_ptr = factory->m_LocalPed;
|
||||
m_SelfPed = Ped(ped_ptr, PLAYER::PLAYER_PED_ID());
|
||||
m_SelfPlayer = Player(PLAYER::PLAYER_ID());
|
||||
if (m_SelfPed.IsValid())
|
||||
{
|
||||
m_Vehicle = m_SelfPed.GetVehicle();
|
||||
}
|
||||
|
||||
UpdateImpl();
|
||||
ScriptMgr::Yield();
|
||||
}
|
||||
}
|
||||
|
||||
void Self::UpdateImpl()
|
||||
{
|
||||
CPed* ped_ptr = nullptr;
|
||||
if (auto factory = *Pointers.PedFactory)
|
||||
ped_ptr = factory->m_LocalPed;
|
||||
m_SelfPed = Ped(ped_ptr, PLAYER::PLAYER_PED_ID());
|
||||
m_SelfPlayer = Player(PLAYER::PLAYER_ID());
|
||||
if (m_SelfPed.IsValid())
|
||||
{
|
||||
m_Vehicle = m_SelfPed.GetVehicle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,15 @@ namespace YimMenu
|
||||
GetInstance().RunScriptImpl();
|
||||
}
|
||||
|
||||
static void Update()
|
||||
{
|
||||
GetInstance().UpdateImpl();
|
||||
}
|
||||
|
||||
private:
|
||||
Self();
|
||||
void RunScriptImpl();
|
||||
void UpdateImpl();
|
||||
|
||||
static Self& GetInstance()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "core/commands/LoopedCommand.hpp"
|
||||
#include "game/backend/Self.hpp"
|
||||
#include "game/gta/Scripts.hpp"
|
||||
#include "types/script/globals/GPBD_FM_3.hpp"
|
||||
|
||||
namespace YimMenu::Features
|
||||
{
|
||||
class ForceThunder : public LoopedCommand
|
||||
{
|
||||
using LoopedCommand::LoopedCommand;
|
||||
|
||||
virtual void OnTick() override
|
||||
{
|
||||
if (auto global = GPBD_FM_3::Get(); global && Scripts::SafeToModifyFreemodeBroadcastGlobals())
|
||||
{
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] |= (1 << 9);
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] |= (1 << 10);
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] |= (1 << 11);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnDisable() override
|
||||
{
|
||||
if (auto global = GPBD_FM_3::Get(); global && Scripts::SafeToModifyFreemodeBroadcastGlobals())
|
||||
{
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] &= ~(1 << 9);
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] &= ~(1 << 10);
|
||||
global->Entries[Self::GetPlayer().GetId()].BossGoon.ActiveFreemodeEvents[0] &= ~(1 << 11);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ForceThunder _ForceThunder{"forcethunder", "Force Thunder", "Forces the weather to thunder for all players in the session"};
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "game/backend/Self.hpp"
|
||||
#include "game/commands/PlayerCommand.hpp"
|
||||
#include "types/script/globals/GlobalPlayerBD.hpp"
|
||||
#include "types/script/ScriptEvent.hpp"
|
||||
|
||||
namespace YimMenu::Features
|
||||
{
|
||||
class Blackscreen : public PlayerCommand
|
||||
{
|
||||
using PlayerCommand::PlayerCommand;
|
||||
|
||||
virtual void OnCall(Player player) override
|
||||
{
|
||||
OnCall(std::vector{player});
|
||||
}
|
||||
|
||||
virtual void OnCall(const std::vector<Player>& players) override
|
||||
{
|
||||
SCRIPT_EVENT_SEND_TO_PROPERTY message;
|
||||
message.Owner = Self::GetPlayer().GetId();
|
||||
message.PropertyIndex = 114;
|
||||
message.SubProperyIndex = 999;
|
||||
message.MissionPassNotify1 = true;
|
||||
message.MissionPassNotify2 = true;
|
||||
message.PAD_0004 = 999;
|
||||
message.Variation = 999;
|
||||
message.Flags = 3;
|
||||
for (auto& player : players)
|
||||
message.SetPlayer(player.GetId());
|
||||
message.Send();
|
||||
}
|
||||
};
|
||||
|
||||
static Blackscreen _Blackscreen{"blackscreen", "Blackscreen", "Forces the player into an infinite loading screen that can only be fixed by restarting the game"};
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include "core/commands/Command.hpp"
|
||||
#include "types/script/ScriptEvent.hpp"
|
||||
|
||||
namespace YimMenu::Features
|
||||
{
|
||||
class ForceLaunchHeist : public Command
|
||||
{
|
||||
using Command::Command;
|
||||
|
||||
virtual void OnCall() override
|
||||
{
|
||||
SCRIPT_EVENT_COMMAND event;
|
||||
event.Command = SCRIPT_EVENT_COMMAND::eCommand::LaunchHeist;
|
||||
event.SetAllPlayers();
|
||||
event.Send();
|
||||
}
|
||||
};
|
||||
|
||||
static ForceLaunchHeist _ForceLaunchHeist{"forcelaunchheist", "Force Launch Heist", "Forces the heist to launch from the setup screen"};
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace YimMenu
|
||||
{
|
||||
if (UIManager::ShowingContentWindow())
|
||||
{
|
||||
if (GUI::IsUsingKeyboard())
|
||||
if (GUI::IsUsingKeyboard() && PAD::IS_USING_KEYBOARD_AND_MOUSE(0))
|
||||
{
|
||||
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace YimMenu
|
||||
|
||||
static bool IsUsingKeyboard()
|
||||
{
|
||||
return ImGui::GetIO().WantTextInput;
|
||||
return ImGui::GetIO().WantCaptureKeyboard;
|
||||
}
|
||||
|
||||
static void RunScript()
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace YimMenu::Submenus
|
||||
auto toxicGroup = std::make_shared<Group>("Toxic");
|
||||
auto teleportGroup = std::make_shared<Group>("Teleport");
|
||||
auto trollGroup = std::make_shared<Group>("Troll");
|
||||
auto miscGroup = std::make_shared<Group>("Misc");
|
||||
auto enhancements = std::make_shared<Group>("Enhancements");
|
||||
|
||||
auto joinSession = std::make_shared<Group>("", 1);
|
||||
@@ -83,6 +84,8 @@ namespace YimMenu::Submenus
|
||||
toxicGroup->AddItem(std::make_shared<CommandItem>("explodeall"_J, "Explode All"));
|
||||
toxicGroup->AddItem(std::make_shared<CommandItem>("ceokickall"_J, "CEO Kick All"));
|
||||
|
||||
miscGroup->AddItem(std::make_shared<BoolCommandItem>("forcethunder"_J));
|
||||
|
||||
enhancements->AddItem(std::make_shared<BoolCommandItem>("notifyonplayerjoin"_J));
|
||||
enhancements->AddItem(std::make_shared<BoolCommandItem>("fastjoin"_J));
|
||||
enhancements->AddItem(std::make_shared<BoolCommandItem>("disabledeathbarriers"_J));
|
||||
@@ -97,6 +100,7 @@ namespace YimMenu::Submenus
|
||||
session->AddItem(trollGroup);
|
||||
session->AddItem(teleportGroup);
|
||||
session->AddItem(toxicGroup);
|
||||
session->AddItem(miscGroup);
|
||||
session->AddItem(enhancements);
|
||||
|
||||
auto spoofing = std::make_shared<Category>("Spoofing");
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace YimMenu::Submenus
|
||||
kicks->AddItem(std::make_shared<PlayerCommandItem>("endkick"_J));
|
||||
kicks->AddItem(std::make_shared<PlayerCommandItem>("nfkick"_J));
|
||||
|
||||
auto other = std::make_shared<Group>("Other");
|
||||
other->AddItem(std::make_shared<PlayerCommandItem>("blackscreen"_J));
|
||||
|
||||
menu->AddItem(kicks);
|
||||
menu->AddItem(other);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
@@ -23,16 +23,13 @@ namespace YimMenu::Submenus
|
||||
//auto casinoRoulette = std::make_shared<Group>("Roulette");
|
||||
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("playallmissionssolo"_J));
|
||||
generalGroup->AddItem(std::make_shared<CommandItem>("forcelaunchheist"_J));
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("unlockgtaplus"_J));
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("overriderpmultiplier"_J));
|
||||
generalGroup->AddItem(std::make_shared<ConditionalItem>("overriderpmultiplier"_J, std::make_shared<FloatCommandItem>("rpmultiplierinput"_J)));
|
||||
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("freechangeappearance"_J));
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("nochangeappearancecooldown"_J));
|
||||
generalGroup->AddItem(std::make_shared<BoolCommandItem>("allowgenderchange"_J));
|
||||
|
||||
|
||||
businessGroup->AddItem(std::make_shared<ListCommandItem>("businesssafe"_J));
|
||||
businessGroup->AddItem(std::make_shared<CommandItem>("claimsafeearnings"_J));
|
||||
|
||||
|
||||
@@ -64,7 +64,9 @@ namespace YimMenu::Submenus
|
||||
// not sure why people do this
|
||||
if (len > 1 && name_str[0] == '$')
|
||||
{
|
||||
name_str = std::string_view{name_str.begin()++, name_str.end()};
|
||||
auto it = name_str.begin();
|
||||
std::advance(it, 1);
|
||||
name_str = std::string_view{it, name_str.end()};
|
||||
len--;
|
||||
name.m_Normalized = true;
|
||||
}
|
||||
@@ -340,7 +342,7 @@ namespace YimMenu::Submenus
|
||||
ImGui::Text("Normalized name to: %s", current_info.m_Name.data());
|
||||
}
|
||||
|
||||
bool can_edit = !current_info.m_Data->IsServerAuthoritative() || AnticheatBypass::IsFSLProvidingLocalSaves(); // TODO: a lot of false positives and negatives with this one
|
||||
bool can_edit = !current_info.m_Data->IsControlledByNetshop();
|
||||
|
||||
RenderStatEditor(value, current_info.m_Data);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "types/ped/PedCombatAttribute.hpp"
|
||||
#include "game/gta/data/Weapons.hpp"
|
||||
#include "game/gta/Scripts.hpp"
|
||||
#include "game/backend/NativeHooks.hpp"
|
||||
|
||||
namespace YimMenu::Submenus
|
||||
{
|
||||
@@ -48,10 +49,14 @@ namespace YimMenu::Submenus
|
||||
ImGui::PushID(name);
|
||||
if (ImGui::Selectable(name))
|
||||
{
|
||||
FiberPool::Push([name] {
|
||||
auto set_player = ImGui::GetIO().KeyCtrl;
|
||||
FiberPool::Push([name, set_player] {
|
||||
auto hash = Joaat(name);
|
||||
auto handle = Ped::Create(hash, Self::GetPed().GetPosition(), Self::GetPed().GetHeading());
|
||||
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
handle.SetCombatAttribute(PedCombatAttribute::AlwaysFight, true);
|
||||
handle.SetCombatAttribute(PedCombatAttribute::DisableAllRandomsFlee, true);
|
||||
handle.SetCombatAttribute(PedCombatAttribute::DisableFleeFromCombat, true);
|
||||
@@ -66,7 +71,7 @@ namespace YimMenu::Submenus
|
||||
if (spawnDead)
|
||||
handle.Kill();
|
||||
|
||||
if (spawnAsBodyguard)
|
||||
if (spawnAsBodyguard && !set_player)
|
||||
{
|
||||
handle.SetCombatAttribute(PedCombatAttribute::CanCharge, true);
|
||||
handle.SetCombatAttribute(PedCombatAttribute::CanCommandeerVehicles, true);
|
||||
@@ -116,7 +121,41 @@ namespace YimMenu::Submenus
|
||||
}
|
||||
}
|
||||
|
||||
spawnedPeds.push_back(handle);
|
||||
if (set_player)
|
||||
{
|
||||
static auto hooked = []()
|
||||
{
|
||||
NativeHooks::AddHook("freemode"_J, NativeIndex::GET_ENTITY_MODEL, [](rage::scrNativeCallContext* ctx) {
|
||||
auto model = ENTITY::GET_ENTITY_MODEL(ctx->GetArg<int>(0));
|
||||
|
||||
if (ctx->GetArg<int>(0) == Self::GetPed().GetHandle() && (model != "mp_m_freemode_01"_J && model != "mp_f_freemode_01"_J))
|
||||
{
|
||||
return ctx->SetReturnValue("mp_m_freemode_01"_J);
|
||||
}
|
||||
|
||||
return ctx->SetReturnValue(model);
|
||||
});
|
||||
for (auto script : {"main"_J, "respawn_controller"_J, "pi_menu"_J})
|
||||
{
|
||||
NativeHooks::AddHook(script, NativeIndex::GET_ENTITY_MODEL, [](rage::scrNativeCallContext* ctx) {
|
||||
auto model = ENTITY::GET_ENTITY_MODEL(ctx->GetArg<int>(0));
|
||||
|
||||
if (ctx->GetArg<int>(0) == Self::GetPed().GetHandle() && (model != "player_zero"_J && model != "player_one"_J && model != "player_two"_J))
|
||||
{
|
||||
return ctx->SetReturnValue("player_zero"_J);
|
||||
}
|
||||
|
||||
return ctx->SetReturnValue(model);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
Self::GetPlayer().SetPed(handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnedPeds.push_back(handle);
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui::PopID();
|
||||
@@ -128,6 +167,7 @@ namespace YimMenu::Submenus
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
ImGui::BulletText("Ctrl+Click to set player model");
|
||||
ImGui::Checkbox("Invincible", &invincible);
|
||||
ImGui::Checkbox("Spawn Dead", &spawnDead);
|
||||
ImGui::Checkbox("Spawn As Bodyguard", &spawnAsBodyguard);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "game/backend/Players.hpp"
|
||||
#include "game/gta/Vehicle.hpp"
|
||||
#include "types/network/sync/nodes/vehicle/CVehicleProximityMigrationDataNode.hpp"
|
||||
#include "game/backend/Self.hpp"
|
||||
|
||||
namespace YimMenu
|
||||
{
|
||||
@@ -357,6 +358,15 @@ namespace YimMenu
|
||||
return PLAYER::GET_PLAYER_GROUP(GetId());
|
||||
}
|
||||
|
||||
void Player::SetPed(Ped ped, bool delete_old)
|
||||
{
|
||||
auto old_ped = Self::GetPed();
|
||||
PLAYER::CHANGE_PLAYER_PED(GetId(), ped.GetHandle(), true, true);
|
||||
Self::Update();
|
||||
if (delete_old)
|
||||
old_ped.Delete();
|
||||
}
|
||||
|
||||
bool Player::operator==(Player other)
|
||||
{
|
||||
return m_Handle == other.m_Handle;
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace YimMenu
|
||||
|
||||
int GetGroup();
|
||||
|
||||
void SetPed(Ped ped, bool delete_old = true);
|
||||
|
||||
bool operator==(Player other);
|
||||
|
||||
inline operator bool()
|
||||
|
||||
@@ -57,6 +57,11 @@ public:
|
||||
{
|
||||
return (m_Flags & 0x80) != 0;
|
||||
}
|
||||
|
||||
inline bool IsControlledByNetshop() const
|
||||
{
|
||||
return (m_Flags & 0x8000000) != 0;
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(sStatData) == 0x10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user