fix(Toxic): fix typo (#1062)

This commit is contained in:
maybegreat48 2023-03-10 22:41:46 +00:00 committed by GitHub
parent ad90ee3f6a
commit 4af9c7f258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 14 deletions

View File

@ -668,7 +668,7 @@ namespace big
} }
case RAGE_JOAAT("CVehicleProximityMigrationDataNode"): case RAGE_JOAAT("CVehicleProximityMigrationDataNode"):
{ {
if (g_local_player && g_local_player->m_net_object) if (object && g_local_player && g_local_player->m_net_object)
{ {
const auto migration_node = (CVehicleProximityMigrationDataNode*)(node); const auto migration_node = (CVehicleProximityMigrationDataNode*)(node);
if (is_in_vehicle(g_local_player, g_local_player->m_vehicle) && g_local_player->m_vehicle->m_net_object if (is_in_vehicle(g_local_player, g_local_player->m_vehicle) && g_local_player->m_vehicle->m_net_object
@ -687,6 +687,8 @@ namespace big
} }
} }
} }
break;
} }
} }
} }

View File

@ -13,7 +13,7 @@ namespace big
g_hooking->get_original<hooks::write_vehicle_proximity_migration_data_node>()(veh, node); g_hooking->get_original<hooks::write_vehicle_proximity_migration_data_node>()(veh, node);
if (vehicle->m_net_object->m_object_id = g.m_tp_veh_net_id) if (vehicle->m_net_object->m_object_id == g.m_tp_veh_net_id)
{ {
node->m_has_occupants[0] = true; node->m_has_occupants[0] = true;
node->m_occupants[0] = g.m_tp_player_net_id; node->m_occupants[0] = g.m_tp_player_net_id;

View File

@ -72,22 +72,36 @@ namespace big::entity
inline bool take_control_of(Entity ent, int timeout = 300) inline bool take_control_of(Entity ent, int timeout = 300)
{ {
auto ptr = g_pointers->m_handle_to_ptr(ent); if (auto hnd = g_pointers->m_handle_to_ptr(ent))
if (ptr) {
if (!*g_pointers->m_is_session_started || !hnd->m_net_object || network_has_control_of_entity(hnd->m_net_object))
{ {
if (!*g_pointers->m_is_session_started || network_has_control_of_entity(ptr->m_net_object))
return true; return true;
for (int i = 0; !network_has_control_of_entity(ptr->m_net_object) && i < timeout; i++) }
}
else
{ {
g_pointers->m_request_control(ptr->m_net_object); return false;
}
for (int i = 0; i < timeout; i++)
{
auto hnd = g_pointers->m_handle_to_ptr(ent);
if (!hnd || !hnd->m_net_object)
return false;
g_pointers->m_request_control(hnd->m_net_object);
if (timeout != 0) if (timeout != 0)
script::get_current()->yield(); script::get_current()->yield();
} }
if (!network_has_control_of_entity(ptr->m_net_object))
auto hnd = g_pointers->m_handle_to_ptr(ent);
if (!hnd || !hnd->m_net_object || !network_has_control_of_entity(hnd->m_net_object))
return false; return false;
int netHandle = NETWORK::NETWORK_GET_NETWORK_ID_FROM_ENTITY(ent); int netHandle = NETWORK::NETWORK_GET_NETWORK_ID_FROM_ENTITY(ent);
NETWORK::SET_NETWORK_ID_CAN_MIGRATE(netHandle, true); NETWORK::SET_NETWORK_ID_CAN_MIGRATE(netHandle, true);
}
return true; return true;
} }