refactor(Hooks): Swapped net_event_struct with CNetworkIncrementStatEvent

This commit is contained in:
Yimura 2021-05-26 14:45:36 +02:00
parent f891e23760
commit e2db18ead5
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
3 changed files with 6 additions and 6 deletions

View File

@ -202,6 +202,6 @@ class CNetworkIncrementStatEvent : public rage::netGameEvent
{ {
public: public:
Hash m_stat; // 0x30 Hash m_stat; // 0x30
std::uint32_t m_ammount; // 0x34 std::uint32_t m_amount; // 0x34
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -2,6 +2,7 @@
#include "common.hpp" #include "common.hpp"
#include "detour_hook.hpp" #include "detour_hook.hpp"
#include "gta/fwddec.hpp" #include "gta/fwddec.hpp"
#include "gta/net_game_event.hpp"
#include "gta/script_thread.hpp" #include "gta/script_thread.hpp"
#include "script_hook.hpp" #include "script_hook.hpp"
#include "vmt_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_tick(GtaThread* a1, unsigned int a2);
static rage::eThreadState gta_thread_kill(GtaThread* thread); 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( static bool received_event(
rage::netEventMgr* event_manager, rage::netEventMgr* event_manager,

View File

@ -4,12 +4,11 @@
namespace big 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<DWORD*>(net_event_struct + 0x30);
Player sender_id = sender->player_id; Player sender_id = sender->player_id;
switch (hash) switch (net_event->m_stat)
{ {
case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"): case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"):
case RAGE_JOAAT("MPPLY_VC_HATE"): case RAGE_JOAAT("MPPLY_VC_HATE"):
@ -26,6 +25,6 @@ namespace big
return true; return true;
} }
return g_hooking->m_increment_stat_hook.get_original<decltype(&increment_stat_event)>()(net_event_struct, sender, a3); return g_hooking->m_increment_stat_hook.get_original<decltype(&increment_stat_event)>()(net_event, sender, a3);
} }
} }