From e5e4aee810e48f9607f5675b2b4a56d867efbbf2 Mon Sep 17 00:00:00 2001 From: Yimura Date: Thu, 11 Nov 2021 01:15:27 +0100 Subject: [PATCH] feat(Self): Added model change --- BigBaseV2/src/gui/window/main/tab_self.cpp | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/BigBaseV2/src/gui/window/main/tab_self.cpp b/BigBaseV2/src/gui/window/main/tab_self.cpp index a0303d6b..bfbeedd8 100644 --- a/BigBaseV2/src/gui/window/main/tab_self.cpp +++ b/BigBaseV2/src/gui/window/main/tab_self.cpp @@ -2,7 +2,9 @@ #include "fiber_pool.hpp" #include "script.hpp" #include "script_global.hpp" +#include "util/entity.hpp" #include "util/player.hpp" +#include "util/notify.hpp" namespace big { @@ -37,6 +39,47 @@ namespace big ImGui::TreePop(); } + if (ImGui::TreeNode("Player Model")) + { + static char model[32]; + + QUEUE_JOB_BEGIN_CLAUSE() + { + PAD::DISABLE_ALL_CONTROL_ACTIONS(0); + }QUEUE_JOB_END_CLAUSE + + if ( + ImGui::InputText("Model Name###player_ped_model", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue) || + ImGui::Button("Set Player Model###spawn_player_ped_model") + ) + { + QUEUE_JOB_BEGIN_CLAUSE(= ) + { + Hash hash = rage::joaat(model); + + for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++) + { + STREAMING::REQUEST_MODEL(hash); + + script::get_current()->yield(); + } + if (!STREAMING::HAS_MODEL_LOADED(hash)) + { + notify::above_map("~r~Failed to spawn model, did you give an incorrect model?"); + + return; + } + + PLAYER::SET_PLAYER_MODEL(PLAYER::GET_PLAYER_INDEX(), hash); + PED::SET_PED_DEFAULT_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID()); + script::get_current()->yield(); + STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::TreePop(); + } + if (ImGui::TreeNode("Police")) { ImGui::Checkbox("Never Wanted", &g.self.never_wanted);