Skip to content

Commit

Permalink
Added "Enable MK1 and MK2 Weapons" feature. (#3000)
Browse files Browse the repository at this point in the history
  • Loading branch information
gir489returns committed Apr 30, 2024
1 parent f0cd838 commit ccb3591
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/backend/commands/self/enable_mk1_variants.cpp
@@ -0,0 +1,6 @@
#include "backend/bool_command.hpp"

namespace big
{
bool_command g_enable_mk1_variants("enablemk1variants", "ENABLE_BOTH_MK1_AND_MK2_VARIANTS", "ENABLE_BOTH_MK1_AND_MK2_VARIANTS_DESC", g.weapons.enable_mk1_variants);
}
3 changes: 2 additions & 1 deletion src/core/settings.hpp
Expand Up @@ -884,9 +884,10 @@ namespace big
bool triggerbot = false;
bool infinite_range = false;
bool enable_weapon_hotkeys = false;
bool enable_mk1_variants = false;
std::map<int, std::vector<uint32_t>> weapon_hotkeys{};

NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, set_explosion_radius, modify_explosion_radius, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, paintgun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, set_explosion_radius, modify_explosion_radius, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, paintgun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys, enable_mk1_variants)
} weapons{};

struct window
Expand Down
22 changes: 22 additions & 0 deletions src/native_hooks/freemode.hpp
Expand Up @@ -92,5 +92,27 @@ namespace big
}
}
}

void REMOVE_WEAPON_FROM_PED(rage::scrNativeCallContext* src)
{
auto ped = src->get_arg<Ped>(0);
auto weapon_hash = src->get_arg<Hash>(1);
if (g.weapons.enable_mk1_variants)
{
static const std::unordered_set<Hash> weapon_variants = {
"WEAPON_PISTOL"_J, "WEAPON_SMG"_J, "WEAPON_ASSAULTRIFLE"_J, "WEAPON_CARBINERIFLE"_J,
"WEAPON_COMBATMG"_J, "WEAPON_HEAVYSNIPER"_J, "WEAPON_BULLPUPRIFLE"_J, "WEAPON_MARKSMANRIFLE"_J,
"WEAPON_PUMPSHOTGUN"_J, "WEAPON_REVOLVER"_J, "WEAPON_SNSPISTOL"_J, "WEAPON_SPECIALCARBINE"_J,
//MK2 variants
"WEAPON_PISTOL_MK2"_J, "WEAPON_SMG_MK2"_J, "WEAPON_ASSAULTRIFLE_MK2"_J, "WEAPON_CARBINERIFLE_MK2"_J,
"WEAPON_COMBATMG_MK2"_J, "WEAPON_HEAVYSNIPER_MK2"_J, "WEAPON_BULLPUPRIFLE_MK2"_J, "WEAPON_MARKSMANRIFLE_MK2"_J,
"WEAPON_PUMPSHOTGUN_MK2"_J, "WEAPON_REVOLVER_MK2"_J, "WEAPON_SNSPISTOL_MK2"_J, "WEAPON_SPECIALCARBINE_MK2"_J };
if (ped == self::ped && weapon_variants.contains(weapon_hash))
{
return;
}
}
WEAPON::REMOVE_WEAPON_FROM_PED(ped, weapon_hash);
}
}
}
1 change: 1 addition & 0 deletions src/native_hooks/native_hooks.cpp
Expand Up @@ -119,6 +119,7 @@ namespace big
add_native_detour("freemode"_J, NativeIndex::SET_BIGMAP_ACTIVE, freemode::SET_BIGMAP_ACTIVE);
add_native_detour("freemode"_J, NativeIndex::SET_BLIP_DISPLAY, freemode::SET_BLIP_DISPLAY);
add_native_detour("freemode"_J, NativeIndex::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
add_native_detour("freemode"_J, NativeIndex::REMOVE_WEAPON_FROM_PED, freemode::REMOVE_WEAPON_FROM_PED);

add_native_detour("fmmc_launcher"_J, NativeIndex::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
add_native_detour("maintransition"_J, NativeIndex::NETWORK_SESSION_HOST, network::NETWORK_SESSION_HOST);
Expand Down
2 changes: 2 additions & 0 deletions src/views/self/view_weapons.cpp
Expand Up @@ -91,6 +91,8 @@ namespace big
}
});

components::command_checkbox<"enablemk1variants">();

ImGui::EndGroup();

ImGui::SeparatorText("DEBUG_TAB_MISC"_T.data());
Expand Down

0 comments on commit ccb3591

Please sign in to comment.