mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-18 07:07:32 +08:00

* refactor(globals): use macro's for to_json/from_json * refactor(globals): switch from global pointer to global instance
24 lines
874 B
C++
24 lines
874 B
C++
#include "hooking.hpp"
|
|
#include "util/notify.hpp"
|
|
|
|
namespace big
|
|
{
|
|
eAckCode hooks::received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, eNetObjType object_type, uint16_t object_id, rage::datBitBuffer* buffer, uint16_t unk, uint32_t timestamp)
|
|
{
|
|
if (object_type < eNetObjType::NET_OBJ_TYPE_AUTOMOBILE || object_type > eNetObjType::NET_OBJ_TYPE_TRAIN)
|
|
{
|
|
notify::crash_blocked(src, "out of bounds object type");
|
|
return eAckCode::ACKCODE_FAIL;
|
|
}
|
|
|
|
if (auto net_obj = g_pointers->m_get_net_object(mgr, object_id, true); net_obj && net_obj->m_object_type != (int16_t)object_type)
|
|
{
|
|
notify::crash_blocked(src, "incorrect object type");
|
|
return eAckCode::ACKCODE_FAIL;
|
|
}
|
|
|
|
g.m_syncing_player = src;
|
|
return g_hooking->get_original<received_clone_sync>()(mgr, src, dst, object_type, object_id, buffer, unk, timestamp);
|
|
}
|
|
}
|