diff --git a/BigBaseV2/src/function_types.hpp b/BigBaseV2/src/function_types.hpp index c5b73779..4062b761 100644 --- a/BigBaseV2/src/function_types.hpp +++ b/BigBaseV2/src/function_types.hpp @@ -11,4 +11,6 @@ namespace big::functions using gta_thread_tick = __int64(GtaThread* a1, unsigned int a2); using gta_thread_kill = __int64(GtaThread* a1); + + using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3); } diff --git a/BigBaseV2/src/hooking.cpp b/BigBaseV2/src/hooking.cpp index ce21c1b4..c9226308 100644 --- a/BigBaseV2/src/hooking.cpp +++ b/BigBaseV2/src/hooking.cpp @@ -40,7 +40,9 @@ namespace big m_convert_thread_to_fiber_hook("ConvertThreadToFiber", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as(), &hooks::convert_thread_to_fiber), m_gta_thread_tick_hook("GTA Thread Tick", g_pointers->m_gta_thread_tick, &hooks::gta_thread_tick), - m_gta_thread_kill_hook("GTA Thread Kill", g_pointers->m_gta_thread_kill, &hooks::gta_thread_kill) + m_gta_thread_kill_hook("GTA Thread Kill", g_pointers->m_gta_thread_kill, &hooks::gta_thread_kill), + + m_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event) { m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present); m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers); @@ -68,6 +70,8 @@ namespace big m_gta_thread_kill_hook.enable(); m_gta_thread_tick_hook.enable(); + m_increment_stat_hook.enable(); + m_enabled = true; } @@ -75,6 +79,8 @@ namespace big { m_enabled = false; + m_increment_stat_hook.disable(); + m_gta_thread_tick_hook.disable(); m_gta_thread_kill_hook.disable(); diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index b1233f29..a5f0fca9 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -24,6 +24,8 @@ namespace big static rage::eThreadState gta_thread_tick(GtaThread* a1, unsigned int a2); static rage::eThreadState gta_thread_kill(GtaThread* thread); + + static bool increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3); }; struct minhook_keepalive @@ -55,6 +57,8 @@ namespace big detour_hook m_gta_thread_tick_hook; detour_hook m_gta_thread_kill_hook; + + detour_hook m_increment_stat_hook; }; inline hooking *g_hooking{}; diff --git a/BigBaseV2/src/hooks/increment_stat_event.cpp b/BigBaseV2/src/hooks/increment_stat_event.cpp new file mode 100644 index 00000000..cf25366e --- /dev/null +++ b/BigBaseV2/src/hooks/increment_stat_event.cpp @@ -0,0 +1,32 @@ +#include "gta/joaat.hpp" +#include "hooking.hpp" +#include "natives.hpp" +#include "util/notify.hpp" + +namespace big +{ + bool hooks::increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3) + { + Hash hash = *reinterpret_cast(net_event_struct + 0x30); + Player sender_id = sender->player_id; + + switch (hash) + { + case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"): + case RAGE_JOAAT("MPPLY_VC_HATE"): + case RAGE_JOAAT("MPPLY_EXPLOITS"): + case RAGE_JOAAT("MPPLY_TC_ANNOYINGME"): + case RAGE_JOAAT("MPPLY_TC_HATE"): + char report[64]; + strcpy(report, "~g~BLOCKED REPORT~s~\nFrom: "); + strcat(report, PLAYER::GET_PLAYER_NAME(sender_id)); + strcat(report, ""); + + notify::above_map(report); + + return true; + } + + return g_hooking->m_increment_stat_hook.get_original ()(net_event_struct, sender, a3); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index 8469ed64..7034243c 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -122,6 +122,11 @@ namespace big { m_gta_thread_kill = ptr.as(); }); + + main_batch.add("Increment Stat Event", "", [this](memory::handle ptr) + { + m_increment_stat_event = ptr.as(); + }); main_batch.run(memory::module(nullptr)); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 1ad258a5..71369b7b 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -43,6 +43,8 @@ namespace big functions::gta_thread_tick* m_gta_thread_tick{}; functions::gta_thread_kill* m_gta_thread_kill{}; + + functions::increment_stat_event* m_increment_stat_event{}; }; inline pointers *g_pointers{};