Tp, Paintgun, refractor rainbow controller, refractor raycast (#1708)

This commit is contained in:
TheGreenBandit 2023-07-14 17:31:03 -04:00 committed by GitHub
parent 61bb60d1f4
commit a57027b198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 320 additions and 95 deletions

View File

@ -35,6 +35,7 @@ namespace big
looped::system_desync_kick_protection();
looped::system_spoofing();
looped::system_mission_creator();
looped::system_rainbow();
for (auto command : g_looped_commands)
if (command->is_enabled())
@ -64,6 +65,8 @@ namespace big
while (g_running)
{
looped::weapons_tp_gun();
looped::weapons_paint_gun();
looped::weapons_ammo_special_type();
looped::weapons_cage_gun();
looped::weapons_delete_gun();

View File

@ -39,12 +39,14 @@ namespace big
static void system_desync_kick_protection();
static void system_spoofing();
static void system_mission_creator();
static void system_rainbow();
static void vehicle_auto_drive();
static void vehicle_boost_behavior();
static void vehicle_ls_customs();
static void vehicle_rainbow_paint();
static void weapons_tp_gun();
static void weapons_ammo_special_type();
static void weapons_cage_gun();
static void custom_gun_disable_control_action();
@ -56,6 +58,7 @@ namespace big
static void weapons_c4_limit();
static void weapons_do_persist_weapons();
static void weapons_do_weapon_hotkeys();
static void weapons_paint_gun();
static void drive_train();
static void derail_train();

View File

@ -0,0 +1,101 @@
#include "backend/looped/looped.hpp"
#include "core/data/color.hpp"
namespace big
{
void looped::system_rainbow()
{
static std::chrono::system_clock::time_point last_rgb_run_time;
static std::chrono::milliseconds delay = 0s;
enum rgb_controller_t
{
rgb_controller_green_up,
rgb_controller_red_down,
rgb_controller_blue_up,
rgb_controller_green_down,
rgb_controller_red_up,
rgb_controller_blue_down,
};
if (last_rgb_run_time + delay < std::chrono::system_clock::now())
{
int delay_step = 100;
if (g.settings.rainbow.spasm)
{
rgb.red = rand() % 256;
rgb.green = rand() % 256;
rgb.blue = rand() % 256;
}
else if (g.settings.rainbow.fade)
{
int delay_step = 10;
static int rgb_controller_v = rgb_controller_green_up;
switch (rgb_controller_v)
{
case rgb_controller_green_up:
rgb.green += 5;
if (rgb.green >= 255)
{
rgb.green = 255;
rgb_controller_v = rgb_controller_red_down;
}
break;
case rgb_controller_red_down:
rgb.red -= 5;
if (rgb.red < 0)
{
rgb.red = 0;
rgb_controller_v = rgb_controller_blue_up;
}
break;
case rgb_controller_blue_up:
rgb.blue += 5;
if (rgb.blue >= 255)
{
rgb.blue = 255;
rgb_controller_v = rgb_controller_green_down;
}
break;
case rgb_controller_green_down:
rgb.green -= 5;
if (rgb.green < 0)
{
rgb.green = 0;
rgb_controller_v = rgb_controller_red_up;
}
break;
case rgb_controller_red_up:
rgb.red += 5;
if (rgb.red >= 255)
{
rgb.red = 255;
rgb_controller_v = rgb_controller_blue_down;
}
break;
case rgb_controller_blue_down:
rgb.blue -= 5;
if (rgb.blue < 0)
{
rgb.blue = 0;
rgb_controller_v = rgb_controller_green_up;
}
break;
default: break;
}
}
delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g.settings.rainbow.speed * delay_step));
last_rgb_run_time = std::chrono::system_clock::now();
}
}
}

View File

@ -3,25 +3,14 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "core/data/color.hpp"
namespace big
{
enum rgb_controller_t
{
rgb_controller_green_up,
rgb_controller_red_down,
rgb_controller_blue_up,
rgb_controller_green_down,
rgb_controller_red_up,
rgb_controller_blue_down,
};
std::chrono::system_clock::time_point last_rgb_run_time;
std::chrono::milliseconds delay = 0s;
void looped::vehicle_rainbow_paint()
{
static int rgb_controller_v = rgb_controller_green_up;
static std::chrono::system_clock::time_point last_rgb_run_time;
static std::chrono::milliseconds delay = 0s;
static int red = 255;
static int green = 0;
@ -39,90 +28,30 @@ namespace big
}
else if (g.vehicle.rainbow_paint.type == RainbowPaintType::Fade)
{
delay_step = 10;
switch (rgb_controller_v)
{
case rgb_controller_green_up:
green += 5;
if (green >= 255)
{
green = 255;
rgb_controller_v = rgb_controller_red_down;
}
break;
case rgb_controller_red_down:
red -= 5;
if (red < 0)
{
red = 0;
rgb_controller_v = rgb_controller_blue_up;
}
break;
case rgb_controller_blue_up:
blue += 5;
if (blue >= 255)
{
blue = 255;
rgb_controller_v = rgb_controller_green_down;
}
break;
case rgb_controller_green_down:
green -= 5;
if (green < 0)
{
green = 0;
rgb_controller_v = rgb_controller_red_up;
}
break;
case rgb_controller_red_up:
red += 5;
if (red >= 255)
{
red = 255;
rgb_controller_v = rgb_controller_blue_down;
}
break;
case rgb_controller_blue_down:
blue -= 5;
if (blue < 0)
{
blue = 0;
rgb_controller_v = rgb_controller_green_up;
}
break;
default: break;
}
red = rgb.red;
blue = rgb.blue;
green = rgb.green;
}
Vehicle vehicle = self::veh;
if (g.vehicle.rainbow_paint.primary)
{
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, red, green, blue);
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(self::veh, red, green, blue);
}
if (g.vehicle.rainbow_paint.secondary)
{
VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(vehicle, red, green, blue);
VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(self::veh, red, green, blue);
}
if (g.vehicle.rainbow_paint.neon)
{
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 0, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 1, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 2, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 3, 1);
VEHICLE::SET_VEHICLE_NEON_COLOUR(vehicle, red, green, blue);
VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 0, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 1, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 2, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(self::veh, 3, 1);
VEHICLE::SET_VEHICLE_NEON_COLOUR(self::veh, red, green, blue);
}
if (g.vehicle.rainbow_paint.smoke)
{
VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(vehicle, red, green, blue);
VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(self::veh, red, green, blue);
}
delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g.vehicle.rainbow_paint.speed * delay_step));

View File

@ -28,5 +28,4 @@ namespace big
}
}
}
}

View File

@ -0,0 +1,50 @@
#include "backend/looped/looped.hpp"
#include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp"
#include "core/data/color.hpp"
namespace big
{
void looped::weapons_paint_gun()
{
if (g.weapons.paintgun.rainbow)
{
g.weapons.paintgun.col[0] = rgb.red;
g.weapons.paintgun.col[1] = rgb.green;
g.weapons.paintgun.col[2] = rgb.blue;
}
if (g.weapons.custom_weapon == CustomWeapon::PAINT_GUN && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
{
Vector3 c; entity::raycast(&c);
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{
GRAPHICS::ADD_DECAL((int)DecalTypes::splatters_paint,
c.x,
c.y,
c.z,
0, //true
0, //true
-1, //true
0,
1.f,
0.f, // always 0
0.5f, //size x
0.4f, //size y
g.weapons.paintgun.col[0],
g.weapons.paintgun.col[1],
g.weapons.paintgun.col[2],
g.weapons.paintgun.col[3],
-1,
true,
false,
false);
}
}
}
}
}

View File

@ -0,0 +1,23 @@
#include "backend/looped/looped.hpp"
#include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp"
namespace big
{
void looped::weapons_tp_gun()
{
if (g.weapons.custom_weapon == CustomWeapon::TP_GUN && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
{
Vector3 c; entity::raycast(&c);
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{
ENTITY::SET_ENTITY_COORDS(self::ped, c.x, c.y, c.z, 0, 0, 0, 0);
}
}
}
}
}

10
src/core/data/color.hpp Normal file
View File

@ -0,0 +1,10 @@
namespace big
{
inline class rgb
{
public:
float red = 255.f;
float green = 0;
float blue = 0;
} rgb{};
}

View File

@ -15,4 +15,6 @@ const custom_weapon custom_weapons[] = {
{big::CustomWeapon::STEAL_VEHICLE_GUN, "Steal Vehicle Gun"},
{big::CustomWeapon::REPAIR_GUN, "Repair Gun"},
{big::CustomWeapon::VEHICLE_GUN, "Vehicle Gun"},
{big::CustomWeapon::TP_GUN, "Tp Gun"},
{big::CustomWeapon::PAINT_GUN, "Paint Gun"},
};

View File

@ -19,7 +19,9 @@ namespace big
GRAVITY_GUN,
STEAL_VEHICLE_GUN,
REPAIR_GUN,
VEHICLE_GUN
VEHICLE_GUN,
TP_GUN,
PAINT_GUN
};
NLOHMANN_JSON_SERIALIZE_ENUM(CustomWeapon,
{
@ -30,6 +32,8 @@ namespace big
{CustomWeapon::STEAL_VEHICLE_GUN, "steal"},
{CustomWeapon::REPAIR_GUN, "repair"},
{CustomWeapon::VEHICLE_GUN, "vehicle"},
{CustomWeapon::TP_GUN, "tp"},
{CustomWeapon::PAINT_GUN, "paint"},
})
enum class ContextEntityType : uint8_t

View File

@ -408,6 +408,15 @@ namespace big
struct settings
{
bool dev_dlc = false;
struct rainbow
{
bool fade = false;
bool spasm = false;
int speed = 1;
} rainbow{};
struct hotkeys
{
bool editing_menu_toggle = false;
@ -439,8 +448,6 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(hotkeys, editing_menu_toggle, menu_toggle, teleport_waypoint, teleport_objective, teleport_pv, noclip, vehicle_flymode, bringvehicle, invis, heal, fill_inventory, skip_cutscene, freecam, superrun, superjump, beastjump, invisveh, localinvisveh, fill_ammo, fast_quit, cmd_excecutor, repairpv, open_vehicle_controller, clear_wanted, random_ped_components)
} hotkeys{};
bool dev_dlc = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(settings, hotkeys, dev_dlc)
} settings{};
@ -704,7 +711,14 @@ namespace big
{
bool launch_on_release = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(gravity_gun, launch_on_release)
} gravity_gun;
} gravity_gun{};
struct paintgun
{
bool rainbow = false;
float col[4] = {0.f, 0.f, 1.f, 1.f};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(paintgun, rainbow, col)
} paintgun{};
struct aimbot
{
@ -739,7 +753,7 @@ namespace big
bool enable_weapon_hotkeys = false;
std::map<int, std::vector<std::uint32_t>> weapon_hotkeys{};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons, ammo_special, custom_weapon, aimbot, infinite_ammo, always_full_ammo, infinite_mag, increased_damage, increase_damage, no_recoil, no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, paintgun, interior_weapon, triggerbot, infinite_range, enable_weapon_hotkeys, weapon_hotkeys)
} weapons{};
struct window

View File

@ -1474,6 +1474,62 @@ enum class eVehicleLockState
VEHICLELOCK_CANNOT_ENTER
};
enum class DecalTypes
{
splatters_blood = 1010,
splatters_blood_dir = 1015,
splatters_blood_mist = 1017,
splatters_mud = 1020,
splatters_paint = 1030,
splatters_water = 1040,
splatters_water_hydrant = 1050,
splatters_blood2 = 1110,
weapImpact_metal = 4010,
weapImpact_concrete = 4020,
weapImpact_mattress = 4030,
weapImpact_mud = 4032,
weapImpact_wood = 4050,
weapImpact_sand = 4053,
weapImpact_cardboard = 4040,
weapImpact_melee_glass = 4100,
weapImpact_glass_blood = 4102,
weapImpact_glass_blood2 = 4104,
weapImpact_shotgun_paper = 4200,
weapImpact_shotgun_mattress,
weapImpact_shotgun_metal,
weapImpact_shotgun_wood,
weapImpact_shotgun_dirt,
weapImpact_shotgun_tvscreen,
weapImpact_shotgun_tvscreen2,
weapImpact_shotgun_tvscreen3,
weapImpact_melee_concrete = 4310,
weapImpact_melee_wood = 4312,
weapImpact_melee_metal = 4314,
burn1 = 4421,
burn2,
burn3,
burn4,
burn5,
bang_concrete_bang = 5000,
bang_concrete_bang2,
bang_bullet_bang,
bang_bullet_bang2 = 5004,
bang_glass = 5031,
bang_glass2,
solidPool_water = 9000,
solidPool_blood,
solidPool_oil,
solidPool_petrol,
solidPool_mud,
porousPool_water,
porousPool_blood,
porousPool_oil,
porousPool_petrol,
porousPool_mud,
porousPool_water_ped_drip,
liquidTrail_water = 9050
};
enum class eTaskTypeIndex
{
CTaskHandsUp = 0,

View File

@ -69,6 +69,34 @@ namespace big::entity
return (bool)hit;
}
inline bool raycast(Vector3* endcoor)
{
Entity ent;
BOOL hit;
Vector3 surfaceNormal;
Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
Vector3 dir = math::rotation_to_direction(CAM::GET_GAMEPLAY_CAM_ROT(2));
Vector3 farCoords;
farCoords.x = camCoords.x + dir.x * 1000;
farCoords.y = camCoords.y + dir.y * 1000;
farCoords.z = camCoords.z + dir.z * 1000;
int ray = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x,
camCoords.y,
camCoords.z,
farCoords.x,
farCoords.y,
farCoords.z,
-1,
0,
7);
SHAPETEST::GET_SHAPE_TEST_RESULT(ray, &hit, endcoor, &surfaceNormal, &ent);
return (bool)hit;
}
inline bool network_has_control_of_entity(rage::netObject* net_object)
{
return !net_object || !net_object->m_next_owner_id && (net_object->m_control_id == -1);

View File

@ -148,6 +148,9 @@ namespace big
}
break;
case CustomWeapon::PAINT_GUN:
ImGui::Checkbox("Rainbow Color", &g.weapons.paintgun.rainbow);
if (!g.weapons.paintgun.rainbow) { ImGui::ColorEdit4("Paint Gun Color", g.weapons.paintgun.col); }
}
ImGui::SeparatorText("Aim Assistance");
@ -216,12 +219,12 @@ namespace big
ImGui::PushItemWidth(250);
if (ImGui::BeginCombo("Attachments", selected_weapon_attachment.c_str()))
{
auto weapon = g_gta_data_service->weapon_by_hash(selected_weapon_hash);
weapon_item weapon = g_gta_data_service->weapon_by_hash(selected_weapon_hash);
if (!weapon.m_attachments.empty())
{
for (std::string attachment : weapon.m_attachments)
{
auto attachment_component = g_gta_data_service->weapon_component_by_name(attachment);
weapon_component attachment_component = g_gta_data_service->weapon_component_by_name(attachment);
std::string attachment_name = attachment_component.m_display_name;
Hash attachment_hash = attachment_component.m_hash;
if (attachment_hash == NULL)
@ -280,7 +283,7 @@ namespace big
ImGui::PushItemWidth(250);
if (ImGui::BeginListBox("Saved Loadouts", ImVec2(200, 200)))
{
for (auto filename : persist_weapons::list_weapon_loadouts())
for (std::string filename : persist_weapons::list_weapon_loadouts())
{
if (components::selectable(filename, filename == selected_loadout))
{
@ -330,7 +333,7 @@ namespace big
for (auto& weapon_hash : g.weapons.weapon_hotkeys[selected_key])
{
ImGui::PushID(counter);
auto weapon = g_gta_data_service->weapon_by_hash(weapon_hash);
weapon_item weapon = g_gta_data_service->weapon_by_hash(weapon_hash);
ImGui::PushItemWidth(300);
if (ImGui::BeginCombo("Weapons", weapon.m_display_name.c_str()))
{