feat(protections): block receive pickup (#933)

This commit is contained in:
Johann 2023-02-04 23:20:49 +01:00 committed by GitHub
parent 4c45d40df1
commit fa7e5e5a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 1 deletions

View File

@ -233,8 +233,9 @@ namespace big
bool desync_kick = false; bool desync_kick = false;
bool rid_join = false; bool rid_join = false;
bool lessen_breakups = false; // disabled by default due to anticheat concerns bool lessen_breakups = false; // disabled by default due to anticheat concerns
bool receive_pickup = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, lessen_breakups, desync_kick) NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, lessen_breakups, desync_kick, receive_pickup)
} protections{}; } protections{};
struct self struct self

View File

@ -101,6 +101,8 @@ namespace big
detour_hook_helper::add<hooks::received_array_update>("RAU", g_pointers->m_received_array_update); detour_hook_helper::add<hooks::received_array_update>("RAU", g_pointers->m_received_array_update);
detour_hook_helper::add<hooks::receive_pickup>("RPI", g_pointers->m_receive_pickup);
g_hooking = this; g_hooking = this;
} }

View File

@ -145,6 +145,8 @@ namespace big
static void* infinite_train_crash(void* carriage); static void* infinite_train_crash(void* carriage);
static bool received_array_update(rage::netArrayHandlerBase* array, CNetGamePlayer* sender, rage::datBitBuffer* buffer, int size, std::int16_t cycle); static bool received_array_update(rage::netArrayHandlerBase* array, CNetGamePlayer* sender, rage::datBitBuffer* buffer, int size, std::int16_t cycle);
static bool receive_pickup(rage::netObject* netobject, void* unk, CPed* ped);
}; };
class minhook_keepalive class minhook_keepalive

View File

@ -0,0 +1,15 @@
#include "hooking.hpp"
namespace big
{
bool hooks::receive_pickup(rage::netObject* object, void* unk, CPed* ped)
{
if (g.protections.receive_pickup)
{
g_notification_service->push_error("PROTECTIONS"_T.data(), "Blocked pickup");
return false;
}
return g_hooking->get_original<hooks::receive_pickup>()(object, unk, ped);
}
}

View File

@ -812,6 +812,12 @@ namespace big
m_received_array_update = ptr.as<PVOID>(); m_received_array_update = ptr.as<PVOID>();
}); });
// Receive Pickup
main_batch.add("RPI", "49 8B 80 ? ? ? ? 48 85 C0 74 0C F6 80 ? ? ? ? ? 75 03 32 C0 C3", [this](memory::handle ptr)
{
m_receive_pickup = ptr.as<PVOID>();
});
auto mem_region = memory::module("GTA5.exe"); auto mem_region = memory::module("GTA5.exe");
if (!main_batch.run(mem_region)) if (!main_batch.run(mem_region))
{ {

View File

@ -237,6 +237,8 @@ namespace big
functions::get_entity_attached_to m_get_entity_attached_to; functions::get_entity_attached_to m_get_entity_attached_to;
PVOID m_received_array_update; PVOID m_received_array_update;
PVOID m_receive_pickup{};
}; };
inline pointers* g_pointers{}; inline pointers* g_pointers{};

View File

@ -45,6 +45,9 @@ namespace big
ImGui::Checkbox("LESSEN_BREAKUP_KICK"_T.data(), &g.protections.lessen_breakups); ImGui::Checkbox("LESSEN_BREAKUP_KICK"_T.data(), &g.protections.lessen_breakups);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("LESSEN_BREAKUP_KICK_DESCRIPTION"_T.data()); ImGui::SetTooltip("LESSEN_BREAKUP_KICK_DESCRIPTION"_T.data());
ImGui::Checkbox("Receive Pickup", &g.protections.receive_pickup);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("This prevents any pickup from the ground such as unwanted money drops.\nAttention: Normal pickups are also no longer possible.");
ImGui::EndGroup(); ImGui::EndGroup();
} }