Skip to content

Commit

Permalink
Many Features + Protections (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxann authored May 21, 2024
1 parent d5902de commit 232154f
Show file tree
Hide file tree
Showing 20 changed files with 524 additions and 92 deletions.
4 changes: 3 additions & 1 deletion src/core/commands/Command.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once
#include "util/Joaat.hpp"

#include <nlohmann/json.hpp>


namespace YimMenu
{
class Command
Expand All @@ -12,7 +14,7 @@ namespace YimMenu
std::string m_Description;
joaat_t m_Hash;

int m_NumArgs = 0; // TODO: currently unused
int m_NumArgs = 0; // TODO: currently unused

protected:
virtual void OnCall() = 0;
Expand Down
22 changes: 22 additions & 0 deletions src/game/features/players/toxic/CagePlayerLarge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "game/commands/PlayerCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"
#include "util/SpawnObject.hpp"


namespace YimMenu::Features
{
class CagePlayerLarge : public PlayerCommand
{
using PlayerCommand::PlayerCommand;

virtual void OnCall(Player player) override
{
Vector3 coords = ENTITY::GET_ENTITY_COORDS(player.GetPed().GetHandle(), true, true);
coords.z = coords.z - 1.0f;
SpawnObject(0x99C0CFCF, coords);
}
};

static CagePlayerLarge _CagePlayerLarge{"cageplayerlarge", "Cage Player(Large)", "Cages the player using a larger cage"};
}
22 changes: 22 additions & 0 deletions src/game/features/players/toxic/CagePlayerSmall.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "game/commands/PlayerCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"
#include "util/SpawnObject.hpp"


namespace YimMenu::Features
{
class CagePlayerSmall : public PlayerCommand
{
using PlayerCommand::PlayerCommand;

virtual void OnCall(Player player) override
{
Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player.GetId()), true, true);
coords.z = coords.z - 1.0f;
SpawnObject(0xF3D580D3, coords);
}
};

static CagePlayerSmall _CagePlayerSmall{"cageplayersmall", "Cage Player(Small)", "Cages the player using a smaller cage"};
}
22 changes: 22 additions & 0 deletions src/game/features/players/toxic/Circus.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "game/commands/PlayerCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"
#include "util/VehicleSpawner.hpp"


namespace YimMenu::Features
{
class Circus : public PlayerCommand
{
using PlayerCommand::PlayerCommand;

virtual void OnCall(Player player) override
{
float rot = ENTITY::GET_ENTITY_ROTATION(player.GetPed().GetHandle(), 0).z;
Vector3 coords = ENTITY::GET_ENTITY_COORDS(player.GetPed().GetHandle(), true, true);
SpawnVehicle("wagonCircus01x", coords, rot);
}
};

static Circus _Circus{"circus", "Circus", "Cages the player using a circus wagon"};
}
31 changes: 31 additions & 0 deletions src/game/features/self/AntiMelee.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"


namespace YimMenu::Features
{

class AntiMelee : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
for (int i = 0; i < 35; i++)
{
PED::_SET_PED_TARGET_ACTION_DISABLE_FLAG(Self::PlayerPed, i);
}
}

virtual void OnDisable() override
{
for (int i = 0; i < 35; i++)
{
PED::_CLEAR_PED_TARGET_ACTION_DISABLE_FLAG(Self::PlayerPed, i);
}
}
};

static AntiMelee _AntiMelee{"antimelee", "Anti Melee", "Disables getting assaulted by other players."};
}
29 changes: 29 additions & 0 deletions src/game/features/self/FlamingHooves.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"

namespace YimMenu
{
class FlamingHooves : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnEnable() override
{
PED::SET_PED_CONFIG_FLAG(Self::Mount, 207, true);
}

virtual void OnTick() override
{
if (!PED::GET_PED_CONFIG_FLAG(Self::Mount, 207, true))
PED::SET_PED_CONFIG_FLAG(Self::Mount, 207, true);
}

virtual void OnDisable() override
{
PED::SET_PED_CONFIG_FLAG(Self::Mount, 207, false);
}
};

static FlamingHooves _FlamingHooves{"flaminghooves", "Flaming Hooves", "Your horse will have flaming hooves."};
}
1 change: 1 addition & 0 deletions src/game/features/self/KeepClean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace YimMenu::Features
PED::CLEAR_PED_WETNESS(Self::PlayerPed);
PED::CLEAR_PED_ENV_DIRT(Self::PlayerPed);
PED::CLEAR_PED_BLOOD_DAMAGE(Self::PlayerPed);
PED::CLEAR_PED_DAMAGE_DECAL_BY_ZONE(Self::PlayerPed, 10, "ALL");
}
};

Expand Down
31 changes: 31 additions & 0 deletions src/game/features/self/SpawnBountyWagon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "core/commands/Command.hpp"
#include "core/frontend/Notifications.hpp"
#include "game/features/Features.hpp"
#include "util/VehicleSpawner.hpp"


namespace YimMenu::Features
{
class SpawnBountyWagon : public Command
{
using Command::Command;

virtual void OnCall() override
{
Vector3 dim1, dim2;
MISC::GET_MODEL_DIMENSIONS(MISC::GET_HASH_KEY("wagonarmoured01x"), &dim1, &dim2);
float offset = dim2.y * 1.6;

Vector3 dir = ENTITY::GET_ENTITY_FORWARD_VECTOR(Self::PlayerPed);
float rot = (ENTITY::GET_ENTITY_ROTATION(Self::PlayerPed, 0)).z;
Vector3 pos = ENTITY::GET_ENTITY_COORDS(Self::PlayerPed, true, true);

int handle = SpawnVehicle("wagonarmoured01x",
Vector3{pos.x + (dir.x * offset), pos.y + (dir.y * offset), pos.z},
ENTITY::GET_ENTITY_ROTATION(Self::PlayerPed, 0).z);
VEHICLE::SET_PED_OWNS_VEHICLE(Self::PlayerPed, handle);
}
};

static SpawnBountyWagon _SpawnBountyWagon{"spawnbountywagon", "Spawn Bounty Wagon", "Spawns the bounty hunter wagon into the game."};
}
35 changes: 35 additions & 0 deletions src/game/features/self/SpawnHuntingWagon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "core/commands/Command.hpp"
#include "core/frontend/Notifications.hpp"
#include "game/features/Features.hpp"
#include "util/VehicleSpawner.hpp"


namespace YimMenu::Features
{
class SpawnHuntingWagon : public Command
{
using Command::Command;

virtual void OnCall() override
{
Vector3 dim1, dim2;
MISC::GET_MODEL_DIMENSIONS(MISC::GET_HASH_KEY("huntercart01"), &dim1, &dim2);
float offset = dim2.y * 1.6;

Vector3 dir = ENTITY::GET_ENTITY_FORWARD_VECTOR(Self::PlayerPed);
float rot = (ENTITY::GET_ENTITY_ROTATION(Self::PlayerPed, 0)).z;
Vector3 pos = ENTITY::GET_ENTITY_COORDS(Self::PlayerPed, true, true);

int handle = SpawnVehicle("huntercart01",
Vector3{pos.x + (dir.x * offset), pos.y + (dir.y * offset), pos.z},
ENTITY::GET_ENTITY_ROTATION(Self::PlayerPed, 0).z);

PLAYER::_SET_PLAYER_HUNTING_WAGON(Self::Id, handle);
VEHICLE::SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(handle, true);
VEHICLE::SET_PED_OWNS_VEHICLE(Self::PlayerPed, handle);
Notifications::Show("Vehicle Spawner", "Wagon Spawned!", NotificationType::Success);
};
};

static SpawnHuntingWagon _SpawnHuntingWagon{"spawnhuntingwagon", "Spawn Hunting Wagon", "Spawns the hunting wagon for the trader role."};
}
26 changes: 0 additions & 26 deletions src/game/features/self/SpawnWagon.cpp

This file was deleted.

46 changes: 41 additions & 5 deletions src/game/frontend/submenus/Players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <string>



// remove after testing
#include "core/frontend/Notifications.hpp"
#include "game/backend/FiberPool.hpp"
Expand Down Expand Up @@ -95,6 +94,19 @@ namespace YimMenu::Submenus
{
YimMenu::Players::SetSelected(Self::Id);
}
if (ImGui::Button("View SC Profile"))
FiberPool::Push([] {
uint64_t handle[18];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(YimMenu::Players::GetSelected().GetId(), (Any*)&handle);
NETWORK::NETWORK_SHOW_PROFILE_UI((Any*)&handle);
});

if (ImGui::Button("Add Friend"))
FiberPool::Push([] {
uint64_t handle[18];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(YimMenu::Players::GetSelected().GetId(), (Any*)&handle);
NETWORK::NETWORK_ADD_FRIEND((Any*)&handle, "");
});
}));

// TODO: refactor teleport items
Expand Down Expand Up @@ -150,14 +162,35 @@ namespace YimMenu::Submenus
ImGui::Text(YimMenu::Players::GetSelected().GetName());
}));
helpful->AddItem(std::make_shared<ImGuiItem>([] {
if (ImGui::Button("Spawn Wagon for Player"))
if (ImGui::Button("Spawn Bounty Wagon for Player"))
{
FiberPool::Push([] {
SpawnVehicle("wagonarmoured01x",
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(YimMenu::Players::GetSelected().GetId()));
Notifications::Show("Spawned Wagon", "Spawned Wagon for Player", NotificationType::Success);
Vector3 coords = ENTITY::GET_ENTITY_COORDS(YimMenu::Players::GetSelected().GetPed().GetHandle(), true, true);
float rot = ENTITY::GET_ENTITY_ROTATION(YimMenu::Players::GetSelected().GetPed().GetHandle(), 0).z;
SpawnVehicle("wagonarmoured01x", coords, rot);
Notifications::Show("Spawned Wagon", "Spawned Bounty Wagon for Player", NotificationType::Success);
});
};
if (ImGui::Button("Spawn Hunting Wagon for Player"))
{
FiberPool::Push([] {
int id = YimMenu::Players::GetSelected().GetId();
auto ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(id);
Vector3 dim1, dim2;
MISC::GET_MODEL_DIMENSIONS(MISC::GET_HASH_KEY("huntercart01"), &dim1, &dim2);
float offset = dim2.y * 1.6;

Vector3 dir = ENTITY::GET_ENTITY_FORWARD_VECTOR(ped);
float rot = (ENTITY::GET_ENTITY_ROTATION(ped, 0)).z;
Vector3 pos = ENTITY::GET_ENTITY_COORDS(ped, true, true);

int handle = SpawnVehicle("huntercart01",
Vector3{pos.x + (dir.x * offset), pos.y + (dir.y * offset), pos.z},
ENTITY::GET_ENTITY_ROTATION(ped, 0).z);
PLAYER::_SET_PLAYER_HUNTING_WAGON(id, handle);
Notifications::Show("Spawned Wagon", "Spawned Hunting Wagon for Player", NotificationType::Success);
});
}
}));

AddCategory(std::move(helpful));
Expand Down Expand Up @@ -193,6 +226,9 @@ namespace YimMenu::Submenus
toxic->AddItem(std::make_shared<PlayerCommandItem>("offensive"_J));
toxic->AddItem(std::make_shared<PlayerCommandItem>("maxhonor"_J));
toxic->AddItem(std::make_shared<PlayerCommandItem>("minhonor"_J));
toxic->AddItem(std::make_shared<PlayerCommandItem>("cageplayersmall"_J));
toxic->AddItem(std::make_shared<PlayerCommandItem>("cageplayerlarge"_J));
toxic->AddItem(std::make_shared<PlayerCommandItem>("circus"_J));

toxic->AddItem(std::make_shared<ImGuiItem>([] {
if (ImGui::Button("Test"))
Expand Down
14 changes: 13 additions & 1 deletion src/game/frontend/submenus/Self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace YimMenu::Submenus
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("keepclean"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antilasso"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antihogtie"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antimelee"_J));

globalsGroup->AddItem(std::make_shared<BoolCommandItem>("drunk"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("autotp"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("superjump"_J));
Expand All @@ -94,7 +96,8 @@ namespace YimMenu::Submenus
}));

toolsGroup->AddItem(std::make_shared<BoolCommandItem>("npcignore"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("spawnwagon"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("spawnbountywagon"_J));
toolsGroup->AddItem(std::make_shared<CommandItem>("spawnhuntingwagon"_J));

movementGroup->AddItem(std::make_shared<BoolCommandItem>("noclip"_J));

Expand All @@ -113,7 +116,16 @@ namespace YimMenu::Submenus
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorsebarsfilled"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorsecoresfilled"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorseagitationlow"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("flaminghooves"_J));
horseGlobalsGroup->AddItem(std::make_shared<CommandItem>("tpmounttoself"_J));
static int horseScale = 1;
horseGlobalsGroup->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::Text("Horse Scale");
if (ImGui::InputInt(" ", &horseScale))
FiberPool::Push([] {
PED::_SET_PED_SCALE(YimMenu::Self::Mount, (float)horseScale);
});
}));
horseColumns->AddItem(horseGlobalsGroup);
horse->AddItem(horseColumns);
AddCategory(std::move(horse));
Expand Down
Loading

0 comments on commit 232154f

Please sign in to comment.