Feature Additions, GUI Tweaks, Fixes (#975)

* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
This commit is contained in:
Seanghost117
2023-02-25 13:33:16 -07:00
committed by GitHub
parent 9056f5aba1
commit 7084ce510b
22 changed files with 571 additions and 78 deletions

View File

@ -3,6 +3,7 @@
#include "pointers.hpp"
#include "util/vehicle.hpp"
#include "util/mobile.hpp"
#include "util/entity.hpp"
#include "gta_util.hpp"
namespace big
@ -12,58 +13,10 @@ namespace big
{
using looped_command::looped_command;
std::vector<Entity> target_entities;
void get_entities()
{
const auto replay_interface = *g_pointers->m_replay_interface;
if(!replay_interface)
return;
if (g.world.blackhole.include_vehicles)
{
const auto vehicle_interface = replay_interface->m_vehicle_interface;
for (int i = 0; i < vehicle_interface->m_max_vehicles; i++)
{
const auto vehicle_ptr = vehicle_interface->get_vehicle(i);
if (!vehicle_ptr)
continue;
const auto veh = g_pointers->m_ptr_to_handle(vehicle_ptr);
if (!veh)
break;
target_entities.push_back(veh);
}
}
if (g.world.blackhole.include_peds)
{
const auto ped_interface = replay_interface->m_ped_interface;
for (int i = 0; i < ped_interface->m_max_peds; i++)
{
const auto ped_ptr = ped_interface->get_ped(i);
if (!ped_ptr)
continue;
//make sure to don't include ourselves
if (ped_ptr == gta_util::get_local_ped())
continue;
const auto ped = g_pointers->m_ptr_to_handle(ped_ptr);
if (!ped)
break;
target_entities.push_back(ped);
}
}
}
virtual void on_tick() override
{
get_entities();
for (auto entity : target_entities)
for (auto entity : entity::get_entities(g.world.blackhole.include_vehicles, g.world.blackhole.include_peds))
{
if (entity::take_control_of(entity, 0))
{
@ -75,7 +28,7 @@ namespace big
//draw blackhole
GRAPHICS::DRAW_MARKER(28,
g.world.blackhole.pos.x, g.world.blackhole.pos.y, g.world.blackhole.pos.z,
0.f, 0.f, 0.f, 0, 0, 0, 15.f, 15.f, 15.f,
0.f, 0.f, 0.f, 0, 0, 0, g.world.blackhole.scale, g.world.blackhole.scale, g.world.blackhole.scale,
g.world.blackhole.color[0] * 255,
g.world.blackhole.color[1] * 255,
g.world.blackhole.color[2] * 255,
@ -83,15 +36,17 @@ namespace big
0, 0, 0, 0, 0, 0, 0);
//cleanup
target_entities.clear();
entity::get_entities(g.world.blackhole.include_vehicles, g.world.blackhole.include_peds).clear();
}
//make sure that we always cleanup our memory
virtual void on_disable() override
{
target_entities.clear();
entity::get_entities(g.world.blackhole.include_vehicles, g.world.blackhole.include_peds).clear();
}
};
blackhole g_blackhole("blackhole", "Blackhole", "Spawns a black hole that picks up all the peds and vehicles in your area.", g.world.blackhole.enable);
bool_command g_blackhole_peds("blackholeincpeds", "Peds", "Includes all nearby peds in the blackholes path of destruction", g.world.blackhole.include_peds);
bool_command g_blackhole_vehicles("blackholeincvehs", "Vehicles", "Includes all nearby vehicles in the blackholes path of destruction", g.world.blackhole.include_vehicles);
}

View File

@ -0,0 +1,28 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big
{
class high_alert : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
for (auto ped : entity::get_entities(false, true))
{
PED::SET_PED_HIGHLY_PERCEPTIVE(ped, true);
PED::SET_PED_HEARING_RANGE(ped, 1000.0);
PED::SET_PED_SEEING_RANGE(ped, 1000.0);
PED::SET_PED_VISUAL_FIELD_MIN_ANGLE(ped, 1000.0);
}
}
};
high_alert g_high_alert("highalert", "High Alert", "Not the CoD perk.", g.world.nearby.high_alert);
}

View File

@ -0,0 +1,40 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big
{
class ignore : looped_command
{
using looped_command::looped_command;
virtual void on_enable() override //should help for any stragglers that aren't set by the tick (aka current event)
{
PLAYER::SET_EVERYONE_IGNORE_PLAYER(self::id, true);
PLAYER::SET_POLICE_IGNORE_PLAYER(self::id, true);
}
virtual void on_tick() override
{
for (auto ped : entity::get_entities(false, true))
{
if (!PED::GET_PED_CONFIG_FLAG(ped, 17, true)) { // Flag 17 = PED_FLAG_BLOCK_NON_TEMPORARY_EVENTS
PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true);
TASK::TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true);
}
}
}
virtual void on_disable() override
{
PLAYER::SET_EVERYONE_IGNORE_PLAYER(self::id, false);
PLAYER::SET_POLICE_IGNORE_PLAYER(self::id, false);
}
};
ignore g_ignore("pedsignore", "Ignore", "Nearby peds will ignore you and become oblivious to your actions.", g.world.nearby.ignore);
}

View File

@ -0,0 +1,32 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big
{
class ped_rush : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
for (auto ped : entity::get_entities(false, true))
{
PED::SET_PED_MOVE_RATE_OVERRIDE(ped, 10.0f);
}
}
virtual void on_disable() override //Set the peds back to their normal speed
{
for (auto ped : entity::get_entities(false, true))
{
PED::SET_PED_MOVE_RATE_OVERRIDE(ped, 1.0f);
}
}
};
ped_rush g_ped_rush("pedrush", "Ped Rush", "Makes the nearby peds move with a purpose.", g.world.nearby.ped_rush);
}

View File

@ -0,0 +1,32 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big
{
class ped_rain : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
for (auto ped : entity::get_entities(false, true))
{
if (!ENTITY::IS_ENTITY_IN_AIR(ped)) {
Vector3 my_location = ENTITY::GET_ENTITY_COORDS(self::ped, 1);
my_location.x = my_location.x + (rand() % 100 + (-50));
my_location.y = my_location.y + (rand() % 100 + (-50));
my_location.z = my_location.z + (rand() % 50 + 50);
ENTITY::SET_ENTITY_COORDS(ped, my_location.x, my_location.y, my_location.z, 0, 0, 0, 0);
ENTITY::SET_ENTITY_VELOCITY(ped, 0.0, 0.0, -1.0);
}
}
}
};
ped_rain g_ped_rain("pedrain", "Rain Peds", "Will pour down and rain nearby peds.", g.world.nearby.ped_rain);
}

View File

@ -0,0 +1,35 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big
{
class vehicle_rain : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
for (auto vehicles : entity::get_entities(true, false))
{
if (!ENTITY::IS_ENTITY_IN_AIR(vehicles))
{
if (entity::take_control_of(vehicles))
{
Vector3 my_location = ENTITY::GET_ENTITY_COORDS(self::ped, 1);
my_location.x = my_location.x + (rand() % 100 + (-50));
my_location.y = my_location.y + (rand() % 100 + (-50));
my_location.z = my_location.z + (rand() % 20 + 100);
ENTITY::SET_ENTITY_COORDS(vehicles, my_location.x, my_location.y, my_location.z, 0, 0, 0, 0);
ENTITY::SET_ENTITY_VELOCITY(vehicles, 0.0, 0.0, -1.0);
}
}
}
}
};
vehicle_rain g_vehicle_rain("vehiclerain", "Rain Vehicles", "Drops surround vehicles, vehicles can hit and kill you!", g.world.nearby.veh_rain);
}