feat: add custom weapons (#388)

* added custom weapons

* remove SameLineItem

* some fixes

* no changes

* more fixes

* some changes
This commit is contained in:
kurumimeow
2025-07-08 03:50:20 +05:30
committed by GitHub
parent 5407207984
commit dd6907bf14
21 changed files with 830 additions and 76 deletions
+85
View File
@@ -0,0 +1,85 @@
#pragma once
namespace YimMenu
{
struct Color
{
float r;
float g;
float b;
float a;
Color(float red = 0.f, float green = 0.f, float blue = 0.f, float alpha = 255.f) :
r(red),
g(green),
b(blue),
a(alpha)
{
}
Color(ImVec4 color) :
r(color.x),
g(color.y),
b(color.z),
a(color.w)
{
}
};
enum class RainbowColorStyle
{
Fade,
Spasm
};
inline void RainbowColor(Color& color, int speed = 1, RainbowColorStyle type = RainbowColorStyle::Fade)
{
static bool firstInit = true;
static std::chrono::system_clock::time_point lastRunTime;
if (type == RainbowColorStyle::Spasm)
{
auto delay = std::chrono::milliseconds(std::max(10, 1010 - (speed * 100)));
if (lastRunTime + delay < std::chrono::system_clock::now())
{
color.r = rand() % 256;
color.g = rand() % 256;
color.b = rand() % 256;
lastRunTime = std::chrono::system_clock::now();
firstInit = true;
}
}
if (type == RainbowColorStyle::Fade)
{
if (firstInit)
{
color.r = 255;
color.g = 0;
color.b = 0;
firstInit = false;
}
if (color.r > 0 && color.b == 0)
{
color.g += speed;
color.r -= speed;
}
if (color.g > 0 && color.r == 0)
{
color.b += speed;
color.g -= speed;
}
if (color.b > 0 && color.g == 0)
{
color.r += speed;
color.b -= speed;
}
color.r = std::clamp(color.r, 0.f, 255.f);
color.g = std::clamp(color.g, 0.f, 255.f);
color.b = std::clamp(color.b, 0.f, 255.f);
}
}
}
+381
View File
@@ -0,0 +1,381 @@
#include "CustomWeapon.hpp"
#include "core/backend/FiberPool.hpp"
#include "core/backend/ScriptMgr.hpp"
#include "core/frontend/Notifications.hpp"
#include "game/backend/Self.hpp"
#include "game/gta/Object.hpp"
#include "types/entity/DecalTypes.hpp"
#include "types/script/Timer.hpp"
#include "game/gta/RayCast.hpp"
namespace YimMenu::Features
{
void CustomWeapon::OnTick()
{
bool isCustomWeaponActionAllowed = !_CustomWeaponEnabledOnWeaponOut.GetState() || WEAPON::IS_PED_ARMED(Self::GetPed().GetHandle(), 4 | 2);
if (!isCustomWeaponActionAllowed)
return;
CustomWeapons selectedWeaponType = static_cast<CustomWeapons>(_CustomWeaponType.GetState());
for (const auto& control : attackControls)
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(control), true);
Entity m_Entity{nullptr};
switch (selectedWeaponType)
{
case CustomWeapons::CAGE_GUN:
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
FiberPool::Push([=]() mutable {
if (RayCast(&m_Entity).Cast())
{
if (m_Entity.IsPed())
{
auto location = m_Entity.GetPosition();
location.z -= 1.0f;
Object::Create("prop_gold_cont_01"_J, location);
}
else
{
Notifications::Show("Custom Weapon", "Entity is not a ped.", NotificationType::Warning);
}
}
});
}
}
break;
}
case CustomWeapons::DELETE_GUN:
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
if (RayCast(&m_Entity).Cast())
{
if (m_Entity.IsPed() && m_Entity.IsPlayer())
Notifications::Show("Custom Weapon", "Player entity cannot be deleted.", NotificationType::Warning);
else
{
auto location = m_Entity.GetPosition();
auto distance = Self::GetPed().GetPosition().GetDistance(location);
if (distance > 500)
Notifications::Show("Custom Weapon", "Entity is too far.", NotificationType::Warning);
else
m_Entity.Delete();
}
}
}
}
break;
}
case CustomWeapons::GRAVITY_GUN:
{
static std::vector<Entity> entities;
static Vector3 location;
static Vector3 entityPos;
static float distance;
static constexpr double multiplier = 3.0;
static const int scroll = 0;
auto ApplyVelocity = [](Entity entity) {
if (entity.IsValid())
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT))
distance -= 5;
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV))
distance += 5;
if (!entity.RequestControl(0))
return;
entity.SetCollision(false);
entityPos = entity.GetPosition();
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
float pitch = Math::DegToRad(rot.x); // vertical
// float roll = rot.y;
float yaw = Math::DegToRad(rot.z + 90); // horizontal
Vector3 velocity;
velocity.x = location.x + (distance * cos(pitch) * cos(yaw)) - entityPos.x;
velocity.y = location.y + (distance * sin(yaw) * cos(pitch)) - entityPos.y;
velocity.z = location.z + (distance * sin(pitch)) - entityPos.z;
velocity.x *= (float)multiplier;
velocity.y *= (float)multiplier;
velocity.z *= (float)multiplier;
entity.SetVelocity(velocity);
entity.SetAlpha(105);
}
};
FiberPool::Push([=]() mutable {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
location = Self::GetPed().GetPosition();
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{
if (RayCast(&m_Entity).Cast())
{
auto entityHandle = m_Entity.GetHandle();
if (m_Entity.IsPed() && m_Entity.IsPlayer())
{
Notifications::Show("Custom Weapon", "Gravity gun cannot be applied on player entity.", NotificationType::Warning);
}
else
{
const auto tempDistance = m_Entity.GetPosition().GetDistance(location);
if (entities.size() == 0)
{
distance = tempDistance;
}
if (tempDistance > 500)
{
Notifications::Show("Custom Weapon", "Entity is too far.", NotificationType::Warning);
}
else
{
if (m_Entity.RequestControl(0) && m_Entity.IsPed() && !PED::IS_PED_RAGDOLL(entityHandle))
{
TASK::SET_HIGH_FALL_TASK(entityHandle, 0, 0, 0);
}
entities.push_back(m_Entity);
}
}
}
}
if (entities.size() > 0)
{
for (const auto& entity : entities)
{
ApplyVelocity(entity);
}
}
}
else if (entities.size() > 0)
{
for (Entity& entity : entities)
{
if (entity.RequestControl(0))
{
if (_GravityGunLaunchOnRelease.GetState())
{
distance += 100;
ApplyVelocity(entity);
}
entity.SetCollision(true);
entity.ResetAlpha();
}
}
entities.clear();
}
});
break;
}
case CustomWeapons::STEAL_VEHICLE_GUN:
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
if (RayCast(&m_Entity).Cast())
{
auto entityHandle = m_Entity.GetHandle();
if (m_Entity.IsVehicle())
{
for (size_t i = 0; i < 8 && !m_Entity.As<Vehicle>().IsSeatFree(-1); i++)
{
const auto ped = VEHICLE::GET_PED_IN_VEHICLE_SEAT(entityHandle, -1, 0);
if (PED::IS_PED_A_PLAYER(ped))
return
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
}
Self::GetPed().SetInVehicle(m_Entity.As<Vehicle>(), -1);
}
else
{
Notifications::Show("Custom Weapon", "Invalid vehicle.", NotificationType::Warning);
}
}
}
}
break;
}
case CustomWeapons::REPAIR_GUN:
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
if (RayCast(&m_Entity).Cast())
{
if (m_Entity.IsVehicle())
{
m_Entity.As<Vehicle>().Fix();
}
else
{
Notifications::Show("Custom Weapon", "Invalid vehicle.", NotificationType::Warning);
}
}
}
}
break;
}
case CustomWeapons::VEHICLE_GUN:
{
static TIMER vehicleGunTimer;
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK) && vehicleGunTimer.HasTimePassed(100, true))
{
if (!_VehicleGunModel.GetString().length())
{
Notifications::Show("Custom Weapon", "No vehicle model name provided.", NotificationType::Error);
return;
}
auto modelHash = Joaat(_VehicleGunModel.GetString());
if (!STREAMING::IS_MODEL_IN_CDIMAGE(modelHash))
{
Notifications::Show("Custom Weapon", "Invalid vehicle model name provided.", NotificationType::Error);
}
else
{
Vector3 location = CAM::GET_GAMEPLAY_CAM_COORD();
FiberPool::Push([location, modelHash]() {
constexpr int rotation_order = 2;
auto rot = CAM::GET_GAMEPLAY_CAM_ROT(rotation_order);
float pitch = Math::DegToRad(rot.x); // vertical
//float roll = rot.y;
float yaw = Math::DegToRad(rot.z); // horizontal
Vector3 forward{-sin(yaw) * cos(pitch), cos(yaw) * cos(pitch), sin(pitch)};
Vector3 spawnLoc = location;
spawnLoc.x += forward.x * 10.f;
spawnLoc.y += forward.y * 10.f;
spawnLoc.z += forward.z * 10.f;
auto veh = Vehicle::Create(modelHash, spawnLoc, Self::GetPed().GetHeading(), false);
Vector3 velocity{forward.x * 150.f, forward.y * 150.f, forward.z * 150.f};
veh.SetRotation(rot, rotation_order);
veh.SetVelocity(velocity);
auto vehHandle = veh.GetHandle();
ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&vehHandle);
});
}
vehicleGunTimer.Reset(true);
}
}
break;
}
case CustomWeapons::TELEPORT_GUN:
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
Vector3 coords;
if (RayCast(&m_Entity, &coords).Cast())
{
if (m_Entity.IsVehicle())
{
Self::GetPed().SetInVehicle(m_Entity.As<Vehicle>(), -2);
}
else
{
if (Self::GetVehicle())
TASK::CLEAR_PED_TASKS_IMMEDIATELY(Self::GetPed().GetHandle());
Self::GetPed().TeleportTo(coords);
}
}
}
}
break;
}
case CustomWeapons::PAINT_GUN:
{
static Color paintGunColor;
Color color;
if (_PaintGunRainbowColorEnabled.GetState())
{
RainbowColor(paintGunColor, _PaintGunRainbowColorSpeed.GetState(), static_cast<RainbowColorStyle>(_PaintGunRainbowColorStyle.GetState()));
color = Color(paintGunColor.r / 255.f, paintGunColor.g / 255.f, paintGunColor.b / 255.f, paintGunColor.a / 255.f);
}
else
{
color = Color(_PaintGunColor.GetState());
}
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{
Vector3 coords;
if (RayCast(&coords).Cast())
{
GRAPHICS::ADD_DECAL((int)DecalTypes::splatters_paint,
coords.x,
coords.y,
coords.z,
0, //true
0, //true
-1, //true
0,
1.f,
0.f, // always 0
0.5f, //size x
0.4f, //size y
color.r,
color.g,
color.b,
color.a,
-1,
true,
false,
false);
}
}
}
break;
}
default: break;
}
}
}
+72
View File
@@ -0,0 +1,72 @@
#pragma once
#include "core/commands/BoolCommand.hpp"
#include "core/commands/ColorCommand.hpp"
#include "core/commands/IntCommand.hpp"
#include "core/commands/ListCommand.hpp"
#include "core/commands/LoopedCommand.hpp"
#include "core/commands/StringCommand.hpp"
#include "core/util/Math.hpp"
#include "core/util/RainbowColor.hpp"
#include "game/gta/Entity.hpp"
#include "game/gta/Natives.hpp"
#include "types/pad/ControllerInputs.hpp"
namespace YimMenu::Features
{
enum class CustomWeapons
{
CAGE_GUN,
DELETE_GUN,
GRAVITY_GUN,
STEAL_VEHICLE_GUN,
REPAIR_GUN,
VEHICLE_GUN,
TELEPORT_GUN,
PAINT_GUN
};
static const ControllerInputs attackControls[] = {
ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
ControllerInputs::INPUT_ATTACK,
ControllerInputs::INPUT_ATTACK2,
ControllerInputs::INPUT_VEH_ATTACK,
ControllerInputs::INPUT_VEH_ATTACK2,
ControllerInputs::INPUT_VEH_PASSENGER_ATTACK,
ControllerInputs::INPUT_VEH_FLY_ATTACK,
ControllerInputs::INPUT_VEH_FLY_ATTACK2,
};
static std::vector<std::pair<int, const char*>> g_CustomWeaponTypes = {
{static_cast<int>(CustomWeapons::CAGE_GUN), "Cage Gun"},
{static_cast<int>(CustomWeapons::DELETE_GUN), "Delete Gun"},
{static_cast<int>(CustomWeapons::GRAVITY_GUN), "Gravity Gun"},
{static_cast<int>(CustomWeapons::STEAL_VEHICLE_GUN), "Steal Vehicle Gun"},
{static_cast<int>(CustomWeapons::REPAIR_GUN), "Repair Gun"},
{static_cast<int>(CustomWeapons::VEHICLE_GUN), "Vehicle Gun"},
{static_cast<int>(CustomWeapons::TELEPORT_GUN), "Teleport Gun"},
{static_cast<int>(CustomWeapons::PAINT_GUN), "Paint Gun"},
};
static ListCommand _CustomWeaponType{"customweapontype", "Weapon Type", "The type of custom weapon to use", g_CustomWeaponTypes, static_cast<int>(CustomWeapons::CAGE_GUN)};
static std::vector<std::pair<int, const char*>> g_PaintGunRainbowColorStyles = {
{static_cast<int>(RainbowColorStyle::Fade), "Fade"},
{static_cast<int>(RainbowColorStyle::Spasm), "Spasm"}
};
static ListCommand _PaintGunRainbowColorStyle{"paintgunrainbowcolorstyle", "Rainbow Color Style", "Style of rainbow color for paint gun", g_PaintGunRainbowColorStyles, static_cast<int>(RainbowColorStyle::Fade)};
class CustomWeapon : public LoopedCommand
{
using LoopedCommand::LoopedCommand;
virtual void OnTick() override;
};
static CustomWeapon _CustomWeapon{"customweapon", "Custom Weapon", "Modifies weapon ability"};
static BoolCommand _CustomWeaponEnabledOnWeaponOut{"customweaponenabledonweaponout", "Enable Only if Weapon is Out", "Enables custom weapon only when weapon is out", true};
static BoolCommand _GravityGunLaunchOnRelease{"gravitygunlaunchonrelease", "Launch Entity on Release", "Launches entity when released", false};
static StringCommand _VehicleGunModel{"vehiclegunmodel", "Vehicle Model", "Model of the vehicle"};
static ColorCommand _PaintGunColor{"paintguncolor", "Paint Gun Color", "Color of the paint gun"};
static BoolCommand _PaintGunRainbowColorEnabled{"paintgunrainbowcolorenabled", "Rainbow Color", "Enables rainbow color for paint gun", false};
static IntCommand _PaintGunRainbowColorSpeed{"paintgunrainbowcolorspeed", "Rainbow Color Speed", "Speed of rainbow color for paint gun", 1, 10, 1};
}
+19 -10
View File
@@ -7,25 +7,34 @@
namespace YimMenu
{
ConditionalItem::ConditionalItem(joaat_t bool_cmd_id, std::shared_ptr<UIItem> to_draw, bool negate) :
m_Condition(Commands::GetCommand<BoolCommand>(bool_cmd_id)),
m_Item(to_draw),
m_Negate(negate)
m_Condition(Commands::GetCommand<BoolCommand>(bool_cmd_id)),
m_ConditionFn(nullptr),
m_Item(to_draw),
m_Negate(negate)
{
}
ConditionalItem::ConditionalItem(std::function<bool()> condition_fn, std::shared_ptr<UIItem> to_draw, bool negate) :
m_Condition(nullptr),
m_ConditionFn(condition_fn),
m_Item(to_draw),
m_Negate(negate)
{
}
void ConditionalItem::Draw()
{
if (!m_Condition)
{
return;
}
if (m_Condition->GetState() ^ m_Negate)
if (CanDraw())
m_Item->Draw();
}
bool ConditionalItem::CanDraw()
{
return m_Condition->GetState() ^ m_Negate;
if (m_Condition)
return m_Condition->GetState() ^ m_Negate;
else if (m_ConditionFn)
return m_ConditionFn() ^ m_Negate;
return false;
}
}
+18
View File
@@ -116,11 +116,13 @@ namespace YimMenu
{
public:
explicit ConditionalItem(joaat_t bool_cmd_id, std::shared_ptr<UIItem> to_draw, bool negate = false);
explicit ConditionalItem(std::function<bool()> condition_fn, std::shared_ptr<UIItem> to_draw, bool negate = false);
void Draw() override;
bool CanDraw() override;
private:
BoolCommand* m_Condition;
std::function<bool()> m_ConditionFn;
std::shared_ptr<UIItem> m_Item;
bool m_Negate;
};
@@ -206,6 +208,22 @@ namespace YimMenu
std::vector<std::shared_ptr<UIItem>> m_Items;
};
class TabBarItem : public UIItem
{
public:
explicit TabBarItem(const std::string& id);
void Draw() override;
void AddItem(std::shared_ptr<TabItem>&& tab)
{
m_Tabs.push_back(std::move(tab));
}
private:
std::string m_Id;
std::vector<std::shared_ptr<TabItem>> m_Tabs;
};
class CollapsingHeaderItem : public UIItem
{
public:
+22
View File
@@ -0,0 +1,22 @@
#include "Items.hpp"
namespace YimMenu
{
TabBarItem::TabBarItem(const std::string& id) :
m_Id(id)
{
}
void TabBarItem::Draw()
{
if (ImGui::BeginTabBar(m_Id.c_str()))
{
for (const auto& tab : m_Tabs)
{
if (tab->CanDraw())
tab->Draw();
}
ImGui::EndTabBar();
}
}
}
+6 -8
View File
@@ -129,6 +129,7 @@ namespace YimMenu::Submenus
{
auto menu = std::make_unique<Category>("Scripts");
auto tabBar = std::make_unique<TabBarItem>("Scripts");
auto threads = std::make_unique<TabItem>("Threads");
auto script = std::make_unique<TabItem>("Start Script");
@@ -403,14 +404,11 @@ namespace YimMenu::Submenus
}
}));
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::BeginTabBar("Scripts");
}));
menu->AddItem(std::move(threads));
menu->AddItem(std::move(script));
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::EndTabBar();
}));
tabBar->AddItem(std::move(threads));
tabBar->AddItem(std::move(script));
menu->AddItem(std::move(tabBar));
return menu;
}
}
@@ -1,3 +1,4 @@
#pragma once
#include "game/frontend/submenus/Recovery/HeistModifier.hpp"
namespace YimMenu::Submenus
@@ -8,7 +8,7 @@ namespace YimMenu::Submenus
auto cuts = std::make_shared<Group>("Heist Cuts", 2);
auto setups = std::make_shared<Group>("Heist Setups");
auto loots = std::make_shared<Group>("Loots");
auto loots = std::make_shared<Group>("Loots", 2);
auto misc = std::make_shared<Group>("Misc", 1);
cuts->AddItem(std::make_shared<IntCommandItem>("cayopericoheistcut1"_J));
@@ -24,14 +24,8 @@ namespace YimMenu::Submenus
setups->AddItem(std::make_shared<CommandItem>("cayopericoheistsetup"_J));
loots->AddItem(std::make_shared<IntCommandItem>("cayopericoheistprimarytargetvalue"_J));
loots->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
loots->AddItem(std::make_shared<CommandItem>("cayopericoheistsetprimarytargetvalue"_J, "Set##primarytargetvalue"));
loots->AddItem(std::make_shared<IntCommandItem>("cayopericoheistsecondarytakevalue"_J));
loots->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
loots->AddItem(std::make_shared<CommandItem>("cayopericoheistsetprimarytargetvalue"_J, "Set##primarytargetvalue"));
loots->AddItem(std::make_shared<CommandItem>("cayopericoheistsetsecondarytakevalue"_J, "Set##secondarytakevalue"));
misc->AddItem(std::make_shared<CommandItem>("cayopericoheistskiphacking"_J));
@@ -1,3 +1,4 @@
#pragma once
#include "game/frontend/submenus/Recovery/HeistModifier.hpp"
namespace YimMenu::Submenus
@@ -7,9 +7,8 @@ namespace YimMenu::Submenus
auto tab = std::make_shared<TabItem>("Diamond Casino Heist");
auto cuts = std::make_shared<Group>("Heist Cuts", 2);
auto setups1 = std::make_shared<Group>("Heist Setups");
auto setups2 = std::make_shared<Group>("");
auto loots = std::make_shared<Group>("Loots");
auto setups = std::make_shared<Group>("Heist Setups");
auto loots = std::make_shared<Group>("Loots", 2);
auto misc = std::make_shared<Group>("Misc", 1);
cuts->AddItem(std::make_shared<IntCommandItem>("diamondcasinoheistcut1"_J));
@@ -19,31 +18,22 @@ namespace YimMenu::Submenus
cuts->AddItem(std::make_shared<CommandItem>("diamondcasinoheistforceready"_J));
cuts->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetcuts"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdifficulty"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistprimarytarget"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistapproach"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistgunman"_J));
setups1->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistweapon"_J));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdriver"_J));
setups2->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistvehicle"_J));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheisthacker"_J));
setups2->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetup"_J));
auto gunmanAndDriver = std::make_shared<Group>("", 2);
gunmanAndDriver->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistgunman"_J));
gunmanAndDriver->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdriver"_J));
gunmanAndDriver->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistweapon"_J));
gunmanAndDriver->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistvehicle"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdifficulty"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistprimarytarget"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistapproach"_J));
setups->AddItem(std::move(gunmanAndDriver));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheisthacker"_J));
setups->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetup"_J));
loots->AddItem(std::make_shared<IntCommandItem>("diamondcasinoheistpotentialtake"_J));
loots->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
loots->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetpotentialtake"_J, "Set##potentialtake"));
loots->AddItem(std::make_shared<IntCommandItem>("diamondcasinoheistactualtake"_J));
loots->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
loots->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetpotentialtake"_J, "Set##potentialtake"));
loots->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetactualtake"_J, "Set##actualtake"));
misc->AddItem(std::make_shared<CommandItem>("diamondcasinoheistskiphacking"_J));
@@ -51,8 +41,7 @@ namespace YimMenu::Submenus
misc->AddItem(std::make_shared<CommandItem>("diamondcasinoheistinstantfinish"_J));
tab->AddItem(cuts);
tab->AddItem(setups1);
tab->AddItem(setups2);
tab->AddItem(setups);
tab->AddItem(loots);
tab->AddItem(misc);
@@ -1,3 +1,4 @@
#pragma once
#include "game/frontend/submenus/Recovery/HeistModifier.hpp"
namespace YimMenu::Submenus
@@ -1,3 +1,4 @@
#pragma once
#include "game/frontend/submenus/Recovery/HeistModifier.hpp"
namespace YimMenu::Submenus
@@ -8,18 +8,15 @@ namespace YimMenu::Submenus
{
std::shared_ptr<Category> BuildHeistModifierMenu()
{
auto menu = std::make_shared<Category>("Heists");
auto menu = std::make_shared<Category>("Heists");
auto heistTabBar = std::make_shared<TabBarItem>("Heist Modifier");
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::BeginTabBar("Heist Modifier");
}));
menu->AddItem(RenderApartmentHeistMenu());
menu->AddItem(RenderDiamondCasinoHeistMenu());
menu->AddItem(RenderCayoPericoHeistMenu());
menu->AddItem(RenderDoomsdayHeistMenu());
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::EndTabBar();
}));
heistTabBar->AddItem(RenderApartmentHeistMenu());
heistTabBar->AddItem(RenderDiamondCasinoHeistMenu());
heistTabBar->AddItem(RenderCayoPericoHeistMenu());
heistTabBar->AddItem(RenderDoomsdayHeistMenu());
menu->AddItem(std::move(heistTabBar));
return menu;
}
+45 -1
View File
@@ -7,6 +7,8 @@
#include "game/gta/Scripts.hpp"
#include "game/gta/ScriptFunction.hpp"
#include "types/script/scrThread.hpp"
#include "core/commands/Commands.hpp"
#include "game/features/self/CustomWeapon.hpp"
namespace YimMenu::Submenus
{
@@ -163,11 +165,52 @@ namespace YimMenu::Submenus
}
}
static std::shared_ptr<Group> RenderCustomWeaponsMenu()
{
auto customWeaponsGroup = std::make_shared<Group>("Custom Weapons");
auto cutomWeaponTypes = std::make_shared<Group>("", 1);
auto customWeapons = std::make_shared<Group>("");
auto paintGunGroup = std::make_shared<Group>("");
auto cmd = Commands::GetCommand<ListCommand>("customweapontype"_J);
auto isGravityGunEnabled = [cmd] {
return static_cast<Features::CustomWeapons>(cmd->GetState()) == Features::CustomWeapons::GRAVITY_GUN;
};
auto isVehicleGunEnabled = [cmd] {
return static_cast<Features::CustomWeapons>(cmd->GetState()) == Features::CustomWeapons::VEHICLE_GUN;
};
auto isPaintGunEnabled = [cmd] {
return static_cast<Features::CustomWeapons>(cmd->GetState()) == Features::CustomWeapons::PAINT_GUN;
};
cutomWeaponTypes->AddItem(std::make_shared<ListCommandItem>("customweapontype"_J));
cutomWeaponTypes->AddItem(std::make_shared<ConditionalItem>(isGravityGunEnabled, std::make_shared<BoolCommandItem>("gravitygunlaunchonrelease"_J)));
cutomWeaponTypes->AddItem(std::make_shared<ConditionalItem>(isVehicleGunEnabled, std::make_shared<StringCommandItem>("vehiclegunmodel"_J)));
cutomWeaponTypes->AddItem(std::make_shared<ConditionalItem>(isPaintGunEnabled, std::make_shared<ConditionalItem>("paintgunrainbowcolorenabled"_J, std::make_shared<ColorCommandItem>("paintguncolor"_J), true)));
paintGunGroup->AddItem(std::make_shared<BoolCommandItem>("paintgunrainbowcolorenabled"_J));
paintGunGroup->AddItem(std::make_shared<ConditionalItem>("paintgunrainbowcolorenabled"_J, std::make_shared<ListCommandItem>("paintgunrainbowcolorstyle"_J)));
paintGunGroup->AddItem(std::make_shared<ConditionalItem>("paintgunrainbowcolorenabled"_J, std::make_shared<IntCommandItem>("paintgunrainbowcolorspeed"_J)));
customWeapons->AddItem(std::make_shared<BoolCommandItem>("customweaponenabledonweaponout"_J));
customWeapons->AddItem(std::move(cutomWeaponTypes));
customWeapons->AddItem(std::make_shared<ConditionalItem>(isPaintGunEnabled, std::move(paintGunGroup)));
customWeaponsGroup->AddItem(std::make_shared<BoolCommandItem>("customweapon"_J));
customWeaponsGroup->AddItem(std::make_shared<ConditionalItem>("customweapon"_J, std::move(customWeapons)));
return customWeaponsGroup;
}
std::shared_ptr<Category> BuildWeaponsMenu()
{
auto weapons = std::make_shared<Category>("Weapons");
auto weaponsGlobalsGroup = std::make_shared<Group>("Globals");
auto weaponsGlobalsGroup = std::make_shared<Group>("Globals", 12);
auto weaponsToolsGroup = std::make_shared<Group>("Tools", 1);
auto weaponsAmmuNationGroup = std::make_shared<Group>("Ammu-Nation");
auto weaponsAimbotGroup = std::make_shared<Group>("Aimbot", 1);
@@ -202,6 +245,7 @@ namespace YimMenu::Submenus
weapons->AddItem(weaponsToolsGroup);
weapons->AddItem(weaponsAmmuNationGroup);
weapons->AddItem(weaponsAimbotGroup);
weapons->AddItem(RenderCustomWeaponsMenu());
return weapons;
}
}
@@ -239,14 +239,12 @@ namespace YimMenu::Submenus
{
auto menu = std::make_shared<Category>("Spawn");
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::BeginTabBar("Spawn");
}));
menu->AddItem(RenderSpawnNewVehicle());
menu->AddItem(RenderSpawnPersonalVehicle());
menu->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::EndTabBar();
}));
auto tabBar = std::make_shared<TabBarItem>("Spawn");
tabBar->AddItem(RenderSpawnNewVehicle());
tabBar->AddItem(RenderSpawnPersonalVehicle());
menu->AddItem(std::move(tabBar));
return menu;
}
+66
View File
@@ -0,0 +1,66 @@
#include "RayCast.hpp"
#include "game/gta/Natives.hpp"
#include "core/util/Math.hpp"
namespace YimMenu
{
RayCast::RayCast(Entity* entity, Vector3* coords) :
m_Entity(entity),
m_Coords(coords)
{
}
RayCast::RayCast(Entity* entity) :
m_Entity(entity),
m_Coords()
{
}
RayCast::RayCast(Vector3* coords) :
m_Entity(nullptr),
m_Coords(coords)
{
}
bool RayCast::Cast()
{
Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
Vector3 dir = Math::RotationToDirection(rot);
Vector3 farCoords;
farCoords.x = camCoords.x + dir.x * 1000;
farCoords.y = camCoords.y + dir.y * 1000;
farCoords.z = camCoords.z + dir.z * 1000;
int shapeTestHandle = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x,
camCoords.y,
camCoords.z,
farCoords.x,
farCoords.y,
farCoords.z,
-1,
0,
7);
BOOL hit;
Vector3 endCoords;
Vector3 surfaceNormal;
int entityHit;
int testResult = SHAPETEST::GET_SHAPE_TEST_RESULT(shapeTestHandle, &hit, &endCoords, &surfaceNormal, &entityHit);
if (testResult == 2 && hit == TRUE)
{
if (m_Entity)
*m_Entity = Entity(entityHit);
if (m_Coords)
*m_Coords = endCoords;
return true;
}
return false;
}
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include "Entity.hpp"
#include "types/script/types.hpp"
namespace YimMenu
{
class RayCast
{
public:
RayCast(Entity* entity, Vector3* coords);
RayCast(Entity* entity);
RayCast(Vector3* coords);
bool Cast();
private:
Entity* m_Entity;
Vector3* m_Coords;
};
}
+3 -2
View File
@@ -7,7 +7,7 @@
namespace YimMenu
{
Vehicle Vehicle::Create(std::uint32_t model, rage::fvector3 coords, float heading)
Vehicle Vehicle::Create(std::uint32_t model, rage::fvector3 coords, float heading, bool setOnGroundProperly)
{
ENTITY_ASSERT_SCRIPT_CONTEXT();
if (!STREAMING::IS_MODEL_IN_CDIMAGE(model))
@@ -46,7 +46,8 @@ namespace YimMenu
DECORATOR::DECOR_SET_INT(veh.GetHandle(), "MPBitset", 0);
NETWORK::SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(NETWORK::VEH_TO_NET(veh.GetHandle()), true);
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh.GetHandle(), 0);
if (setOnGroundProperly)
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh.GetHandle(), 0);
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);
return veh;
+1 -1
View File
@@ -10,7 +10,7 @@ namespace YimMenu
public:
using Entity::Entity;
static Vehicle Create(std::uint32_t model, rage::fvector3 coords, float heading = 0.0f);
static Vehicle Create(std::uint32_t model, rage::fvector3 coords, float heading = 0.0f, bool setOnGroundProperly = true);
// health
void Fix();
+57
View File
@@ -0,0 +1,57 @@
#pragma once
enum class DecalTypes
{
splatters_blood = 1010,
splatters_blood_dir = 1015,
splatters_blood_mist = 1017,
splatters_mud = 1020,
splatters_paint = 1030,
splatters_water = 1040,
splatters_water_hydrant = 1050,
splatters_blood2 = 1110,
weapImpact_metal = 4010,
weapImpact_concrete = 4020,
weapImpact_mattress = 4030,
weapImpact_mud = 4032,
weapImpact_wood = 4050,
weapImpact_sand = 4053,
weapImpact_cardboard = 4040,
weapImpact_melee_glass = 4100,
weapImpact_glass_blood = 4102,
weapImpact_glass_blood2 = 4104,
weapImpact_shotgun_paper = 4200,
weapImpact_shotgun_mattress,
weapImpact_shotgun_metal,
weapImpact_shotgun_wood,
weapImpact_shotgun_dirt,
weapImpact_shotgun_tvscreen,
weapImpact_shotgun_tvscreen2,
weapImpact_shotgun_tvscreen3,
weapImpact_melee_concrete = 4310,
weapImpact_melee_wood = 4312,
weapImpact_melee_metal = 4314,
burn1 = 4421,
burn2,
burn3,
burn4,
burn5,
bang_concrete_bang = 5000,
bang_concrete_bang2,
bang_bullet_bang,
bang_bullet_bang2 = 5004,
bang_glass = 5031,
bang_glass2,
solidPool_water = 9000,
solidPool_blood,
solidPool_oil,
solidPool_petrol,
solidPool_mud,
porousPool_water,
porousPool_blood,
porousPool_oil,
porousPool_petrol,
porousPool_mud,
porousPool_water_ped_drip,
liquidTrail_water = 9050
};