From 7b552f71aaa3bc7fb13769c082ab803357b6e1ed Mon Sep 17 00:00:00 2001 From: DayibBaba <79384354+DayibBaba@users.noreply.github.com> Date: Sat, 24 Jun 2023 23:12:20 +0200 Subject: [PATCH] Some fixes and requests (#1516) * Removed Delete button and nearby.cpp * Added player check for kill button * Added delete vehicle button * Fixed give armor & added vehicle god esp --- .../commands/player/misc/give_armor.cpp | 2 +- src/services/gui/gui_service.hpp | 2 - src/views/esp/view_esp.cpp | 22 +-- src/views/vehicle/view_vehicle.cpp | 8 + src/views/view.hpp | 1 - src/views/world/view_nearby.cpp | 141 ------------------ src/views/world/view_world.cpp | 129 ++++++++++++++++ 7 files changed, 151 insertions(+), 154 deletions(-) delete mode 100644 src/views/world/view_nearby.cpp diff --git a/src/backend/commands/player/misc/give_armor.cpp b/src/backend/commands/player/misc/give_armor.cpp index bc93d0fb..a34e8d4b 100644 --- a/src/backend/commands/player/misc/give_armor.cpp +++ b/src/backend/commands/player/misc/give_armor.cpp @@ -17,7 +17,7 @@ namespace big virtual void execute(player_ptr player, const std::vector& _args, const std::shared_ptr ctx) { - g_pickup_service->give_player_health(player->id()); + g_pickup_service->give_armour(player->id()); } }; diff --git a/src/services/gui/gui_service.hpp b/src/services/gui/gui_service.hpp index fb9911b0..d6c07a47 100644 --- a/src/services/gui/gui_service.hpp +++ b/src/services/gui/gui_service.hpp @@ -33,7 +33,6 @@ namespace big TRAIN, BLACKHOLE, MODEL_SWAPPER, - NEARBY, NETWORK, MISSIONS, @@ -122,7 +121,6 @@ namespace big {tabs::TRAIN, {"GUI_TAB_TRAIN", view::train}}, {tabs::BLACKHOLE, {"GUI_TAB_BLACKHOLE", view::blackhole}}, {tabs::MODEL_SWAPPER, {"GUI_TAB_MODEL_SWAPPER", view::model_swapper}}, - {tabs::NEARBY, {"GUI_TAB_NEARBY", view::nearby}}, }, }, }, diff --git a/src/views/esp/view_esp.cpp b/src/views/esp/view_esp.cpp index 1a6fd0eb..97aa452f 100644 --- a/src/views/esp/view_esp.cpp +++ b/src/views/esp/view_esp.cpp @@ -82,11 +82,9 @@ namespace big } draw_list->AddText(name_pos, esp_color, name_str.c_str()); - + std::string mode_str = ""; if (g.esp.god) { - std::string mode_str = ""; - if (ped_damage_bits & (uint32_t)eEntityProofs::GOD) { mode_str = "ESP_GOD"_T.data(); @@ -102,13 +100,19 @@ namespace big mode_str += "ESP_EXPLOSION"_T.data(); } } + } - if (!mode_str.empty()) - { - draw_list->AddText({esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 40.f}, - ImColor(1.f, 0.f, 0.f, 1.f), - mode_str.c_str()); - } + if (auto player_vehicle = plyr->get_current_vehicle()) + { + if (player_vehicle->m_damage_bits & (uint32_t)eEntityProofs::GOD) + mode_str = +"VEH_GOD"; + } + + if (!mode_str.empty()) + { + draw_list->AddText({esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 40.f}, + ImColor(1.f, 0.f, 0.f, 1.f), + mode_str.c_str()); } if (!(ped_damage_bits & (uint32_t)eEntityProofs::GOD)) diff --git a/src/views/vehicle/view_vehicle.cpp b/src/views/vehicle/view_vehicle.cpp index 414e7be4..f392d8a8 100644 --- a/src/views/vehicle/view_vehicle.cpp +++ b/src/views/vehicle/view_vehicle.cpp @@ -15,6 +15,14 @@ namespace big std::make_format_args(amount_fixed, amount_fixed == 1 ? "VEHICLE_FIX_HAS"_T.data() : "VEHICLE_FIX_HAVE"_T.data()))); }); + + ImGui::SameLine(); + components::button("Delete Current",[]{ + auto handle = self::veh; + if(ENTITY::DOES_ENTITY_EXIST(handle)) + TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped), entity::delete_entity(handle); + }); + ImGui::SameLine(); components::button("REPAIR"_T, [] { vehicle::repair(self::veh); diff --git a/src/views/view.hpp b/src/views/view.hpp index 1c233887..cc5f7065 100644 --- a/src/views/view.hpp +++ b/src/views/view.hpp @@ -68,7 +68,6 @@ namespace big static void train(); static void blackhole(); static void model_swapper(); - static void nearby(); static void world(); static void gta_cache(); static void lua_scripts(); diff --git a/src/views/world/view_nearby.cpp b/src/views/world/view_nearby.cpp deleted file mode 100644 index 1f2af2a7..00000000 --- a/src/views/world/view_nearby.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "util/entity.hpp" -#include "util/local_player.hpp" -#include "util/notify.hpp" -#include "util/ped.hpp" -#include "util/vehicle.hpp" -#include "views/view.hpp" - -namespace big -{ - void view::nearby() - { - components::sub_title("Peds"); - // Nearby Ped Actions - components::button("Delete", [] { - for (auto peds : entity::get_entities(false, true)) - { - entity::delete_entity(peds); - } - }); - ImGui::SameLine(); - - components::button("Kill", [] { - for (auto peds : entity::get_entities(false, true)) - { - ped::kill_ped(peds); - } - }); - ImGui::SameLine(); - - components::button("Kill Enemies", [] { - for (auto peds : entity::get_entities(false, true)) - { - ped::kill_ped_by_relation(peds, 4 || 5); - } - }); - - // Nearby Ped Loops / Toggles - components::command_checkbox<"pedsignore">(); - ImGui::SameLine(140.f); - components::command_checkbox<"pedrain">(); - ImGui::SameLine(265.f); - components::command_checkbox<"riotmode">(); - components::command_checkbox<"highalert">(); - ImGui::SameLine(140.f); - components::command_checkbox<"pedrush">(); - components::command_checkbox<"autodisarm">(); - components::options_modal("Auto Disarm", [] { - ImGui::Checkbox("Neutralize", &g.world.nearby.auto_disarm.neutralize); - }); - - ImGui::Separator(); - components::sub_title("Vehicles"); - - components::button("Max Upgrade", [] { - for (auto vehs : entity::get_entities(true, false)) - { - if (entity::take_control_of(vehs)) - { - vehicle::max_vehicle(vehs); - script::get_current()->yield(); - } - } - }); - ImGui::SameLine(); - - components::button("Downgrade", [] { - for (auto vehs : entity::get_entities(true, false)) - { - if (entity::take_control_of(vehs)) - { - vehicle::downgrade(vehs); - script::get_current()->yield(); - } - } - }); - - components::command_checkbox<"vehiclerain">(); - - ImGui::Separator(); - components::sub_title("All"); - - static bool included_entity_types[3]; - static bool own_vehicle, deleting; - static int quantity, remaining; - - ImGui::Text("Include:"); - ImGui::Checkbox("Vehicles", &included_entity_types[0]); - ImGui::SameLine(); - ImGui::Checkbox("Peds", &included_entity_types[1]); - ImGui::SameLine(); - ImGui::Checkbox("Props", &included_entity_types[2]); - - if (included_entity_types[0]) - ImGui::Checkbox("Self vehicle", &own_vehicle); - - if (deleting) - { - float progress = 1 - static_cast(remaining) / quantity; - ImGui::ProgressBar(progress, ImVec2(200, 25)); - } - else - { - components::button("Delete all", [&] { - auto list = entity::get_entities(included_entity_types[0], included_entity_types[1], included_entity_types[2], own_vehicle); - - quantity = list.size(); - remaining = quantity; - g_notification_service->push("Entity deletion", std::format("Deleting {} entities", quantity)); - deleting = true; - int failed = 0; - for (auto ent : list) - { - if (ent == self::ped) - continue; - - if (ENTITY::DOES_ENTITY_EXIST(ent)) - { - if (ENTITY::IS_ENTITY_A_VEHICLE(ent)) - if (ent == self::veh && own_vehicle) - TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped); - - if (entity::take_control_of(ent, 25)) - entity::delete_entity(ent); - } - - script::get_current()->yield(5ms); - - if (ENTITY::DOES_ENTITY_EXIST(ent)) - failed++; - else - remaining--; - } - - if (failed > 0) - g_notification_service->push_warning("Entity deletion", std::format("Failed deleting {} entities", failed)); - - deleting = false; - }); - } - } -} diff --git a/src/views/world/view_world.cpp b/src/views/world/view_world.cpp index 122546bb..97547e1c 100644 --- a/src/views/world/view_world.cpp +++ b/src/views/world/view_world.cpp @@ -1,4 +1,8 @@ #include "views/view.hpp" +#include "util/entity.hpp" +#include "util/ped.hpp" +#include "util/notify.hpp" +#include "util/vehicle.hpp" namespace big { @@ -15,5 +19,130 @@ namespace big { components::command_checkbox<"partwater">(); } + + ImGui::Separator(); + components::sub_title("Peds"); + // Nearby Ped Actions + + components::button("Kill", [] { + for (auto peds : entity::get_entities(false, true)) + { + if(!PED::IS_PED_A_PLAYER(peds)) + ped::kill_ped(peds); + } + }); + ImGui::SameLine(); + + components::button("Kill Enemies", [] { + for (auto peds : entity::get_entities(false, true)) + { + ped::kill_ped_by_relation(peds, 4 || 5); + } + }); + + // Nearby Ped Loops / Toggles + components::command_checkbox<"pedsignore">(); + ImGui::SameLine(140.f); + components::command_checkbox<"pedrain">(); + ImGui::SameLine(265.f); + components::command_checkbox<"riotmode">(); + components::command_checkbox<"highalert">(); + ImGui::SameLine(140.f); + components::command_checkbox<"pedrush">(); + ImGui::SameLine(); + components::command_checkbox<"autodisarm">(); + components::options_modal("Auto Disarm", [] { + ImGui::Checkbox("Neutralize", &g.world.nearby.auto_disarm.neutralize); + }); + + ImGui::Separator(); + components::sub_title("Vehicles"); + + components::button("Max Upgrade", [] { + for (auto vehs : entity::get_entities(true, false)) + { + if (entity::take_control_of(vehs)) + { + vehicle::max_vehicle(vehs); + script::get_current()->yield(); + } + } + }); + ImGui::SameLine(); + + components::button("Downgrade", [] { + for (auto vehs : entity::get_entities(true, false)) + { + if (entity::take_control_of(vehs)) + { + vehicle::downgrade(vehs); + script::get_current()->yield(); + } + } + }); + + components::command_checkbox<"vehiclerain">(); + + ImGui::Separator(); + components::sub_title("Entities"); + + static bool included_entity_types[3]; + static bool own_vehicle, deleting; + static int quantity, remaining; + + ImGui::Text("Include:"); + ImGui::Checkbox("Vehicles", &included_entity_types[0]); + ImGui::SameLine(); + ImGui::Checkbox("Peds", &included_entity_types[1]); + ImGui::SameLine(); + ImGui::Checkbox("Props", &included_entity_types[2]); + + if (included_entity_types[0]) + ImGui::Checkbox("Self vehicle", &own_vehicle); + + if (deleting) + { + float progress = 1 - static_cast(remaining) / quantity; + ImGui::ProgressBar(progress, ImVec2(200, 25)); + } + else + { + components::button("Delete all", [&] { + auto list = entity::get_entities(included_entity_types[0], included_entity_types[1], included_entity_types[2], own_vehicle); + + quantity = list.size(); + remaining = quantity; + g_notification_service->push("Entity deletion", std::format("Deleting {} entities", quantity)); + deleting = true; + int failed = 0; + for (auto ent : list) + { + if (ent == self::ped) + continue; + + if (ENTITY::DOES_ENTITY_EXIST(ent)) + { + if (ENTITY::IS_ENTITY_A_VEHICLE(ent)) + if (ent == self::veh && own_vehicle) + TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped); + + if (entity::take_control_of(ent, 25)) + entity::delete_entity(ent); + } + + script::get_current()->yield(5ms); + + if (ENTITY::DOES_ENTITY_EXIST(ent)) + failed++; + else + remaining--; + } + + if (failed > 0) + g_notification_service->push_warning("Entity deletion", std::format("Failed deleting {} entities", failed)); + + deleting = false; + }); + } } } \ No newline at end of file