From d030bcbf4e57bd8ea46d3c62e4f4105e95d02d0b Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:34:45 +0000 Subject: [PATCH] Block traffic protection (#2688) * fix: don't randomize components if we're cloning an existing ped * feat(protections): add traffic manipulation protection * fix(protections): add a mission check --- src/core/settings.hpp | 3 ++- src/hooks/protections/received_event.cpp | 5 +++++ src/views/settings/view_protection_settings.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 303dfa9c..66a27de2 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -283,8 +283,9 @@ namespace big bool admin_check = true; bool kick_rejoin = true; bool force_relay_connections = false; + bool stop_traffic = true; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, receive_pickup, admin_check, kick_rejoin, force_relay_connections) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, receive_pickup, admin_check, kick_rejoin, force_relay_connections, stop_traffic) } protections{}; struct self diff --git a/src/hooks/protections/received_event.cpp b/src/hooks/protections/received_event.cpp index 42c93baa..aab0f576 100644 --- a/src/hooks/protections/received_event.cpp +++ b/src/hooks/protections/received_event.cpp @@ -564,6 +564,11 @@ namespace big g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); return; } + else if (type == WorldStateDataType::PopMultiplierArea && g.protections.stop_traffic && !NETWORK::NETWORK_IS_ACTIVITY_SESSION()) + { + g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); + return; + } buffer->Seek(0); break; diff --git a/src/views/settings/view_protection_settings.cpp b/src/views/settings/view_protection_settings.cpp index 720e607c..042b8b6a 100644 --- a/src/views/settings/view_protection_settings.cpp +++ b/src/views/settings/view_protection_settings.cpp @@ -56,6 +56,7 @@ namespace big ImGui::SetTooltip("VIEW_PROTECTION_SETTINGS_RECEIVE_PICKUP_TOOLTIP"_T.data()); ImGui::Checkbox("ADMIN_CHECK"_T.data(), &g.protections.admin_check); ImGui::Checkbox("VIEW_PROTECTION_SETTINGS_KICK_REJOIN"_T.data(), &g.protections.kick_rejoin); + ImGui::Checkbox("BLOCK_TRAFFIC_MANIPULATION"_T.data(), &g.protections.stop_traffic); components::command_checkbox<"forcerelays">(); ImGui::EndGroup();