diff --git a/src/backend/looped/self/toggle_passive.cpp b/src/backend/looped/self/toggle_passive.cpp index 6a6b14d6..e85b1adf 100644 --- a/src/backend/looped/self/toggle_passive.cpp +++ b/src/backend/looped/self/toggle_passive.cpp @@ -1,5 +1,9 @@ #include "backend/looped_command.hpp" +#include "core/scr_globals.hpp" +#include "natives.hpp" #include "script_global.hpp" +#include "script/globals/GPBD_FM_3.hpp" +#include "gta_util.hpp" namespace big { @@ -7,16 +11,29 @@ namespace big { using looped_command::looped_command; + virtual void on_tick() override { - *script_global(1574582+1).as() = true; + if (scr_globals::gpbd_fm_3.as()->Entries[self::id].BossGoon.Boss != -1 || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller")) || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller_2020"))) + { + on_disable(); + g.self.passive = false; + g_notification_service->push_warning("Disabled passive mode", "Disabled passive mode because you started mission / joined CEO/MC"); + return; + } + *scr_globals::tuneables.at(27371).as() = 0; // End Passive Time = 0s *script_global(1574582).as() = true; } virtual void on_disable() override { - *script_global(1574582+1).as() = false; *script_global(1574582).as() = false; + NETWORK::SET_LOCAL_PLAYER_AS_GHOST(false, false); + *scr_globals::tuneables.at(27371).as() = 30000; + PED::SET_PED_CONFIG_FLAG(self::ped, 342, false); // Disable NotAllowedToJackAnyPlayers + PED::SET_PED_CONFIG_FLAG(self::ped, 122, false); // Disable DisableMelee + PLAYER::SET_PLAYER_VEHICLE_DEFENSE_MODIFIER(self::ped, 1.f); + PED::SET_PED_CAN_BE_DRAGGED_OUT(self::ped, true); } }; diff --git a/src/views/self/view_self.cpp b/src/views/self/view_self.cpp index d2d3d2f3..df9d36c1 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -41,7 +41,12 @@ namespace big if (g.self.invisibility) components::command_checkbox<"localvis">(); // TODO: does nothing in SP - components::command_checkbox<"passive">(); + ImGui::BeginDisabled(scr_globals::gpbd_fm_3.as()->Entries[self::id].BossGoon.Boss != -1 + || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller")) + || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller_2020"))); + + components::command_checkbox<"passive">(); + ImGui::EndDisabled(); ImGui::EndGroup(); ImGui::SameLine();