rtdhook* hook;
void* __fastcall AttachEntityToEntity(uintptr_t ptr, void* edx, uintptr_t entityTo, CVector offset, CVector rotation)
{
uint8_t type = *reinterpret_cast<uint8_t*>(entityTo + 0x36);
if ((type & 7) == 2) // If entity is attaching to vehicle
*reinterpret_cast<uint32_t*>(ptr + 0x1C) &= 0xFFFFFFFE;
return reinterpret_cast<void* (__thiscall*)(uintptr_t, uintptr_t, CVector, CVector)>
(hook->trampoline)(ptr, entityTo, offset, rotation);
}
int main()
{
hook = new rtdhook(0x54D570, reinterpret_cast<DWORD>(&AttachEntityToEntity));
hook->install();
return 0;
}