feat(ReplayInterface): Added attach protection

This commit is contained in:
Yimura 2021-01-17 23:30:10 +01:00
parent 391f8665fa
commit 519f91cfcb
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
3 changed files with 16 additions and 3 deletions

View File

@ -6,6 +6,8 @@ namespace big
{
void features::replay_interface()
{
Ped player = PLAYER::PLAYER_PED_ID();
rage::CReplayInterface* replay_interf = *g_pointers->m_replay_interface;
rage::CObjectInterface* object_interf = replay_interf->m_object_interface;
@ -19,10 +21,17 @@ namespace big
Object ent = g_pointers->m_ptr_to_handle(obj);
if (protections["cage"] && ENTITY::GET_ENTITY_MODEL(ent) == RAGE_JOAAT("prop_gold_cont_01"))
{
if (
protections["attach"] &&
(
ENTITY::IS_ENTITY_ATTACHED_TO_ENTITY(player, ent) ||
ENTITY::IS_ENTITY_ATTACHED_TO_ENTITY(PED::GET_VEHICLE_PED_IS_IN(player, true), ent)
)
)
functions::delete_entity(ent);
if (protections["cage"] && ENTITY::GET_ENTITY_MODEL(ent) == RAGE_JOAAT("prop_gold_cont_01"))
functions::delete_entity(ent);
}
}
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "common.hpp"
#include "gta/fwddec.hpp"
#include "gta/replay.hpp"
#include "gta/natives.hpp"
namespace big::functions
@ -19,4 +20,6 @@ namespace big::functions
using spectate_player = bool(bool toggle, Ped player);
using sync_local_time = void(int h, int m);
using trigger_script_event = int(bool unk0, int64_t* args, int argCount, int bitFlags);
using ptr_to_handle = int(rage::CObject* a1);
}

View File

@ -84,6 +84,7 @@ namespace big
auto& protections = g_settings.options["settings"]["protections"];
if (
ImGui::Checkbox("Attach Protection", protections["attach"].get<bool*>()) ||
ImGui::Checkbox("Cage Protection", protections["cage"].get<bool*>())// ||
//ImGui::Checkbox("Version Mismatch Protection", protections["version_mismatch"].get<bool*>())
)