24 lines
875 B
C++
24 lines
875 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);
|
|
}
|
|
}
|