Various fixes (#2135)

This commit is contained in:
gir489 2023-09-16 11:49:18 -04:00 committed by GitHub
parent 4b8e350628
commit 3e65e02eda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 12 deletions

View File

@ -4,6 +4,7 @@
#include "script_global.hpp"
#include "script/globals/GPBD_FM_3.hpp"
#include "gta_util.hpp"
#include "services/tunables/tunables_service.hpp"
namespace big
{
@ -21,15 +22,15 @@ namespace big
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;
*g_tunables_service->get_tunable<int*>(-29732167) = 0; // End Passive Time = 0s
*scr_globals::passive.as<PBOOL>() = TRUE;
}
virtual void on_disable() override
{
*script_global(1574582).as<bool*>() = false;
*scr_globals::passive.as<PBOOL>() = FALSE;
NETWORK::SET_LOCAL_PLAYER_AS_GHOST(false, false);
*scr_globals::tuneables.at(27371).as<int*>() = 30000;
*g_tunables_service->get_tunable<int*>(-29732167) = 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);

View File

@ -9,12 +9,49 @@ namespace big
{
using looped_command::looped_command;
std::array<int*, 8> m_tunables = {nullptr};
std::array<int, 8> m_restore;
bool m_ready_to_use;
virtual void on_tick() override
{
*scr_globals::session_info.at(1155).as<PINT>() = -1;
*scr_globals::session_info.at(1171).as<PINT>() = -1;
CAM::INVALIDATE_IDLE_CAM();
CAM::INVALIDATE_CINEMATIC_VEHICLE_IDLE_MODE();
if (!m_ready_to_use)
{
m_tunables[0] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("IDLEKICK_WARNING1"));
m_tunables[1] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("IDLEKICK_WARNING2"));
m_tunables[2] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("IDLEKICK_WARNING3"));
m_tunables[3] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("IDLEKICK_KICK"));
m_tunables[4] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("ConstrainedKick_Warning1"));
m_tunables[5] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("ConstrainedKick_Warning2"));
m_tunables[6] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("ConstrainedKick_Warning3"));
m_tunables[7] = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("ConstrainedKick_Kick"));
// create backup of tunables
m_ready_to_use = true;
for (int i = 0; i < m_restore.size(); ++i)
{
if (m_ready_to_use = m_tunables[i]; !m_ready_to_use)
break;
m_restore[i] = *m_tunables[i];
}
}
else
{
for (const auto& tunable : m_tunables)
{
if (tunable)
*tunable = INT_MAX;
}
}
}
virtual void on_disable() override
{
for (int i = 0; m_ready_to_use && i < m_restore.size(); ++i)
{
if (m_tunables[i])
*m_tunables[i] = m_restore[i];
}
}
};

View File

@ -39,10 +39,6 @@ namespace big::scr_globals
static inline const script_global spawn_global(2694613);
static inline const script_global session_info(1654054);
static inline const script_global tuneables(262145);
static inline const script_global dance_state(1950837);
static inline const script_global mobile(20483);
@ -59,6 +55,8 @@ namespace big::scr_globals
static inline const script_global session6(2694534);
static inline const script_global gooch(1890378);
static inline const script_global passive(1574582);
}
namespace big::scr_locals

View File

@ -8,6 +8,32 @@
namespace big
{
bool is_blacklist_vehicle(Hash vehicle_hash)
{
switch (vehicle_hash)
{
case RAGE_JOAAT("avenger"):
case RAGE_JOAAT("avenger3"):
case RAGE_JOAAT("hauler2"):
case RAGE_JOAAT("phantom3"):
case RAGE_JOAAT("trailersmall2"):
case RAGE_JOAAT("khanjali"):
case RAGE_JOAAT("chernobog"):
case RAGE_JOAAT("riot2"):
case RAGE_JOAAT("thruster"):
case RAGE_JOAAT("brickade2"):
case RAGE_JOAAT("manchez3"):
case RAGE_JOAAT("terbyte"):
case RAGE_JOAAT("speedo4"):
case RAGE_JOAAT("mule4"):
case RAGE_JOAAT("pounder2"):
case RAGE_JOAAT("rcbandito"):
case RAGE_JOAAT("minitank"):
return true;
}
return false;
}
void view::pv()
{
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
@ -112,6 +138,10 @@ namespace big
if ((selected_class == -1 || class_arr[selected_class] == vehicle_class)
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
{
if (!g.clone_pv.spawn_clone && is_blacklist_vehicle(personal_veh->get_hash()))
{
continue;
}
indexes_to_use.insert(personal_veh->get_id());
}
}