From e2db18ead5e68d05b336ad679f67c62ec3685d46 Mon Sep 17 00:00:00 2001 From: Yimura Date: Wed, 26 May 2021 14:45:36 +0200 Subject: [PATCH] refactor(Hooks): Swapped net_event_struct with CNetworkIncrementStatEvent --- BigBaseV2/src/gta/net_game_event.hpp | 2 +- BigBaseV2/src/hooking.hpp | 3 ++- BigBaseV2/src/hooks/increment_stat_event.cpp | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BigBaseV2/src/gta/net_game_event.hpp b/BigBaseV2/src/gta/net_game_event.hpp index 14658657..4ad655de 100644 --- a/BigBaseV2/src/gta/net_game_event.hpp +++ b/BigBaseV2/src/gta/net_game_event.hpp @@ -202,6 +202,6 @@ class CNetworkIncrementStatEvent : public rage::netGameEvent { public: Hash m_stat; // 0x30 - std::uint32_t m_ammount; // 0x34 + std::uint32_t m_amount; // 0x34 }; #pragma pack(pop) \ No newline at end of file diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index 51518c43..e3910ba7 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -2,6 +2,7 @@ #include "common.hpp" #include "detour_hook.hpp" #include "gta/fwddec.hpp" +#include "gta/net_game_event.hpp" #include "gta/script_thread.hpp" #include "script_hook.hpp" #include "vmt_hook.hpp" @@ -27,7 +28,7 @@ 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); + static bool increment_stat_event(CNetworkIncrementStatEvent* net_event_struct, CNetGamePlayer* sender, int64_t a3); static bool received_event( rage::netEventMgr* event_manager, diff --git a/BigBaseV2/src/hooks/increment_stat_event.cpp b/BigBaseV2/src/hooks/increment_stat_event.cpp index 3c6bca10..289d2160 100644 --- a/BigBaseV2/src/hooks/increment_stat_event.cpp +++ b/BigBaseV2/src/hooks/increment_stat_event.cpp @@ -4,12 +4,11 @@ namespace big { - bool hooks::increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3) + bool hooks::increment_stat_event(CNetworkIncrementStatEvent* net_event, CNetGamePlayer* sender, int64_t a3) { - Hash hash = *reinterpret_cast(net_event_struct + 0x30); Player sender_id = sender->player_id; - switch (hash) + switch (net_event->m_stat) { case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"): case RAGE_JOAAT("MPPLY_VC_HATE"): @@ -26,6 +25,6 @@ namespace big return true; } - return g_hooking->m_increment_stat_hook.get_original()(net_event_struct, sender, a3); + return g_hooking->m_increment_stat_hook.get_original()(net_event, sender, a3); } } \ No newline at end of file