From 1fcfd5e0c6c644763b1a664cd378fc3aebdbdf70 Mon Sep 17 00:00:00 2001 From: Maddy <59680197+xM4ddy@users.noreply.github.com> Date: Tue, 8 Mar 2022 12:52:00 -0500 Subject: [PATCH] feat: Added steal outfit, steal identity (#92) Co-authored-by: Yimura --- BigBaseV2/src/util/ped.hpp | 36 +++++++++++++++++++++++++++++ BigBaseV2/src/views/view_player.cpp | 19 +++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 BigBaseV2/src/util/ped.hpp diff --git a/BigBaseV2/src/util/ped.hpp b/BigBaseV2/src/util/ped.hpp new file mode 100644 index 00000000..36fbe837 --- /dev/null +++ b/BigBaseV2/src/util/ped.hpp @@ -0,0 +1,36 @@ +#pragma once +#include "natives.hpp" + +namespace big::ped +{ + inline void steal_outfit(const Ped target) + { + if (ENTITY::GET_ENTITY_MODEL(PLAYER::PLAYER_PED_ID()) != ENTITY::GET_ENTITY_MODEL(target)) { + g_notification_service->push("Error", "Model mismatch, use steal identity instead."); + return; + } + for (int i = 0; i < 12; i++) { + PED::SET_PED_COMPONENT_VARIATION + ( + PLAYER::PLAYER_PED_ID(), + i, + PED::GET_PED_DRAWABLE_VARIATION(target, i), + PED::GET_PED_TEXTURE_VARIATION(target, i), + PED::GET_PED_PALETTE_VARIATION(target, i) + ); + } + } + + inline void steal_identity(const Ped target) + { + const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(PLAYER::PLAYER_PED_ID()); + const int current_health = ENTITY::GET_ENTITY_HEALTH(PLAYER::PLAYER_PED_ID()); + const int current_armor = PED::GET_PED_ARMOUR(PLAYER::PLAYER_PED_ID()); + + PLAYER::SET_PLAYER_MODEL(PLAYER::PLAYER_ID(), ENTITY::GET_ENTITY_MODEL(target)); + PED::CLONE_PED_TO_TARGET(target, PLAYER::PLAYER_PED_ID()); + ENTITY::SET_ENTITY_MAX_HEALTH(PLAYER::PLAYER_PED_ID(), max_health); + ENTITY::SET_ENTITY_HEALTH(PLAYER::PLAYER_PED_ID(), current_health, 0); + PED::SET_PED_ARMOUR(PLAYER::PLAYER_PED_ID(), current_armor); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/views/view_player.cpp b/BigBaseV2/src/views/view_player.cpp index f6bba3b0..156ac22f 100644 --- a/BigBaseV2/src/views/view_player.cpp +++ b/BigBaseV2/src/views/view_player.cpp @@ -3,6 +3,7 @@ #include "services/player_service.hpp" #include "gta_util.hpp" #include "util/misc.hpp" +#include "util/ped.hpp" #include "util/teleport.hpp" namespace big @@ -17,6 +18,24 @@ namespace big if (g_player_service->get_selected()->is_valid()) { + if (ImGui::TreeNode("Misc")) { + components::button("Steal Outfit", [] { + ped::steal_outfit( + PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()) + ); + }); + + ImGui::SameLine(); + + components::button("Steal Identity", [] { + ped::steal_identity( + PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()) + ); + }); + + ImGui::TreePop(); + } + if (ImGui::TreeNode("Info")) { ImGui::Text("Player ID: %d", g_player_service->get_selected()->id());