mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-23 04:27:25 +08:00
feat(GUI): Added spawn tab
This commit is contained in:
parent
104036c063
commit
0093aa4f19
@ -15,6 +15,7 @@ namespace big
|
|||||||
tabbar::render_teleport();
|
tabbar::render_teleport();
|
||||||
tabbar::render_vehicle();
|
tabbar::render_vehicle();
|
||||||
tabbar::render_network();
|
tabbar::render_network();
|
||||||
|
tabbar::render_spawn();
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -12,11 +12,13 @@ namespace big
|
|||||||
class tabbar
|
class tabbar
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Order in the order that they are rendered/sorted in the UI
|
||||||
static void render_self();
|
static void render_self();
|
||||||
static void render_tunables();
|
static void render_tunables();
|
||||||
static void render_teleport();
|
static void render_teleport();
|
||||||
static void render_vehicle();
|
static void render_vehicle();
|
||||||
static void render_network();
|
static void render_network();
|
||||||
|
static void render_spawn();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
66
BigBaseV2/src/gui/tab_bar/tab_spawn.cpp
Normal file
66
BigBaseV2/src/gui/tab_bar/tab_spawn.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "tab_bar.hpp"
|
||||||
|
#include "pointers.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
static char model[64];
|
||||||
|
|
||||||
|
void tabbar::render_spawn()
|
||||||
|
{
|
||||||
|
if (ImGui::BeginTabItem("Spawn"))
|
||||||
|
{
|
||||||
|
ImGui::InputText("Model Name", model, sizeof(model));
|
||||||
|
|
||||||
|
if (ImGui::Button("Spawn"))
|
||||||
|
{
|
||||||
|
QUEUE_JOB_BEGIN_CLAUSE(= )
|
||||||
|
{
|
||||||
|
Hash hash = MISC::GET_HASH_KEY((const char*)model);
|
||||||
|
|
||||||
|
if (hash)
|
||||||
|
{
|
||||||
|
int tries = 0;
|
||||||
|
const int max = 100;
|
||||||
|
while (!STREAMING::HAS_MODEL_LOADED(hash) && tries < max)
|
||||||
|
{
|
||||||
|
STREAMING::REQUEST_MODEL(hash);
|
||||||
|
|
||||||
|
tries++;
|
||||||
|
|
||||||
|
script::get_current()->yield();
|
||||||
|
}
|
||||||
|
if (tries >= max)
|
||||||
|
{
|
||||||
|
features::notify::above_map("~r~Failed to spawn model, did you give an incorrect model?");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ped player = PLAYER::PLAYER_PED_ID();
|
||||||
|
|
||||||
|
Vector3 location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, .0, 8.0, .5);
|
||||||
|
*(unsigned short*)g_pointers->m_model_spawn_bypass = 0x9090;
|
||||||
|
Vehicle veh = VEHICLE::CREATE_VEHICLE(hash, location.x, location.y, location.z, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()) + 90.f, true, false, false);
|
||||||
|
*(unsigned short*)g_pointers->m_model_spawn_bypass = 0x0574;
|
||||||
|
|
||||||
|
script::get_current()->yield();
|
||||||
|
|
||||||
|
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
||||||
|
|
||||||
|
if (*g_pointers->m_is_session_started)
|
||||||
|
{
|
||||||
|
DECORATOR::DECOR_SET_INT(veh, "MPBitset", 0);
|
||||||
|
ENTITY::_SET_ENTITY_SOMETHING(veh, true);
|
||||||
|
int networkId = NETWORK::VEH_TO_NET(veh);
|
||||||
|
if (NETWORK::NETWORK_GET_ENTITY_IS_NETWORKED(veh))
|
||||||
|
NETWORK::SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(networkId, true);
|
||||||
|
VEHICLE::SET_VEHICLE_IS_STOLEN(veh, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}QUEUE_JOB_END_CLAUSE
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user