refactor: c4 limit and some general fixes (#970)

This commit is contained in:
Aure7138 2023-02-11 05:33:47 +08:00 committed by GitHub
parent 37a10a7181
commit b9f380e49c
9 changed files with 25 additions and 21 deletions

View File

@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
gtav_classes
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
GIT_TAG 4f93aec221704c74daefab2362b88429ac2dc6bc
GIT_TAG 2862a02e24ebfedc60432887e735efef56d83635
GIT_PROGRESS TRUE
CONFIGURE_COMMAND ""
BUILD_COMMAND ""

View File

@ -60,6 +60,7 @@ namespace big
looped::weapons_repair_gun();
looped::weapons_steal_vehicle_gun();
looped::weapons_vehicle_gun();
looped::weapons_c4_limit();
script::get_current()->yield();
}

View File

@ -60,6 +60,7 @@ namespace big
static void weapons_repair_gun();
static void weapons_steal_vehicle_gun();
static void weapons_vehicle_gun();
static void weapons_c4_limit();
static void drive_train();
static void derail_train();

View File

@ -0,0 +1,15 @@
#include "backend/looped/looped.hpp"
namespace big
{
void looped::weapons_c4_limit()
{
if (g_local_player)
{
if (g.weapons.increased_c4_limit)
g_local_player->fired_sticky_bombs = 0;
if (g.weapons.increased_flare_limit)
g_local_player->fired_flares = 0;
}
}
}

View File

@ -611,12 +611,13 @@ namespace big
bool no_recoil = false;
bool no_spread = false;
std::string vehicle_gun_model = "bus";
bool bypass_c4_limit = false;
bool increased_c4_limit = false;
bool increased_flare_limit = false;
bool rapid_fire = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons,
ammo_special, custom_weapon, force_crosshairs, infinite_ammo, infinite_mag, increased_damage, no_recoil,
no_spread, vehicle_gun_model, bypass_c4_limit, rapid_fire, gravity_gun)
no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun)
} weapons{};
struct window

View File

@ -847,14 +847,6 @@ namespace big
}
else LOG(WARNING) << "socialclub.dll module was not loaded within the time limit.";
if (auto pat = mem_region.scan("41 80 78 28 ? 0F 85 ? ? ? ? 49 8B 80"))
{
m_bypass_max_count_of_active_sticky_bombs = memory::byte_patch::make(pat.add(4).as<uint8_t*>(), { 99 }).get();
if (g.weapons.bypass_c4_limit)
m_bypass_max_count_of_active_sticky_bombs->apply();
}
/**
* Freemode thread restorer through VM patch
*/

View File

@ -134,8 +134,6 @@ namespace big
functions::start_get_presence_attributes m_start_get_presence_attributes;
functions::join_session_by_info m_join_session_by_info;
memory::byte_patch* m_bypass_max_count_of_active_sticky_bombs;
functions::reset_network_complaints m_reset_network_complaints{};
functions::fidevice_get_device m_fidevice_get_device{};

View File

@ -58,7 +58,7 @@ namespace big::entity
inline bool network_has_control_of_entity(rage::netObject* net_object)
{
return net_object && !net_object->m_next_owner_id && (net_object->m_control_id == -1);
return !net_object || !net_object->m_next_owner_id && (net_object->m_control_id == -1);
}
inline bool take_control_of(Entity ent, int timeout = 300)

View File

@ -22,13 +22,9 @@ namespace big
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::Checkbox("BYPASS_C4_LIM"_T.data(), &g.weapons.bypass_c4_limit))
{
if (g.weapons.bypass_c4_limit)
g_pointers->m_bypass_max_count_of_active_sticky_bombs->apply();
else
g_pointers->m_bypass_max_count_of_active_sticky_bombs->restore();
}
ImGui::Checkbox("Increased C4 Limit (Max = 50)", &g.weapons.increased_c4_limit);
ImGui::Checkbox("Increased Flare Limit (Max = 50)", &g.weapons.increased_flare_limit);
components::command_checkbox<"rapidfire">();
ImGui::EndGroup();