Added spawn ped feature. (#377)

This commit is contained in:
aa15032261 2022-08-10 08:42:34 +08:00 committed by GitHub
parent 8a9588b1e1
commit c83dee8700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 1178 additions and 608 deletions

View File

@ -142,7 +142,6 @@ namespace big
bool off_radar = false; bool off_radar = false;
bool super_run = false; bool super_run = false;
int wanted_level = 0; int wanted_level = 0;
bool preview_ped = false;
bool god_mode = false; bool god_mode = false;
bool proof_bullet = false; bool proof_bullet = false;
bool proof_fire = false; bool proof_fire = false;
@ -177,7 +176,7 @@ namespace big
hotkeys hotkeys{}; hotkeys hotkeys{};
}; };
struct spawn struct spawn_vehicle
{ {
bool preview_vehicle = false; bool preview_vehicle = false;
bool spawn_inside = false; bool spawn_inside = false;
@ -291,10 +290,13 @@ namespace big
bool player = false; bool player = false;
ImU32 color = 3357612055; ImU32 color = 3357612055;
float gui_scale = 1.f;
ImFont* font_title = nullptr; ImFont* font_title = nullptr;
ImFont* font_sub_title = nullptr; ImFont* font_sub_title = nullptr;
ImFont* font_normal = nullptr;
ImFont* font_small = nullptr; ImFont* font_small = nullptr;
ImFont* font_icon = nullptr;
bool switched_view = true; bool switched_view = true;
}; };
@ -340,6 +342,11 @@ namespace big
ImU32 friend_color = 4293244509; ImU32 friend_color = 4293244509;
}; };
struct spawn_ped
{
bool preview_ped = false;
};
public: public:
int friend_count = 0; int friend_count = 0;
int player_count = 0; int player_count = 0;
@ -353,8 +360,9 @@ namespace big
self self{}; self self{};
session session{}; session session{};
settings settings{}; settings settings{};
spawn spawn{}; spawn_vehicle spawn_vehicle{};
clone_pv clone_pv{}; clone_pv clone_pv{};
spawn_ped spawn_ped{};
spoofing spoofing{}; spoofing spoofing{};
vehicle vehicle{}; vehicle vehicle{};
weapons weapons{}; weapons weapons{};
@ -523,14 +531,13 @@ namespace big
this->self.no_ragdoll = j["self"]["no_ragdoll"]; this->self.no_ragdoll = j["self"]["no_ragdoll"];
this->self.off_radar = j["self"]["off_radar"]; this->self.off_radar = j["self"]["off_radar"];
this->self.super_run = j["self"]["super_run"]; this->self.super_run = j["self"]["super_run"];
this->self.preview_ped = j["self"]["preview_ped"];
this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"]; this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"];
this->spawn.preview_vehicle = j["spawn"]["preview_vehicle"]; this->spawn_vehicle.preview_vehicle = j["spawn_vehicle"]["preview_vehicle"];
this->spawn.spawn_inside = j["spawn"]["spawn_inside"]; this->spawn_vehicle.spawn_inside = j["spawn_vehicle"]["spawn_inside"];
this->spawn.spawn_maxed = j["spawn"]["spawn_maxed"]; this->spawn_vehicle.spawn_maxed = j["spawn_vehicle"]["spawn_maxed"];
this->spawn.plate = j["spawn"]["plate"]; this->spawn_vehicle.plate = j["spawn_vehicle"]["plate"];
this->clone_pv.preview_vehicle = j["clone_pv"]["preview_vehicle"]; this->clone_pv.preview_vehicle = j["clone_pv"]["preview_vehicle"];
this->clone_pv.spawn_inside = j["clone_pv"]["spawn_inside"]; this->clone_pv.spawn_inside = j["clone_pv"]["spawn_inside"];
@ -539,6 +546,8 @@ namespace big
this->clone_pv.clone_plate = j["clone_pv"]["clone_plate"]; this->clone_pv.clone_plate = j["clone_pv"]["clone_plate"];
this->clone_pv.plate = j["clone_pv"]["plate"]; this->clone_pv.plate = j["clone_pv"]["plate"];
this->spawn_ped.preview_ped = j["spawn_ped"]["preview_ped"];
this->spoofing.spoof_ip = j["spoofing"]["spoof_ip"]; this->spoofing.spoof_ip = j["spoofing"]["spoof_ip"];
this->spoofing.spoof_rockstar_id = j["spoofing"]["spoof_rockstar_id"]; this->spoofing.spoof_rockstar_id = j["spoofing"]["spoof_rockstar_id"];
this->spoofing.spoof_username = j["spoofing"]["spoof_username"]; this->spoofing.spoof_username = j["spoofing"]["spoof_username"];
@ -598,6 +607,7 @@ namespace big
this->weapons.ammo_special.toggle = j["weapons"]["ammo_special"]["toggle"]; this->weapons.ammo_special.toggle = j["weapons"]["ammo_special"]["toggle"];
this->window.color = j["window"]["color"]; this->window.color = j["window"]["color"];
this->window.gui_scale = j["window"]["gui_scale"];
this->window.debug = j["window"]["debug"]; this->window.debug = j["window"]["debug"];
this->window.handling = j["window"]["handling"]; this->window.handling = j["window"]["handling"];
this->window.log = j["window"]["log"]; this->window.log = j["window"]["log"];
@ -779,7 +789,6 @@ namespace big
{ "no_ragdoll", this->self.no_ragdoll }, { "no_ragdoll", this->self.no_ragdoll },
{ "off_radar", this->self.off_radar }, { "off_radar", this->self.off_radar },
{ "super_run", this->self.super_run }, { "super_run", this->self.super_run },
{ "preview_ped", this->self.preview_ped }
} }
}, },
{ {
@ -801,11 +810,16 @@ namespace big
} }
}, },
{ {
"spawn", { "spawn_vehicle", {
{ "preview_vehicle", this->spawn.preview_vehicle }, { "preview_vehicle", this->spawn_vehicle.preview_vehicle },
{ "spawn_inside", this->spawn.spawn_inside }, { "spawn_inside", this->spawn_vehicle.spawn_inside },
{ "spawn_maxed", this->spawn.spawn_maxed}, { "spawn_maxed", this->spawn_vehicle.spawn_maxed},
{ "plate", this->spawn.plate } { "plate", this->spawn_vehicle.plate }
}
},
{
"spawn_ped", {
{ "preview_ped", this->spawn_ped.preview_ped },
} }
}, },
{ {
@ -890,6 +904,7 @@ namespace big
{ {
"window", { "window", {
{ "color", this->window.color }, { "color", this->window.color },
{ "gui_scale", this->window.gui_scale },
{ "debug", this->window.debug }, { "debug", this->window.debug },
{ "handling", this->window.handling }, { "handling", this->window.handling },
{ "log", this->window.log }, { "log", this->window.log },

View File

@ -12,6 +12,7 @@ namespace big
public: public:
static bool nav_button(const std::string_view); static bool nav_button(const std::string_view);
static bool button(const std::string_view); static bool button(const std::string_view);
static void icon(const std::string_view);
static void small_text(const std::string_view); static void small_text(const std::string_view);
static void sub_title(const std::string_view); static void sub_title(const std::string_view);
static void title(const std::string_view); static void title(const std::string_view);

View File

@ -0,0 +1,9 @@
#include "gui/components/components.hpp"
#include "fonts/fonts.hpp"
namespace big
{
void components::icon(const std::string_view text) {
components::custom_text(text.data(), g->window.font_icon);
}
}

View File

@ -43,14 +43,15 @@ namespace big
std::strcpy(font_storopia_cfg.Name, "Storopia"); std::strcpy(font_storopia_cfg.Name, "Storopia");
m_font = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 20.f, &font_storopia_cfg); m_font = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 20.f, &font_storopia_cfg);
g->window.font_title = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 40.f, &font_storopia_cfg); g->window.font_title = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 28.f, &font_storopia_cfg);
g->window.font_sub_title = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 30.f, &font_storopia_cfg); g->window.font_sub_title = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 24.f, &font_storopia_cfg);
g->window.font_small = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 17.5f, &font_storopia_cfg); g->window.font_normal = m_font;
g->window.font_small = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_storopia), sizeof(font_storopia), 18.f, &font_storopia_cfg);
ImFontConfig font_icons_cfg{}; ImFontConfig font_icons_cfg{};
font_icons_cfg.FontDataOwnedByAtlas = false; font_icons_cfg.FontDataOwnedByAtlas = false;
std::strcpy(font_icons_cfg.Name, "Icons"); std::strcpy(font_icons_cfg.Name, "Icons");
m_font_icons = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_icons), sizeof(font_icons), 24.f, &font_icons_cfg); g->window.font_icon = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(const_cast<std::uint8_t*>(font_icons), sizeof(font_icons), 24.f, &font_icons_cfg);
g_gui.dx_init(); g_gui.dx_init();
g_renderer = this; g_renderer = this;

View File

@ -16,11 +16,10 @@ namespace big
void post_reset(); void post_reset();
void wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); void wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
public: public:
ImFont* m_font; ImFont* m_font;
ImFont* m_font_title;
ImFont* m_monospace_font;
ImFont* m_font_icons;
private: private:
comptr<IDXGISwapChain> m_dxgi_swapchain; comptr<IDXGISwapChain> m_dxgi_swapchain;
comptr<ID3D11Device> m_d3d_device; comptr<ID3D11Device> m_d3d_device;

View File

@ -30,6 +30,7 @@ namespace big
if (!item_json["Category"].is_null()) if (!item_json["Category"].is_null())
{ {
this->weapon_type = item_json["Category"]; this->weapon_type = item_json["Category"];
this->weapon_type = this->weapon_type.substr(6);
} }
this->hash = item_json["Hash"]; this->hash = item_json["Hash"];
@ -61,7 +62,7 @@ namespace big
} }
} }
if (this->weapon_type == "GROUP_MELEE" || this->weapon_type == "GROUP_UNARMED" || is_gun) if (this->weapon_type == "MELEE" || this->weapon_type == "UNARMED" || is_gun)
{ {
this->reward_hash = rage::joaat((reward_prefix + std::string(item_json["Name"])).c_str()); this->reward_hash = rage::joaat((reward_prefix + std::string(item_json["Name"])).c_str());

View File

@ -31,7 +31,7 @@ namespace big
return current_nav; return current_nav;
} }
std::vector<tabs> gui_service::get_selected_tab() std::vector<tabs>& gui_service::get_selected_tab()
{ {
return current_tab; return current_tab;
} }
@ -69,7 +69,7 @@ namespace big
nav_ctr = 0; nav_ctr = 0;
} }
std::unordered_map<tabs, navigation_struct> gui_service::get_navigation() std::map<tabs, navigation_struct>& gui_service::get_navigation()
{ {
return nav; return nav;
} }

View File

@ -4,40 +4,48 @@
namespace big namespace big
{ {
enum class tabs { enum class tabs {
ESP_SETTINGS, NONE,
CONTEXT_MENU_SETTINGS,
GUI_SETTINGS, SELF,
WEAPONS,
TELEPORT,
MOBILE,
VEHICLE,
HANDLING,
HANDLING_SEARCH, HANDLING_SEARCH,
HANDLING_SAVED_PROFILE, HANDLING_SAVED_PROFILE,
HANDLING_MY_PROFILES, HANDLING_MY_PROFILES,
HANDLING_CURRENT_PROFILE, HANDLING_CURRENT_PROFILE,
LSC, LSC,
SPAWN_VEHICLE,
PV,
PERSIST_CAR,
FUN_VEHICLE,
WORLD,
SPAWN_PED,
NETWORK,
SESSION,
SPOOFING,
SETTINGS,
CONTEXT_MENU_SETTINGS,
ESP_SETTINGS,
GUI_SETTINGS,
NOTIFICATION_SETTINGS, NOTIFICATION_SETTINGS,
PROTECTION_SETTINGS, PROTECTION_SETTINGS,
DEBUG, DEBUG,
MOBILE,
NONE, PLAYER
NETWORK,
PLAYER,
SELF,
SESSION,
SETTINGS,
SPAWN,
PV,
VEHICLE_FUN,
PERSIST_CAR,
SPOOFING,
TELEPORT,
VEHICLE,
WEAPONS,
HANDLING,
}; };
struct navigation_struct struct navigation_struct
{ {
const char name[32] = ""; const char name[32] = "";
std::function<void()> func = nullptr; std::function<void()> func = nullptr;
std::unordered_map<tabs, navigation_struct> sub_nav{}; std::map<tabs, navigation_struct> sub_nav{};
}; };
class gui_service final class gui_service final
@ -45,7 +53,7 @@ namespace big
std::vector<tabs> current_tab{}; std::vector<tabs> current_tab{};
bool switched_view = true; bool switched_view = true;
std::unordered_map<tabs, navigation_struct> nav = { std::map<tabs, navigation_struct> nav = {
{tabs::SELF, { "Self",view::self, { {tabs::SELF, { "Self",view::self, {
{ tabs::WEAPONS, { "Weapons", view::weapons }}, { tabs::WEAPONS, { "Weapons", view::weapons }},
{ tabs::MOBILE, {"Mobile", view::mobile}}, { tabs::MOBILE, {"Mobile", view::mobile}},
@ -59,10 +67,13 @@ namespace big
{ tabs::HANDLING_SEARCH, {"Search Handling", view::handling_search } }, { tabs::HANDLING_SEARCH, {"Search Handling", view::handling_search } },
}}}, }}},
{ tabs::LSC, { "LS Customs", view::lsc }}, { tabs::LSC, { "LS Customs", view::lsc }},
{ tabs::SPAWN, { "Spawn", view::spawn }}, { tabs::SPAWN_VEHICLE, { "Spawn Vehicle", view::spawn_vehicle }},
{ tabs::PV, { "Personal Vehicle", view::pv }}, { tabs::PV, { "Personal Vehicle", view::pv }},
{ tabs::VEHICLE_FUN, { "Fun Features", view::vehicle_fun }},
{ tabs::PERSIST_CAR, { "Persist Car", view::persist_car }}, { tabs::PERSIST_CAR, { "Persist Car", view::persist_car }},
{ tabs::FUN_VEHICLE, { "Fun Features", view::fun_vehicle }},
}}},
{ tabs::WORLD, { "World", nullptr, {
{ tabs::SPAWN_PED, { "Spawn Ped", view::spawn_ped }},
}}}, }}},
{tabs::NETWORK, { "Network", nullptr, { {tabs::NETWORK, { "Network", nullptr, {
{ tabs::SPOOFING, { "Spoofing", view::spoofing }}, { tabs::SPOOFING, { "Spoofing", view::spoofing }},
@ -85,13 +96,13 @@ namespace big
int nav_ctr = 0; int nav_ctr = 0;
navigation_struct* get_selected(); navigation_struct* get_selected();
std::vector<tabs> get_selected_tab(); std::vector<tabs>& get_selected_tab();
bool has_switched_view(); bool has_switched_view();
void set_selected(tabs); void set_selected(tabs);
void set_nav_size(int); void set_nav_size(int);
void increment_nav_size(); void increment_nav_size();
void reset_nav_size(); void reset_nav_size();
std::unordered_map<tabs, navigation_struct> get_navigation(); std::map<tabs, navigation_struct>& get_navigation();
}; };
inline gui_service* g_gui_service{}; inline gui_service* g_gui_service{};

View File

@ -19,6 +19,7 @@ namespace big
void model_preview_service::show_ped(Hash hash) void model_preview_service::show_ped(Hash hash)
{ {
m_ped_clone = 0;
m_veh_model_hash = 0; m_veh_model_hash = 0;
m_veh_owned_mods.clear(); m_veh_owned_mods.clear();
@ -35,9 +36,29 @@ namespace big
} }
} }
void model_preview_service::show_ped(Hash hash, Ped clone)
{
m_veh_model_hash = 0;
m_veh_owned_mods.clear();
if (m_ped_model_hash != hash || m_ped_clone != clone)
{
m_ped_model_hash = hash;
m_ped_clone = clone;
if (m_ped_model_hash != 0)
{
m_new_model = true;
preview_loop();
}
}
}
void model_preview_service::show_vehicle(Hash hash, bool spawn_max) void model_preview_service::show_vehicle(Hash hash, bool spawn_max)
{ {
m_ped_model_hash = 0; m_ped_model_hash = 0;
m_ped_clone = 0;
m_veh_owned_mods.clear(); m_veh_owned_mods.clear();
if (m_veh_model_hash != hash || m_veh_spawn_max != spawn_max) if (m_veh_model_hash != hash || m_veh_spawn_max != spawn_max)
@ -57,6 +78,7 @@ namespace big
void model_preview_service::show_vehicle(const std::map<int, int32_t>& owned_mods, bool spawn_max) void model_preview_service::show_vehicle(const std::map<int, int32_t>& owned_mods, bool spawn_max)
{ {
m_ped_model_hash = 0; m_ped_model_hash = 0;
m_ped_clone = 0;
if ( if (
m_veh_spawn_max != spawn_max || m_veh_spawn_max != spawn_max ||
@ -114,7 +136,8 @@ namespace big
if (m_ped_model_hash) if (m_ped_model_hash)
{ {
m_current_ent = ped::spawn(ePedType::PED_TYPE_ARMY, m_ped_model_hash, location, 0.f, false); m_current_ent = ped::spawn(ePedType::PED_TYPE_ARMY, m_ped_model_hash, m_ped_clone, location, 0.f, false);
ENTITY::SET_ENTITY_HEALTH(m_current_ent, 0, 0); ENTITY::SET_ENTITY_HEALTH(m_current_ent, 0, 0);
script::get_current()->yield(20ms); script::get_current()->yield(20ms);
PED::RESURRECT_PED(m_current_ent); PED::RESURRECT_PED(m_current_ent);

View File

@ -15,6 +15,7 @@ namespace big
bool m_veh_spawn_max = false; bool m_veh_spawn_max = false;
Hash m_ped_model_hash = 0; Hash m_ped_model_hash = 0;
Ped m_ped_clone = 0;
bool m_new_model = false; bool m_new_model = false;
float m_heading = 0.f; float m_heading = 0.f;
@ -25,6 +26,7 @@ namespace big
~model_preview_service(); ~model_preview_service();
void show_ped(Hash hash); void show_ped(Hash hash);
void show_ped(Hash hash, Ped clone);
void show_vehicle(Hash hash, bool spawn_max); void show_vehicle(Hash hash, bool spawn_max);
void show_vehicle(const std::map<int, int32_t>& owned_mods, bool spawn_max); void show_vehicle(const std::map<int, int32_t>& owned_mods, bool spawn_max);

View File

@ -40,12 +40,20 @@ namespace big
player_ptr player_service::get_by_msg_id(uint32_t msg_id) const player_ptr player_service::get_by_msg_id(uint32_t msg_id) const
{ {
for (const auto& [name, player] : m_players) for (const auto& [_, player] : m_players)
if (player->get_net_game_player()->m_msg_id == msg_id) if (player->get_net_game_player()->m_msg_id == msg_id)
return player; return player;
return nullptr; return nullptr;
} }
player_ptr player_service::get_by_id(uint32_t id) const
{
for (const auto& [name, player] : m_players)
if (player->id() == id)
return player;
return nullptr;
}
player_ptr player_service::get_by_host_token(uint64_t token) const player_ptr player_service::get_by_host_token(uint64_t token) const
{ {
for (const auto& [name, player] : m_players) for (const auto& [name, player] : m_players)

View File

@ -35,6 +35,7 @@ namespace big
[[nodiscard]] player_ptr get_by_name(std::string name); [[nodiscard]] player_ptr get_by_name(std::string name);
[[nodiscard]] player_ptr get_by_msg_id(uint32_t msg_id) const; [[nodiscard]] player_ptr get_by_msg_id(uint32_t msg_id) const;
[[nodiscard]] player_ptr get_by_id(uint32_t id) const;
[[nodiscard]] player_ptr get_by_host_token(uint64_t token) const; [[nodiscard]] player_ptr get_by_host_token(uint64_t token) const;
[[nodiscard]] player_ptr get_selected() const; [[nodiscard]] player_ptr get_selected() const;

View File

@ -5,13 +5,30 @@
namespace big::ped namespace big::ped
{ {
inline void steal_outfit(const Ped target) inline bool change_player_model(const Hash hash)
{
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))
{
return false;
}
PLAYER::SET_PLAYER_MODEL(self::id, hash);
script::get_current()->yield();
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
return true;
}
inline bool steal_outfit(const Ped target)
{ {
Ped ped = self::ped; Ped ped = self::ped;
if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target)) { if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target)) {
g_notification_service->push("Error", "Model mismatch, use steal identity instead."); return false;
return;
} }
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
PED::SET_PED_COMPONENT_VARIATION PED::SET_PED_COMPONENT_VARIATION
@ -23,6 +40,8 @@ namespace big::ped
PED::GET_PED_PALETTE_VARIATION(target, i) PED::GET_PED_PALETTE_VARIATION(target, i)
); );
} }
return true;
} }
inline void steal_identity(const Ped target) inline void steal_identity(const Ped target)
@ -39,7 +58,7 @@ namespace big::ped
PED::SET_PED_ARMOUR(self::ped, current_armor); PED::SET_PED_ARMOUR(self::ped, current_armor);
} }
inline Ped spawn(ePedType pedType, Hash hash, Vector3 location, float heading, bool is_networked = true) inline Ped spawn(ePedType pedType, Hash hash, Hash clone, Vector3 location, float heading, bool is_networked = true)
{ {
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++) for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
{ {
@ -58,6 +77,11 @@ namespace big::ped
script::get_current()->yield(); script::get_current()->yield();
if (clone)
{
PED::CLONE_PED_TO_TARGET(clone, ped);
}
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
return ped; return ped;

View File

@ -15,7 +15,8 @@ namespace big
if (ImGui::Begin("main", nullptr, window_flags)) if (ImGui::Begin("main", nullptr, window_flags))
{ {
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
components::sub_title(g_gui_service->get_selected()->name); components::title(g_gui_service->get_selected()->name);
ImGui::Separator();
g_gui_service->get_selected()->func(); g_gui_service->get_selected()->func();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
} }

View File

@ -6,7 +6,7 @@ namespace big
{ {
void view::session() void view::session()
{ {
components::small_text("Session Switcher"); components::sub_title("Session Switcher");
if (ImGui::ListBoxHeader("###session_switch")) if (ImGui::ListBoxHeader("###session_switch"))
{ {
for (const auto& session_type : sessions) for (const auto& session_type : sessions)

View File

@ -8,7 +8,7 @@ namespace big
{ {
components::small_text("To spoof any of the below credentials you need to reconnect with the lobby."); components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.");
components::small_text("Username"); components::sub_title("Username");
g_fiber_pool->queue_job([] { g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
@ -27,7 +27,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("IP Address"); components::sub_title("IP Address");
g_fiber_pool->queue_job([] { g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
@ -40,7 +40,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Rockstar ID"); components::sub_title("Rockstar ID");
g_fiber_pool->queue_job([] { g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);

View File

@ -3,13 +3,12 @@
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "views/view.hpp" #include "views/view.hpp"
#include "fonts/fonts.hpp" #include "fonts/fonts.hpp"
#include <renderer.hpp> #include "natives.hpp"
#include <natives.hpp> #include "fiber_pool.hpp"
#define IMGUI_DEFINE_PLACEMENT_NEW #define IMGUI_DEFINE_PLACEMENT_NEW
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui_internal.h> #include <imgui_internal.h>
#include "fiber_pool.hpp"
namespace big namespace big
{ {
@ -38,7 +37,7 @@ namespace big
// calculate icons width // calculate icons width
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGui::PushFont(g_renderer->m_font_icons); ImGui::PushFont(g->window.font_icon);
ImVec2 iconsSize = ImGui::CalcTextSize(playerIconsCStr, playerIconsCStr + playerIcons.size()); ImVec2 iconsSize = ImGui::CalcTextSize(playerIconsCStr, playerIconsCStr + playerIcons.size());
ImVec2 iconsPos(window->DC.CursorPos.x + 300.0f - 32.0f - iconsSize.x, window->DC.CursorPos.y + 2.0f); ImVec2 iconsPos(window->DC.CursorPos.x + 300.0f - 32.0f - iconsSize.x, window->DC.CursorPos.y + 2.0f);
ImRect iconsBox(iconsPos, iconsPos + iconsSize); ImRect iconsBox(iconsPos, iconsPos + iconsSize);
@ -46,7 +45,9 @@ namespace big
if (playerSelected) if (playerSelected)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.29f, 0.45f, 0.69f, 1.f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.29f, 0.45f, 0.69f, 1.f));
}
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, { 0.0, 0.5 }); ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, { 0.0, 0.5 });
ImGui::PushID(plyr->id()); ImGui::PushID(plyr->id());
@ -63,7 +64,7 @@ namespace big
ImGui::PopStyleColor(); ImGui::PopStyleColor();
// render icons on top of the player button // render icons on top of the player button
ImGui::PushFont(g_renderer->m_font_icons); ImGui::PushFont(g->window.font_icon);
ImGui::RenderTextWrapped(iconsBox.Min, playerIconsCStr, playerIconsCStr + playerIcons.size(), iconsSize.x); ImGui::RenderTextWrapped(iconsBox.Min, playerIconsCStr, playerIconsCStr + playerIcons.size(), iconsSize.x);
ImGui::PopFont(); ImGui::PopFont();
} }

View File

@ -8,7 +8,7 @@ namespace big
void view::mobile() { void view::mobile() {
ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always);
components::small_text("Lester"); components::sub_title("Lester");
ImGui::Checkbox("Off Radar", &g->self.off_radar); ImGui::Checkbox("Off Radar", &g->self.off_radar);

View File

@ -2,9 +2,6 @@
#include "util/entity.hpp" #include "util/entity.hpp"
#include "util/local_player.hpp" #include "util/local_player.hpp"
#include "views/view.hpp" #include "views/view.hpp"
#include "services/gta_data/gta_data_service.hpp"
#include "services/model_preview/model_preview_service.hpp"
#include <imgui_internal.h>
namespace big namespace big
{ {
@ -43,148 +40,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Player Model Changer"); components::sub_title("General");
static int selected_ped_type = -1;
static bool ped_model_dropdown_open = false;
static char ped_model_buf[64];
auto ped_type_arr = g_gta_data_service->get_ped_type_arr();
auto ped_arr = g_gta_data_service->get_ped_arr();
ImGui::SetNextItemWidth(300.f);
if (ImGui::BeginCombo("Ped Type", selected_ped_type == -1 ? "ALL" : ped_type_arr[selected_ped_type].c_str()))
{
if (ImGui::Selectable("ALL", selected_ped_type == -1))
{
selected_ped_type = -1;
}
for (int i = 0; i < ped_type_arr.size(); i++)
{
if (ImGui::Selectable(ped_type_arr[i].c_str(), selected_ped_type == i))
{
selected_ped_type = i;
ped_model_buf[0] = 0;
}
if (selected_ped_type == i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::SetNextItemWidth(300.f);
components::input_text_with_hint("Model Name##player_model_name", "Model Name", ped_model_buf, sizeof(ped_model_buf), ImGuiInputTextFlags_EnterReturnsTrue, [] {
ped_model_dropdown_open = false;
});
bool ped_model_dropdown_focused = ImGui::IsItemActive();
if (ImGui::IsItemActivated())
{
ped_model_dropdown_open = true;
}
if (ped_model_dropdown_open)
{
bool is_open = true;
bool item_hovered = false;
std::string lower_search = ped_model_buf;
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
ImGui::SetNextWindowPos({ ImGui::GetItemRectMin().x, ImGui::GetItemRectMax().y });
ImGui::SetNextWindowSize({ 300, 300 });
if (ImGui::Begin("##player_model_popup", &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_Tooltip))
{
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
ped_model_dropdown_focused |= ImGui::IsWindowFocused();
for (auto& item : ped_arr)
{
std::string ped_type = item.ped_type;
std::string name = item.name;
std::transform(name.begin(), name.end(), name.begin(), tolower);
if ((
selected_ped_type == -1 || ped_type_arr[selected_ped_type] == ped_type
) && (
name.find(lower_search) != std::string::npos
)) {
bool selectable_highlighted = lower_search == name;
bool selectable_clicked = ImGui::Selectable(item.name.c_str(), selectable_highlighted);
ped_model_dropdown_focused |= ImGui::IsItemFocused();
if (selectable_clicked)
{
strncpy(ped_model_buf, item.name.c_str(), 64);
ped_model_dropdown_open = false;
ped_model_dropdown_focused = false;
}
if (selectable_highlighted)
{
ImGui::SetItemDefaultFocus();
}
if (ImGui::IsItemHovered())
{
item_hovered = true;
g_model_preview_service->show_ped(item.hash);
}
}
}
ImGui::End();
}
ped_model_dropdown_open = ped_model_dropdown_focused;
if (!g->self.preview_ped || (g->self.preview_ped && (!item_hovered || !ped_model_dropdown_open)))
{
g_model_preview_service->stop_preview();
}
}
if (ImGui::Checkbox("Preview", &g->self.preview_ped))
{
if (!g->self.preview_ped)
{
g_model_preview_service->stop_preview();
}
}
ImGui::SameLine();
components::button("Change Player Model", [] {
const Hash hash = rage::joaat(ped_model_buf);
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))
{
g_notification_service->push_error("Self", "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(self::ped);
script::get_current()->yield();
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
});
ImGui::Separator();
components::small_text("General");
ImGui::BeginGroup(); ImGui::BeginGroup();
@ -221,7 +77,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Proofs"); components::sub_title("Proofs");
if (ImGui::Button("Check all")) if (ImGui::Button("Check all"))
{ {
@ -279,7 +135,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Police"); components::sub_title("Police");
ImGui::Checkbox("Never Wanted", &g->self.never_wanted); ImGui::Checkbox("Never Wanted", &g->self.never_wanted);

View File

@ -10,7 +10,7 @@
namespace big namespace big
{ {
void view::weapons() { void view::weapons() {
components::small_text("Ammo"); components::sub_title("Ammo");
ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo); ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo);
ImGui::SameLine(); ImGui::SameLine();
@ -60,7 +60,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Misc"); components::sub_title("Misc");
ImGui::Checkbox("Force Crosshairs", &g->weapons.force_crosshairs); ImGui::Checkbox("Force Crosshairs", &g->weapons.force_crosshairs);
@ -95,7 +95,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Custom Weapons"); components::sub_title("Custom Weapons");
CustomWeapon selected = g->weapons.custom_weapon; CustomWeapon selected = g->weapons.custom_weapon;

View File

@ -9,7 +9,7 @@
namespace big namespace big
{ {
void view::debug() { void view::debug() {
components::small_text("Globals"); components::sub_title("Globals");
if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running) if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running)
g_thread_pool->push([&]() { g_globals_service->loop(); }); g_thread_pool->push([&]() { g_globals_service->loop(); });
@ -167,7 +167,7 @@ namespace big
ImGui::EndGroup(); ImGui::EndGroup();
} }
components::small_text("Scripting Events"); components::sub_title("Scripting Events");
static int64_t* args; static int64_t* args;
static int event_arg_count = 1; static int event_arg_count = 1;
@ -219,7 +219,7 @@ namespace big
g_pointers->m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits); g_pointers->m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits);
}); });
components::small_text("Debug"); components::sub_title("Debug");
ImGui::Checkbox("Script Event Logging", &g->debug.script_event_logging); ImGui::Checkbox("Script Event Logging", &g->debug.script_event_logging);

View File

@ -14,13 +14,13 @@ namespace big
void view::notification_settings() void view::notification_settings()
{ {
components::small_text("GTA Threads"); components::sub_title("GTA Threads");
draw_pair_option("Terminate", g->notifications.gta_thread_kill); draw_pair_option("Terminate", g->notifications.gta_thread_kill);
draw_pair_option("Start", g->notifications.gta_thread_start); draw_pair_option("Start", g->notifications.gta_thread_start);
components::small_text("Network Player Manager"); components::sub_title("Network Player Manager");
ImGui::Text("Player Join"); ImGui::Text("Player Join");
@ -35,7 +35,7 @@ namespace big
draw_pair_option("Init", g->notifications.network_player_mgr_init); draw_pair_option("Init", g->notifications.network_player_mgr_init);
draw_pair_option("Shutdown", g->notifications.network_player_mgr_shutdown); draw_pair_option("Shutdown", g->notifications.network_player_mgr_shutdown);
components::small_text("Received Event"); components::sub_title("Received Event");
auto& received_event = g->notifications.received_event; auto& received_event = g->notifications.received_event;
@ -53,7 +53,7 @@ namespace big
draw_pair_option("Vehicle Temp Action", received_event.vehicle_temp_action); draw_pair_option("Vehicle Temp Action", received_event.vehicle_temp_action);
ImGui::EndGroup(); ImGui::EndGroup();
components::small_text("Script Event Handler"); components::sub_title("Script Event Handler");
auto& script_event_handler = g->notifications.script_event_handler; auto& script_event_handler = g->notifications.script_event_handler;
@ -92,7 +92,7 @@ namespace big
draw_pair_option("Wanted Level", script_event_handler.clear_wanted_level); draw_pair_option("Wanted Level", script_event_handler.clear_wanted_level);
ImGui::EndGroup(); ImGui::EndGroup();
components::small_text("Other"); components::sub_title("Other");
draw_pair_option("Reports", g->notifications.reports); draw_pair_option("Reports", g->notifications.reports);
draw_pair_option("Transaction Error / Rate Limit", g->notifications.transaction_rate_limit); draw_pair_option("Transaction Error / Rate Limit", g->notifications.transaction_rate_limit);

View File

@ -7,11 +7,11 @@ namespace big
void scripts_popupmodal() void scripts_popupmodal()
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
components::small_text("Scripts"); components::sub_title("Scripts");
ImGui::SameLine(ImGui::GetWindowWidth() - 100); ImGui::SameLine(ImGui::GetWindowWidth() - 100);
if (ImGui::Button("Close")) ImGui::CloseCurrentPopup(); if (ImGui::Button("Close")) ImGui::CloseCurrentPopup();
ImGui::Spacing(); ImGui::Spacing();
components::small_text("These scripts are responsible for all looped features.\nOnly disable if you know what you are doing."); components::sub_title("These scripts are responsible for all looped features.\nOnly disable if you know what you are doing.");
for (const auto& script : g_script_mgr.scripts()) { for (const auto& script : g_script_mgr.scripts()) {
if (script->is_toggleable()) if (script->is_toggleable())
@ -24,7 +24,7 @@ namespace big
void view::settings() void view::settings()
{ {
components::small_text("Hotkeys"); components::sub_title("Hotkeys");
ImGui::PushItemWidth(350.f); ImGui::PushItemWidth(350.f);

View File

@ -0,0 +1,235 @@
#include "core/enums.hpp"
#include "fiber_pool.hpp"
#include "script.hpp"
#include "views/view.hpp"
#include "util/vehicle.hpp"
#include "util/mobile.hpp"
#include "core/data/speed_units.hpp"
#include "gui/handling/handling_tabs.hpp"
#include "services/gta_data/gta_data_service.hpp"
#include "services/model_preview/model_preview_service.hpp"
#include <imgui_internal.h>
namespace big
{
void view::fun_vehicle()
{
components::sub_title("Seat Changer");
{
static std::map<int, bool> seats;
static bool ready = true;
if (self::veh == 0)
{
seats.clear();
}
if (self::veh != 0 && ready == true)
{
ready = false;
g_fiber_pool->queue_job([] {
std::map<int, bool> tmp_seats;
int num_of_seats = VEHICLE::GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(self::veh);
for (int i = -1; i < num_of_seats; i++)
{
tmp_seats[i] = VEHICLE::IS_VEHICLE_SEAT_FREE(self::veh, i, true);
}
seats = tmp_seats;
ready = true;
});
}
if (seats.size() == 0)
{
ImGui::Text("Please enter a vehicle.");
}
else
{
for (auto& it : seats)
{
int idx = it.first;
if (!it.second)
{
ImGui::BeginDisabled();
}
std::string name = "Driver";
if (idx >= 0)
{
name = "Seat " + std::to_string(idx + 1);
}
if ((idx + 1) % 4 != 0) {
ImGui::SameLine();
}
components::button(name, [idx] {
PED::SET_PED_INTO_VEHICLE(self::ped, self::veh, idx);
});
if (!it.second)
{
ImGui::EndDisabled();
}
}
}
}
ImGui::Separator();
components::sub_title("Auto Drive");
{
float auto_drive_speed_user_unit = vehicle::mps_to_speed(g->vehicle.auto_drive_speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Top Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&auto_drive_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.auto_drive_speed = vehicle::speed_to_mps(auto_drive_speed_user_unit, g->vehicle.speed_unit);
}
static constexpr char const* driving_style_names[] = { "Law-Abiding", "The Road Is Yours" };
if (ImGui::BeginCombo("Driving Style", driving_style_names[(int)g->vehicle.auto_drive_style]))
{
for (int i = 0; i < 2; i++)
{
if (ImGui::Selectable(driving_style_names[i], g->vehicle.auto_drive_style == (AutoDriveStyle)i))
{
g->vehicle.auto_drive_style = (AutoDriveStyle)i;
g_notification_service->push_warning(
"Auto Drive",
fmt::format("Driving style set to {}.", driving_style_names[i])
);
}
if (g->vehicle.auto_drive_style == (AutoDriveStyle)i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (components::button("To Objective")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::OBJECTITVE;
}
ImGui::SameLine();
if (components::button("To Waypoint")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::WAYPOINT;
}
ImGui::SameLine();
if (components::button("Wander")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::WANDER;
}
ImGui::SameLine();
if (components::button("Emergency Stop")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP;
}
}
ImGui::Separator();
components::sub_title("Rainbow Paint");
{
ImGui::Checkbox("Primary", &g->vehicle.rainbow_primary);
ImGui::SameLine();
ImGui::Checkbox("Secondary", &g->vehicle.rainbow_secondary);
ImGui::SameLine();
ImGui::Checkbox("Neon", &g->vehicle.rainbow_neon);
ImGui::SameLine();
ImGui::Checkbox("Smoke", &g->vehicle.rainbow_smoke);
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
ImGui::SetNextItemWidth(120);
if (ImGui::BeginCombo("RGB Type", rgb_types[g->vehicle.rainbow_paint]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.rainbow_paint == i;
if (ImGui::Selectable(rgb_types[i], itemSelected))
{
g->vehicle.rainbow_paint = i;
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (g->vehicle.rainbow_paint != 0)
{
ImGui::SameLine();
ImGui::SetNextItemWidth(150);
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
}
}
ImGui::Separator();
static constexpr char const* boost_behaviors[] = { "Default", "Instant Refill", "Infinite" };
if (ImGui::BeginCombo("Boost Behavior", boost_behaviors[static_cast<int>(g->vehicle.boost_behavior)]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.boost_behavior == static_cast<eBoostBehaviors>(i);
if (ImGui::Selectable(boost_behaviors[i], itemSelected))
{
g->vehicle.boost_behavior = static_cast<eBoostBehaviors>(i);
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Separator();
components::sub_title("Vehicle Fly");
{
ImGui::BeginGroup();
ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled);
ImGui::Checkbox("Don't Stop", &g->vehicle.fly.dont_stop);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Disable Collision", &g->vehicle.fly.no_collision);
ImGui::Checkbox("Stop On Exit", &g->vehicle.fly.stop_on_exit);
ImGui::EndGroup();
float fly_speed_user_unit = vehicle::mps_to_speed(g->vehicle.fly.speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&fly_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.fly.speed = vehicle::speed_to_mps(fly_speed_user_unit, g->vehicle.speed_unit);
}
}
}
}

View File

@ -223,7 +223,7 @@ namespace big
} }
ImGui::Separator(); ImGui::Separator();
components::small_text("Mod Options"); components::sub_title("Mod Options");
bool is_bulletproof_tires = !owned_mods[MOD_TIRE_CAN_BURST]; bool is_bulletproof_tires = !owned_mods[MOD_TIRE_CAN_BURST];
if (ImGui::Checkbox("Bulletproof Tires", (bool*)&is_bulletproof_tires)) if (ImGui::Checkbox("Bulletproof Tires", (bool*)&is_bulletproof_tires))
@ -261,7 +261,7 @@ namespace big
ImGui::BeginGroup(); ImGui::BeginGroup();
components::small_text("Slot"); components::sub_title("Slot");
if (ImGui::ListBoxHeader("##slot", ImVec2(200, 200))) if (ImGui::ListBoxHeader("##slot", ImVec2(200, 200)))
{ {
for (const auto& [slot, name] : slot_display_names) for (const auto& [slot, name] : slot_display_names)
@ -300,7 +300,7 @@ namespace big
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
components::small_text("Mod"); components::sub_title("Mod");
if (ImGui::ListBoxHeader("##mod", ImVec2(240, 200))) if (ImGui::ListBoxHeader("##mod", ImVec2(240, 200)))
{ {
for (const auto& it : mod_display_names[selected_slot]) for (const auto& it : mod_display_names[selected_slot])
@ -369,7 +369,7 @@ namespace big
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
components::small_text("Style"); components::sub_title("Style");
if (ImGui::ListBoxHeader("##style", ImVec2(200, 200))) if (ImGui::ListBoxHeader("##style", ImVec2(200, 200)))
{ {
std::string mod_name = mod_display_names[selected_slot][*wheel_stock_mod]; std::string mod_name = mod_display_names[selected_slot][*wheel_stock_mod];
@ -417,7 +417,7 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("Neon Light Options"); components::sub_title("Neon Light Options");
if (ImGui::Checkbox("Headlight##headlight_en", (bool*)&owned_mods[MOD_XENON_LIGHTS])) if (ImGui::Checkbox("Headlight##headlight_en", (bool*)&owned_mods[MOD_XENON_LIGHTS]))
{ {
@ -483,7 +483,7 @@ namespace big
}); });
ImGui::Separator(); ImGui::Separator();
components::small_text("Color Options"); components::sub_title("Color Options");
static int color_to_change = 0; static int color_to_change = 0;
static int color_type = 8; static int color_type = 8;

View File

@ -28,7 +28,7 @@ namespace big
{ {
g_notification_service->push_warning("Persist Car", "Vehicle failed to spawn, there is most likely too many spawned vehicles in the area"); g_notification_service->push_warning("Persist Car", "Vehicle failed to spawn, there is most likely too many spawned vehicles in the area");
} }
else if (g->spawn.spawn_inside) else if (g->spawn_vehicle.spawn_inside)
teleport::into_vehicle(vehicle); teleport::into_vehicle(vehicle);
selected_vehicle_file.clear(); selected_vehicle_file.clear();

View File

@ -84,7 +84,7 @@ namespace big
components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None); components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None);
g_mobile_service->refresh_personal_vehicles(); g_mobile_service->refresh_personal_vehicles();
if (ImGui::ListBoxHeader("###personal_veh_list", { 300, static_cast<float>(*g_pointers->m_resolution_y - 184 - 38 * num_of_rows) })) if (ImGui::ListBoxHeader("###personal_veh_list", { 300, static_cast<float>(*g_pointers->m_resolution_y - 188 - 38 * num_of_rows) }))
{ {
if (g_mobile_service->personal_vehicles().empty()) if (g_mobile_service->personal_vehicles().empty())
{ {
@ -118,7 +118,7 @@ namespace big
components::selectable(label, false, [&personal_veh] { components::selectable(label, false, [&personal_veh] {
if (g->clone_pv.spawn_clone) if (g->clone_pv.spawn_clone)
{ {
Vector3 spawn_location = vehicle::get_spawn_location(g->spawn.spawn_inside); Vector3 spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped); float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
auto vehicle_idx = personal_veh->get_vehicle_idx(); auto vehicle_idx = personal_veh->get_vehicle_idx();
@ -161,7 +161,7 @@ namespace big
}); });
ImGui::PopID(); ImGui::PopID();
if (!g->spawn.preview_vehicle || (g->spawn.preview_vehicle && !ImGui::IsAnyItemHovered())) if (!g->clone_pv.preview_vehicle || (g->clone_pv.preview_vehicle && !ImGui::IsAnyItemHovered()))
{ {
g_model_preview_service->stop_preview(); g_model_preview_service->stop_preview();
} }

View File

@ -7,28 +7,28 @@
namespace big namespace big
{ {
void view::spawn() void view::spawn_vehicle()
{ {
ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always);
if (ImGui::Checkbox("Preview", &g->spawn.preview_vehicle)) if (ImGui::Checkbox("Preview", &g->spawn_vehicle.preview_vehicle))
{ {
if (!g->spawn.preview_vehicle) if (!g->spawn_vehicle.preview_vehicle)
{ {
g_model_preview_service->stop_preview(); g_model_preview_service->stop_preview();
} }
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Spawn In", &g->spawn.spawn_inside); ImGui::Checkbox("Spawn In", &g->spawn_vehicle.spawn_inside);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Spawn Maxed", &g->spawn.spawn_maxed); ImGui::Checkbox("Spawn Maxed", &g->spawn_vehicle.spawn_maxed);
static char plate_buf[9] = { 0 }; static char plate_buf[9] = { 0 };
strncpy(plate_buf, g->spawn.plate.c_str(), 9); strncpy(plate_buf, g->spawn_vehicle.plate.c_str(), 9);
ImGui::SetNextItemWidth(300.f); ImGui::SetNextItemWidth(300.f);
components::input_text_with_hint("Plate", "Plate Number", plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] { components::input_text_with_hint("Plate", "Plate Number", plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] {
g->spawn.plate = plate_buf; g->spawn_vehicle.plate = plate_buf;
}); });
@ -66,7 +66,7 @@ namespace big
components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None); components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None);
if (ImGui::ListBoxHeader("###vehicles", { 300, static_cast<float>(*g_pointers->m_resolution_y - 184 - 38 * 4) })) if (ImGui::ListBoxHeader("###vehicles", { 300, static_cast<float>(*g_pointers->m_resolution_y - 188 - 38 * 4) }))
{ {
if (self::veh) if (self::veh)
{ {
@ -83,7 +83,7 @@ namespace big
components::selectable("Current Vehicle [" + item.display_name + "]", false, [] { components::selectable("Current Vehicle [" + item.display_name + "]", false, [] {
if (self::veh) if (self::veh)
{ {
Vector3 spawn_location = vehicle::get_spawn_location(g->spawn.spawn_inside); Vector3 spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped); float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh); auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh);
@ -96,14 +96,14 @@ namespace big
} }
else else
{ {
if (g->spawn.spawn_maxed) if (g->spawn_vehicle.spawn_maxed)
{ {
vehicle::max_vehicle(veh); vehicle::max_vehicle(veh);
} }
vehicle::set_plate(veh, plate_buf); vehicle::set_plate(veh, plate_buf);
if (g->spawn.spawn_inside) if (g->spawn_vehicle.spawn_inside)
{ {
vehicle::teleport_into_vehicle(veh); vehicle::teleport_into_vehicle(veh);
} }
@ -113,7 +113,7 @@ namespace big
g_model_preview_service->stop_preview(); g_model_preview_service->stop_preview();
}); });
if (!g->spawn.preview_vehicle || (g->spawn.preview_vehicle && !ImGui::IsAnyItemHovered())) if (!g->spawn_vehicle.preview_vehicle || (g->spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
{ {
g_model_preview_service->stop_preview(); g_model_preview_service->stop_preview();
} }
@ -122,7 +122,7 @@ namespace big
g_fiber_pool->queue_job([] { g_fiber_pool->queue_job([] {
g_model_preview_service->show_vehicle( g_model_preview_service->show_vehicle(
vehicle::get_owned_mods_from_vehicle(self::veh), vehicle::get_owned_mods_from_vehicle(self::veh),
g->spawn.spawn_maxed g->spawn_vehicle.spawn_maxed
); );
}); });
} }
@ -153,7 +153,7 @@ namespace big
ImGui::PushID(item.hash); ImGui::PushID(item.hash);
components::selectable(item.display_name, false, [item] { components::selectable(item.display_name, false, [item] {
Vector3 spawn_location = vehicle::get_spawn_location(g->spawn.spawn_inside); Vector3 spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped); float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
const Vehicle veh = vehicle::spawn(item.hash, spawn_location, spawn_heading); const Vehicle veh = vehicle::spawn(item.hash, spawn_location, spawn_heading);
@ -164,14 +164,14 @@ namespace big
} }
else else
{ {
if (g->spawn.spawn_maxed) if (g->spawn_vehicle.spawn_maxed)
{ {
vehicle::max_vehicle(veh); vehicle::max_vehicle(veh);
} }
vehicle::set_plate(veh, plate_buf); vehicle::set_plate(veh, plate_buf);
if (g->spawn.spawn_inside) if (g->spawn_vehicle.spawn_inside)
{ {
vehicle::teleport_into_vehicle(veh); vehicle::teleport_into_vehicle(veh);
} }
@ -181,13 +181,13 @@ namespace big
}); });
ImGui::PopID(); ImGui::PopID();
if (!g->spawn.preview_vehicle || (g->spawn.preview_vehicle && !ImGui::IsAnyItemHovered())) if (!g->spawn_vehicle.preview_vehicle || (g->spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
{ {
g_model_preview_service->stop_preview(); g_model_preview_service->stop_preview();
} }
else if (ImGui::IsItemHovered()) else if (ImGui::IsItemHovered())
{ {
g_model_preview_service->show_vehicle(item.hash, g->spawn.spawn_maxed); g_model_preview_service->show_vehicle(item.hash, g->spawn_vehicle.spawn_maxed);
} }
} }
} }

View File

@ -39,132 +39,136 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::small_text("General"); components::sub_title("General");
ImGui::BeginGroup();
ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::Checkbox("Vehicle Jump", &g->vehicle.vehicle_jump);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt);
ImGui::Checkbox("Turn Signals", &g->vehicle.turn_signals);
if (g->vehicle.turn_signals)
{ {
ImGui::Checkbox("Fully Automatic Signal", &g->vehicle.auto_turn_signals); ImGui::BeginGroup();
} ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::Checkbox("Vehicle Jump", &g->vehicle.vehicle_jump);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Separator(); ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
components::small_text("Proofs"); ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::Button("Check all")) ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt);
{ ImGui::Checkbox("Turn Signals", &g->vehicle.turn_signals);
g->vehicle.proof_bullet = true; if (g->vehicle.turn_signals)
g->vehicle.proof_fire = true;
g->vehicle.proof_collision = true;
g->vehicle.proof_melee = true;
g->vehicle.proof_explosion = true;
g->vehicle.proof_steam = true;
g->vehicle.proof_water = true;
}
ImGui::SameLine();
if (ImGui::Button("Uncheck all"))
{
g->vehicle.proof_bullet = false;
g->vehicle.proof_fire = false;
g->vehicle.proof_collision = false;
g->vehicle.proof_melee = false;
g->vehicle.proof_explosion = false;
g->vehicle.proof_steam = false;
g->vehicle.proof_water = false;
}
ImGui::BeginGroup();
ImGui::Checkbox("Bullet", &g->vehicle.proof_bullet);
ImGui::Checkbox("Fire", &g->vehicle.proof_fire);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Collision", &g->vehicle.proof_collision);
ImGui::Checkbox("Melee", &g->vehicle.proof_melee);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Explosion", &g->vehicle.proof_explosion);
ImGui::Checkbox("Steam", &g->vehicle.proof_steam);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Water", &g->vehicle.proof_water);
ImGui::EndGroup();
ImGui::Separator();
components::small_text("Speed Unit");
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::KMPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::KMPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MIPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MIPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MPS].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MPS
);
ImGui::Separator();
components::small_text("Speedo Meter");
ImGui::Checkbox("Enabled", &g->vehicle.speedo_meter.enabled);
if (g->vehicle.speedo_meter.enabled)
{
ImGui::Text("Position (X, Y)");
float pos[2] = { g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y };
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
{ {
g->vehicle.speedo_meter.x = pos[0]; ImGui::Checkbox("Fully Automatic Signal", &g->vehicle.auto_turn_signals);
g->vehicle.speedo_meter.y = pos[1]; }
ImGui::EndGroup();
}
ImGui::Separator();
components::sub_title("Proofs");
{
if (ImGui::Button("Check all"))
{
g->vehicle.proof_bullet = true;
g->vehicle.proof_fire = true;
g->vehicle.proof_collision = true;
g->vehicle.proof_melee = true;
g->vehicle.proof_explosion = true;
g->vehicle.proof_steam = true;
g->vehicle.proof_water = true;
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side); if (ImGui::Button("Uncheck all"))
{
g->vehicle.proof_bullet = false;
g->vehicle.proof_fire = false;
g->vehicle.proof_collision = false;
g->vehicle.proof_melee = false;
g->vehicle.proof_explosion = false;
g->vehicle.proof_steam = false;
g->vehicle.proof_water = false;
}
ImGui::BeginGroup();
ImGui::Checkbox("Bullet", &g->vehicle.proof_bullet);
ImGui::Checkbox("Fire", &g->vehicle.proof_fire);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Collision", &g->vehicle.proof_collision);
ImGui::Checkbox("Melee", &g->vehicle.proof_melee);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Explosion", &g->vehicle.proof_explosion);
ImGui::Checkbox("Steam", &g->vehicle.proof_steam);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Water", &g->vehicle.proof_water);
ImGui::EndGroup();
}
ImGui::Separator();
components::sub_title("Speed Unit");
{
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::KMPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::KMPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MIPH].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MIPH
);
ImGui::SameLine();
ImGui::RadioButton(
speed_unit_strings[(int)SpeedUnit::MPS].c_str(),
(int*)&g->vehicle.speed_unit,
(int)SpeedUnit::MPS
);
}
ImGui::Separator();
components::sub_title("Speedo Meter");
{
ImGui::Checkbox("Enabled", &g->vehicle.speedo_meter.enabled);
if (g->vehicle.speedo_meter.enabled)
{
ImGui::Text("Position (X, Y)");
float pos[2] = { g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y };
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
{
g->vehicle.speedo_meter.x = pos[0];
g->vehicle.speedo_meter.y = pos[1];
}
ImGui::SameLine();
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side);
}
} }
g->vehicle.proof_mask = 0; g->vehicle.proof_mask = 0;

View File

@ -1,230 +0,0 @@
#include "core/data/speed_units.hpp"
#include "core/enums.hpp"
#include "fiber_pool.hpp"
#include "gui/handling/handling_tabs.hpp"
#include "script.hpp"
#include "util/mobile.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
namespace big
{
void view::vehicle_fun()
{
static std::map<int, bool> seats;
static bool ready = true;
if (self::veh == 0)
{
seats.clear();
}
if (self::veh != 0 && ready == true)
{
ready = false;
g_fiber_pool->queue_job([] {
std::map<int, bool> tmp_seats;
Hash model = ENTITY::GET_ENTITY_MODEL(self::veh);
int num_of_seats = VEHICLE::GET_VEHICLE_MODEL_NUMBER_OF_SEATS(model);
for (int i = -1; i < num_of_seats - 1; i++)
{
tmp_seats[i] = VEHICLE::IS_VEHICLE_SEAT_FREE(self::veh, i, true);
}
seats = tmp_seats;
ready = true;
});
}
components::small_text("Seat Changer");
if (seats.size() == 0)
{
ImGui::Text("Please enter a vehicle.");
}
else
{
for (auto& it : seats)
{
int idx = it.first;
if (!it.second)
{
ImGui::BeginDisabled();
}
std::string name = "Driver";
if (idx >= 0)
{
name = "Seat " + std::to_string(idx + 1);
}
if ((idx + 1) % 4 != 0) {
ImGui::SameLine();
}
components::button(name, [idx] {
PED::SET_PED_INTO_VEHICLE(self::ped, self::veh, idx);
});
if (!it.second)
{
ImGui::EndDisabled();
}
}
}
ImGui::Separator();
components::small_text("Auto Drive");
float auto_drive_speed_user_unit = vehicle::mps_to_speed(g->vehicle.auto_drive_speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Top Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&auto_drive_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.auto_drive_speed = vehicle::speed_to_mps(auto_drive_speed_user_unit, g->vehicle.speed_unit);
}
static constexpr char const* driving_style_names[] = { "Law-Abiding", "The Road Is Yours" };
if (ImGui::BeginCombo("Driving Style", driving_style_names[(int)g->vehicle.auto_drive_style]))
{
for (int i = 0; i < 2; i++)
{
if (ImGui::Selectable(driving_style_names[i], g->vehicle.auto_drive_style == (AutoDriveStyle)i))
{
g->vehicle.auto_drive_style = (AutoDriveStyle)i;
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", driving_style_names[i]));
}
if (g->vehicle.auto_drive_style == (AutoDriveStyle)i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (components::button("To Objective")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::OBJECTITVE;
}
ImGui::SameLine();
if (components::button("To Waypoint")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::WAYPOINT;
}
ImGui::SameLine();
if (components::button("Wander")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::WANDER;
}
ImGui::SameLine();
if (components::button("Emergency Stop")) {
g->vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP;
}
ImGui::Separator();
components::small_text("Rainbow Paint");
ImGui::Checkbox("Primary", &g->vehicle.rainbow_primary);
ImGui::SameLine();
ImGui::Checkbox("Secondary", &g->vehicle.rainbow_secondary);
ImGui::SameLine();
ImGui::Checkbox("Neon", &g->vehicle.rainbow_neon);
ImGui::SameLine();
ImGui::Checkbox("Smoke", &g->vehicle.rainbow_smoke);
if (g->vehicle.rainbow_primary || g->vehicle.rainbow_neon || g->vehicle.rainbow_secondary || g->vehicle.rainbow_smoke) {
ImGui::SetNextItemWidth(120);
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
if (ImGui::BeginCombo("RGB Type", rgb_types[g->vehicle.rainbow_paint]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.rainbow_paint == i;
if (ImGui::Selectable(rgb_types[i], itemSelected))
{
g->vehicle.rainbow_paint = i;
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (g->vehicle.rainbow_paint != 0)
{
ImGui::SameLine();
ImGui::SetNextItemWidth(150);
ImGui::SliderInt("RGB Speed", &g->rgb.speed, 1, 10);
}
}
ImGui::Separator();
static constexpr char const* boost_behaviors[] = { "Default", "Instant Refill", "Infinite" };
if (ImGui::BeginCombo("Boost Behavior", boost_behaviors[static_cast<int>(g->vehicle.boost_behavior)]))
{
for (int i = 0; i < 3; i++)
{
bool itemSelected = g->vehicle.boost_behavior == static_cast<eBoostBehaviors>(i);
if (ImGui::Selectable(boost_behaviors[i], itemSelected))
{
g->vehicle.boost_behavior = static_cast<eBoostBehaviors>(i);
}
if (itemSelected)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Separator();
components::small_text("Vehicle Fly");
ImGui::BeginGroup();
ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled);
ImGui::Checkbox("Don't Stop", &g->vehicle.fly.dont_stop);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Disable Collision", &g->vehicle.fly.no_collision);
ImGui::Checkbox("Stop On Exit", &g->vehicle.fly.stop_on_exit);
ImGui::EndGroup();
float fly_speed_user_unit = vehicle::mps_to_speed(g->vehicle.fly.speed, g->vehicle.speed_unit);
if (ImGui::SliderFloat(
fmt::format("Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
&fly_speed_user_unit,
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
"%.1f"
)) {
g->vehicle.fly.speed = vehicle::speed_to_mps(fly_speed_user_unit, g->vehicle.speed_unit);
}
}
}

View File

@ -26,20 +26,20 @@ namespace big
static void heading(); static void heading();
static void mobile(); static void mobile();
static void navigation(); static void navigation();
//static void player_navigation();
static void notifications(); static void notifications();
static void root(); static void root();
static void self(); static void self();
static void session(); static void session();
static void settings(); static void settings();
static void spawn();
static void pv();
static void vehicle_fun();
static void persist_car();
static void spoofing();
static void teleport();
static void vehicle(); static void vehicle();
static void lsc(); static void lsc();
static void spawn_vehicle();
static void pv();
static void persist_car();
static void fun_vehicle();
static void spawn_ped();
static void spoofing();
static void teleport();
static void view_player(); static void view_player();
static void players(); static void players();
static void weapons(); static void weapons();

View File

@ -0,0 +1,608 @@
#include "fiber_pool.hpp"
#include "script.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "views/view.hpp"
#include "util/ped.hpp"
#include "services/gta_data/gta_data_service.hpp"
#include "services/model_preview/model_preview_service.hpp"
#include "services/players/player_service.hpp"
#include <imgui_internal.h>
#define SPAWN_PED_ALL_WEAPONS -1
#define SPAWN_PED_NO_WEAPONS -2
namespace big
{
Ped spawn_ped_at_location(
const int selected_ped_type,
const char* ped_model_buf,
const Player selected_ped_player_id,
const Player selected_ped_for_player_id,
const bool is_bodyguard
) {
Hash hash = 0;
Ped clone = 0;
Vector3 location;
Player player;
Ped player_ped;
if (selected_ped_type == -2)
{
if (selected_ped_player_id == -1)
{
clone = self::ped;
hash = ENTITY::GET_ENTITY_MODEL(clone);
}
else
{
auto plyr = g_player_service->get_by_id(selected_ped_player_id);
if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation)
{
g_notification_service->push_error("Ped", "Invalid Online Player.");
return 0;
}
clone = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
hash = ENTITY::GET_ENTITY_MODEL(clone);
}
}
else
{
hash = rage::joaat(ped_model_buf);
}
if (selected_ped_for_player_id == -1)
{
location = self::pos;
player = self::id;
player_ped = self::ped;
}
else
{
auto plyr = g_player_service->get_by_id(selected_ped_for_player_id);
if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation)
{
g_notification_service->push_error("Ped", "Invalid Online Player.");
return 0;
}
auto player_pos = plyr->get_ped()->m_navigation->m_position;
location.x = player_pos.x;
location.y = player_pos.y;
location.z = player_pos.z;
player = plyr->id();
player_ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
}
location.x += 1.f;
location.y += 1.f;
Ped ped = ped::spawn(ePedType::PED_TYPE_ARMY, hash, clone, location, 0);
if (ped == 0)
{
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? ");
return 0;
}
if (is_bodyguard)
{
int player_group = PLAYER::GET_PLAYER_GROUP(player);
PED::SET_PED_AS_GROUP_MEMBER(ped, player_group);
PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, PED::GET_PED_RELATIONSHIP_GROUP_HASH(player_ped));
PED::SET_PED_AS_GROUP_LEADER(player_ped, player_group);
PED::SET_PED_CAN_BE_TARGETTED_BY_PLAYER(ped, player, true);
PED::SET_PED_ARMOUR(ped, 100);
ENTITY::SET_ENTITY_MAX_HEALTH(ped, 1000);
ENTITY::SET_ENTITY_HEALTH(ped, 1000, 0);
PED::SET_PED_COMBAT_ABILITY(ped, 100);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 46, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 63, 0);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(ped, 100.f, 0);
PED::SET_PED_KEEP_TASK(ped, true);
}
return ped;
}
void spawn_ped_give_weapon(
const Ped ped,
const int selected_ped_weapon_type,
const Hash selected_ped_weapon_hash
) {
if (selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)
{
return;
}
auto weapon_type_arr = g_gta_data_service->get_weapon_type_arr();
for (auto& weapon : g_gta_data_service->get_weapon_arr())
{
if (
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
weapon.weapon_type == weapon_type_arr[selected_ped_weapon_type]
) {
if (
selected_ped_weapon_hash == 0 ||
weapon.hash == selected_ped_weapon_hash
) {
WEAPON::GIVE_WEAPON_TO_PED(ped, weapon.hash, 9999, false, selected_ped_weapon_hash != 0);
}
}
}
}
void view::spawn_ped()
{
static int selected_ped_type = -2;
static bool ped_model_dropdown_open = false;
static char ped_model_buf[64];
static Player selected_ped_player_id = -1;
auto ped_type_arr = g_gta_data_service->get_ped_type_arr();
auto ped_arr = g_gta_data_service->get_ped_arr();
static int selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
static Hash selected_ped_weapon_hash = 0;
auto weapon_type_arr = g_gta_data_service->get_weapon_type_arr();
auto weapon_arr = g_gta_data_service->get_weapon_arr();
static Player selected_ped_for_player_id = -1;
auto player_arr = g_player_service->players();
if (!*g_pointers->m_is_session_started)
{
selected_ped_player_id = -1;
selected_ped_for_player_id = -1;
}
else
{
if (g_player_service->get_by_id(selected_ped_player_id) == nullptr)
{
selected_ped_player_id = -1;
}
if (g_player_service->get_by_id(selected_ped_for_player_id) == nullptr)
{
selected_ped_for_player_id = -1;
}
}
components::sub_title("Ped Model");
{
ImGui::BeginGroup();
{
ImGui::Text("Ped Type");
ImGui::SetNextItemWidth(160.f);
if (ImGui::BeginCombo(
"##ped_type",
selected_ped_type == -1 ? "ALL" :
selected_ped_type == -2 ? "ONLINE PLAYER" :
ped_type_arr[selected_ped_type].c_str()
)) {
if (ImGui::Selectable("ONLINE PLAYER", selected_ped_type == -2))
{
selected_ped_type = -2;
}
if (ImGui::Selectable("ALL", selected_ped_type == -1))
{
selected_ped_type = -1;
}
for (int i = 0; i < ped_type_arr.size(); i++)
{
if (ImGui::Selectable(ped_type_arr[i].c_str(), selected_ped_type == i))
{
selected_ped_type = i;
ped_model_buf[0] = 0;
}
if (selected_ped_type == i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
}
ImGui::EndGroup();
ImGui::SameLine();
if (selected_ped_type == -2)
{
ImGui::BeginGroup();
{
ImGui::Text("Player");
ImGui::SetNextItemWidth(240.f);
if (ImGui::BeginCombo(
"##ped_player",
selected_ped_player_id == -1 ?
"Self" :
g_player_service->get_by_id(selected_ped_player_id)->get_name()
)) {
if (ImGui::Selectable("Self", selected_ped_player_id == -1))
{
selected_ped_player_id = -1;
g_model_preview_service->stop_preview();
}
else if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && !ImGui::IsAnyItemHovered()))
{
g_model_preview_service->stop_preview();
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([] {
Ped ped = self::ped;
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
});
}
if (selected_ped_player_id == -1)
{
ImGui::SetItemDefaultFocus();
}
if (*g_pointers->m_is_session_started)
{
for (auto& item : player_arr)
{
auto plyr = item.second;
auto plyr_id = plyr->id();
ImGui::PushID(plyr_id);
if (ImGui::Selectable(plyr->get_name(), selected_ped_player_id == plyr_id))
{
selected_ped_player_id = plyr_id;
g_model_preview_service->stop_preview();
}
else if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && !ImGui::IsAnyItemHovered()))
{
g_model_preview_service->stop_preview();
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([plyr_id] {
auto plyr = g_player_service->get_by_id(plyr_id);
if (plyr)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
}
});
}
ImGui::PopID();
if (selected_ped_player_id == plyr_id)
{
ImGui::SetItemDefaultFocus();
}
}
}
ImGui::EndCombo();
}
}
ImGui::EndGroup();
}
else
{
ImGui::BeginGroup();
{
ImGui::Text("Model Name");
ImGui::SetNextItemWidth(240.f);
components::input_text_with_hint(
"##ped_model_name", "Model Name",
ped_model_buf, sizeof(ped_model_buf), ImGuiInputTextFlags_EnterReturnsTrue,
[] {
ped_model_dropdown_open = false;
}
);
}
ImGui::EndGroup();
// ped model dropdown
{
bool ped_model_dropdown_focused = ImGui::IsItemActive();
if (ImGui::IsItemActivated())
{
ped_model_dropdown_open = true;
}
if (ped_model_dropdown_open)
{
bool is_open = true;
bool item_hovered = false;
std::string lower_search = ped_model_buf;
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
ImGui::SetNextWindowPos({ ImGui::GetItemRectMin().x, ImGui::GetItemRectMax().y });
ImGui::SetNextWindowSize({ 300, 300 });
if (ImGui::Begin("##player_model_popup", &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_Tooltip))
{
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
ped_model_dropdown_focused |= ImGui::IsWindowFocused();
for (auto& item : ped_arr)
{
std::string ped_type = item.ped_type;
std::string name = item.name;
std::transform(name.begin(), name.end(), name.begin(), tolower);
if ((
selected_ped_type == -1 || ped_type_arr[selected_ped_type] == ped_type
) && (
name.find(lower_search) != std::string::npos
)) {
bool selectable_highlighted = lower_search == name;
bool selectable_clicked = ImGui::Selectable(item.name.c_str(), selectable_highlighted);
ped_model_dropdown_focused |= ImGui::IsItemFocused();
if (selectable_clicked)
{
strncpy(ped_model_buf, item.name.c_str(), 64);
ped_model_dropdown_open = false;
ped_model_dropdown_focused = false;
}
if (selectable_highlighted)
{
ImGui::SetItemDefaultFocus();
}
if (ImGui::IsItemHovered())
{
item_hovered = true;
g_model_preview_service->show_ped(item.hash);
}
}
}
ImGui::End();
}
ped_model_dropdown_open = ped_model_dropdown_focused;
if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && (!item_hovered || !ped_model_dropdown_open)))
{
g_model_preview_service->stop_preview();
}
}
}
}
}
ImGui::Separator();
components::sub_title("Weapon");
{
ImGui::BeginGroup();
{
ImGui::Text("Weapon Type");
ImGui::SetNextItemWidth(160.f);
if (ImGui::BeginCombo(
"##ped_weapon_type",
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ?
"ALL" :
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
"NO WEAPONS" :
weapon_type_arr[selected_ped_weapon_type].c_str()
)) {
if (ImGui::Selectable("ALL", selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS))
{
selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
}
if (selected_ped_weapon_hash == SPAWN_PED_ALL_WEAPONS)
{
ImGui::SetItemDefaultFocus();
}
if (ImGui::Selectable("NO WEAPONS", selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS))
{
selected_ped_weapon_type = SPAWN_PED_NO_WEAPONS;
}
if (selected_ped_weapon_hash == SPAWN_PED_NO_WEAPONS)
{
ImGui::SetItemDefaultFocus();
}
for (int i = 0; i < weapon_type_arr.size(); i++)
{
if (ImGui::Selectable(weapon_type_arr[i].c_str(), selected_ped_weapon_type == i))
{
selected_ped_weapon_type = i;
selected_ped_weapon_hash = 0;
}
if (selected_ped_weapon_type == i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
{
ImGui::Text("Weapon");
ImGui::SetNextItemWidth(240.f);
if (ImGui::BeginCombo(
"##ped_weapon",
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
"NO WEAPONS" :
selected_ped_weapon_hash == 0 ?
"ALL" :
g_gta_data_service->find_weapon_by_hash(selected_ped_weapon_hash).name.c_str()
)) {
if (selected_ped_weapon_type != SPAWN_PED_NO_WEAPONS)
{
if (ImGui::Selectable("ALL", selected_ped_weapon_hash == 0))
{
selected_ped_weapon_hash = 0;
}
if (selected_ped_weapon_hash == 0)
{
ImGui::SetItemDefaultFocus();
}
for (auto& weapon : weapon_arr)
{
if (
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
weapon.weapon_type == weapon_type_arr[selected_ped_weapon_type]
) {
if (ImGui::Selectable(weapon.name.c_str(), weapon.hash == selected_ped_weapon_hash))
{
selected_ped_weapon_hash = weapon.hash;
}
}
if (selected_ped_weapon_hash == weapon.hash)
{
ImGui::SetItemDefaultFocus();
}
}
}
ImGui::EndCombo();
}
}
ImGui::EndGroup();
}
ImGui::Separator();
components::sub_title("Spawn For");
{
if (ImGui::BeginCombo(
"##ped_for",
selected_ped_for_player_id == -1 ?
"Self" :
g_player_service->get_by_id(selected_ped_for_player_id)->get_name()
)) {
if (ImGui::Selectable("Self", selected_ped_for_player_id == -1))
{
selected_ped_for_player_id = -1;
}
if (selected_ped_for_player_id == -1)
{
ImGui::SetItemDefaultFocus();
}
if (*g_pointers->m_is_session_started)
{
for (auto& [_, plyr] : player_arr)
{
auto plyr_id = plyr->id();
ImGui::PushID(plyr_id);
if (ImGui::Selectable(plyr->get_name(), selected_ped_for_player_id == plyr_id))
{
selected_ped_for_player_id = plyr_id;
}
ImGui::PopID();
if (selected_ped_for_player_id == plyr_id)
{
ImGui::SetItemDefaultFocus();
}
}
}
ImGui::EndCombo();
}
}
ImGui::Separator();
if (ImGui::Checkbox("Preview", &g->spawn_ped.preview_ped))
{
if (!g->spawn_ped.preview_ped)
{
g_model_preview_service->stop_preview();
}
}
components::button("Change Player Model", [] {
if (selected_ped_type == -2)
{
if (selected_ped_player_id != -1)
{
auto plyr = g_player_service->get_by_id(selected_ped_player_id);
if (plyr)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
ped::steal_identity(ped);
}
}
}
else
{
if (!ped::change_player_model(rage::joaat(ped_model_buf)))
{
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? ");
return;
}
}
spawn_ped_give_weapon(self::ped, selected_ped_weapon_type, selected_ped_weapon_hash);
});
ImGui::SameLine();
components::button("Spawn Ped", [] {
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, false);
if (ped)
{
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
}
});
ImGui::SameLine();
components::button("Spawn Bodyguard", [] {
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, true);
if (ped)
{
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
}
});
}
}