fix: Passive not working correctly (#2040)

This commit is contained in:
Patryk 2023-09-02 20:58:13 +02:00 committed by GitHub
parent 5a356dd795
commit e814772a28
2 changed files with 25 additions and 3 deletions

View File

@ -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<bool*>() = true;
if (scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->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<int*>() = 0; // End Passive Time = 0s
*script_global(1574582).as<bool*>() = true;
}
virtual void on_disable() override
{
*script_global(1574582+1).as<bool*>() = false;
*script_global(1574582).as<bool*>() = false;
NETWORK::SET_LOCAL_PLAYER_AS_GHOST(false, false);
*scr_globals::tuneables.at(27371).as<int*>() = 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);
}
};

View File

@ -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<GPBD_FM_3*>()->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();