* feat(Commands): Prototype command system
* feat(Commands): Chat commands
* refactor(Toxic): convert most options into commands
* feat(Protections): block breakup kicks on other players as host
* refactor(Kicks): convert most options into commands
* refactor(Commands): add labels and descriptions to all commands
* feat(Commands): cleanup on unload
* refactor(Troll): convert most options into commands
* refactor(Misc): convert most options into commands
* refactor(Teleport): convert most options into commands
* feat(Commands): Variadic commands and toggleable bools
* feat(Hotkeys): hotkeys now use commands
* fix(Chat): fix the chat window locking up when a message is sent
* fix(Commands): properly handle spoofed username
* fix(Spam): update filter

Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
This commit is contained in:
maybegreat48
2022-12-22 21:23:32 +00:00
committed by GitHub
parent 9d9d438b5d
commit ce5c317d87
143 changed files with 3194 additions and 1458 deletions

View File

@ -2,8 +2,8 @@
#include "natives.hpp"
#include "script_global.hpp"
#include "gta/joaat.hpp"
#include "util/kick.hpp"
#include "services/players/player_service.hpp"
#include "core/scr_globals.hpp"
// Credits: QuickNET
namespace big

View File

@ -10,30 +10,14 @@ namespace big
public:
static void hud_transition_state();
static void tunables_disable_phone();
static void player_good_options();
static void player_spectate();
static void player_remote_control_vehicle();
static void self_clean_player();
static void self_free_cam_disable_control_action();
static void self_free_cam();
static void self_godmode();
static void self_invisibility();
static void self_noclip_disable_control_action();
static void self_noclip();
static void self_no_ragdoll();
static void self_off_radar();
static void self_police();
static void self_super_run();
static void self_no_collision();
static void self_hud();
static void self_unlimited_oxygen();
static void self_no_water_collision();
static void self_mobile_radio();
static void self_dance_mode();
static void self_fast_respawn();
static void session_local_time();
static void session_pop_multiplier_areas();
@ -50,35 +34,21 @@ namespace big
static void vehicle_auto_drive();
static void vehicle_boost_behavior();
static void vehicle_drive_on_water();
static void vehicle_fly();
static void vehicle_god_mode();
static void vehicle_horn_boost();
static void vehicle_jump();
static void vehicle_instant_brake();
static void vehicle_is_targetable();
static void vehicle_ls_customs();
static void vehicle_rainbow_paint();
static void vehicle_seatbelt();
static void vehicle_speedo_meter();
static void vehicle_turn_signals();
static void vehicle_keep_vehicle_repaired();
static void vehicle_no_water_collision();
static void weapons_ammo_special_type();
static void weapons_cage_gun();
static void custom_gun_disable_control_action();
static void weapons_delete_gun();
static void weapons_force_crosshairs();
static void weapons_gravity_gun();
static void weapons_increased_damage();
static void weapons_infinite_ammo();
static void weapons_infinite_mag();
static void weapons_no_recoil();
static void weapons_no_spread();
static void weapons_repair_gun();
static void weapons_steal_vehicle_gun();
static void weapons_vehicle_gun();
static void weapons_rapid_fire();
};
}

View File

@ -1,13 +1,18 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/entity.hpp"
namespace big
{
void looped::self_clean_player()
class clean_player_looped : looped_command
{
if (g.self.clean_player) {
using looped_command::looped_command;
virtual void on_tick() override
{
entity::clean_ped(self::ped);
}
}
}
};
clean_player_looped g_clean_player_looped("cleanloop", "Keep Player Clean", "Prevents wetness and decals from being applied on you", g.self.clean_player);
}

View File

@ -1,17 +1,26 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
void looped::self_fast_respawn()
{
if (g.self.fast_respawn)
{
if(PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{
PED::RESURRECT_PED(self::ped);
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(self::ped, self::pos.x, self::pos.y, self::pos.z, 0, 0, 0);
}
}
}
}
class fast_respawn : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
if (PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{
PED::RESURRECT_PED(self::ped);
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(self::ped, self::pos.x, self::pos.y, self::pos.z, 0, 0, 0);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped);
MISC::FORCE_GAME_STATE_PLAYING();
}
}
};
fast_respawn g_fast_respawn("fastrespawn", "Instant Respawn", "Makes you respawn instantly when you die", g.self.fast_respawn);
}

View File

@ -1,20 +1,12 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/globals.hpp"
#include "backend/looped_command.hpp"
#include "util/math.hpp"
namespace big
{
static bool bLastFreeCam = false;
static float speed = 0.5f;
static float mult = 0.f;
static Cam cCam = -1;
static Vector3 vecPosition;
static Vector3 vecRot;
static const ControllerInputs controls[] =
{
ControllerInputs::INPUT_LOOK_LR,
@ -29,96 +21,91 @@ namespace big
ControllerInputs::INPUT_LOOK_DOWN
};
void looped::self_free_cam_disable_control_action()
class free_cam : looped_command
{
if (g_local_player == nullptr) return;
using looped_command::looped_command;
if (g.self.free_cam)
float speed = 0.5f;
float mult = 0.f;
Cam camera = -1;
Vector3 position;
Vector3 rotation;
virtual void on_enable() override
{
camera = CAM::CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", 0);
position = CAM::GET_GAMEPLAY_CAM_COORD();
rotation = CAM::GET_GAMEPLAY_CAM_ROT(2);
ENTITY::FREEZE_ENTITY_POSITION(self::veh, true);
CAM::SET_CAM_COORD(camera, position.x, position.y, position.z);
CAM::SET_CAM_ROT(camera, rotation.x, rotation.y, rotation.z, 2);
CAM::SET_CAM_ACTIVE(camera, true);
CAM::RENDER_SCRIPT_CAMS(true, true, 500, true, true, 0);
}
virtual void on_tick() override
{
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
for (const auto& control : controls)
PAD::ENABLE_CONTROL_ACTION(0, static_cast<int>(control), true);
Vector3 vecChange = { 0.f, 0.f, 0.f };
// Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
vecChange.z += speed / 2;
// Left Control
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
vecChange.z -= speed / 2;
// Forward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
vecChange.y += speed;
// Backward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
vecChange.y -= speed;
// Left
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
vecChange.x -= speed;
// Right
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
vecChange.x += speed;
if (vecChange.x == 0.f && vecChange.y == 0.f && vecChange.z == 0.f)
mult = 0.f;
else if (mult < 10)
mult += 0.15f;
Vector3 rot = CAM::GET_CAM_ROT(camera, 2);
//float pitch = math::deg_to_rad(rot.x); // vertical
//float roll = rot.y;
float yaw = math::deg_to_rad(rot.z); // horizontal
position.x += (vecChange.x * cos(yaw) - vecChange.y * sin(yaw)) * mult;
position.y += (vecChange.x * sin(yaw) + vecChange.y * cos(yaw)) * mult;
position.z += vecChange.z * mult;
CAM::SET_CAM_COORD(camera, position.x, position.y, position.z);
STREAMING::SET_FOCUS_POS_AND_VEL(position.x, position.y, position.z, 0.f, 0.f, 0.f);
rotation = CAM::GET_GAMEPLAY_CAM_ROT(2);
CAM::SET_CAM_ROT(camera, rotation.x, rotation.y, rotation.z, 2);
}
}
void looped::self_free_cam()
{
if (g_local_player == nullptr) return;
const auto vehicle = self::veh;
const auto ped = self::ped;
if (!g.self.free_cam && !bLastFreeCam) return;
if (g.self.free_cam && !bLastFreeCam)
virtual void on_disable() override
{
cCam = CAM::CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", 0);
vecPosition = CAM::GET_GAMEPLAY_CAM_COORD();
vecRot = CAM::GET_GAMEPLAY_CAM_ROT(2);
ENTITY::FREEZE_ENTITY_POSITION(vehicle, true);
CAM::SET_CAM_COORD(cCam, vecPosition.x, vecPosition.y, vecPosition.z);
CAM::SET_CAM_ROT(cCam, vecRot.x, vecRot.y, vecRot.z, 2);
CAM::SET_CAM_ACTIVE(cCam, true);
CAM::RENDER_SCRIPT_CAMS(true, true, 500, true, true, 0);
bLastFreeCam = true;
}
else if (!g.self.free_cam && bLastFreeCam)
{
CAM::SET_CAM_ACTIVE(cCam, false);
CAM::SET_CAM_ACTIVE(camera, false);
CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0);
CAM::DESTROY_CAM(cCam, false);
STREAMING::SET_FOCUS_ENTITY(ped);
CAM::DESTROY_CAM(camera, false);
STREAMING::CLEAR_FOCUS();
ENTITY::FREEZE_ENTITY_POSITION(vehicle, false);
bLastFreeCam = false;
return;
ENTITY::FREEZE_ENTITY_POSITION(camera, false);
}
};
Vector3 vecChange = { 0.f, 0.f, 0.f };
// Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
vecChange.z += speed / 2;
// Left Control
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
vecChange.z -= speed / 2;
// Forward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
vecChange.y += speed;
// Backward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
vecChange.y -= speed;
// Left
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
vecChange.x -= speed;
// Right
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
vecChange.x += speed;
if (vecChange.x == 0.f && vecChange.y == 0.f && vecChange.z == 0.f)
mult = 0.f;
else if (mult < 10)
mult += 0.15f;
Vector3 rot = CAM::GET_CAM_ROT(cCam, 2);
//float pitch = math::deg_to_rad(rot.x); // vertical
//float roll = rot.y;
float yaw = math::deg_to_rad(rot.z); // horizontal
vecPosition.x += (vecChange.x * cos(yaw) - vecChange.y * sin(yaw)) * mult;
vecPosition.y += (vecChange.x * sin(yaw) + vecChange.y * cos(yaw)) * mult;
vecPosition.z += vecChange.z * mult;
CAM::SET_CAM_COORD(cCam, vecPosition.x, vecPosition.y, vecPosition.z);
STREAMING::SET_FOCUS_POS_AND_VEL(vecPosition.x, vecPosition.y, vecPosition.z, 0.f, 0.f, 0.f);
vecRot = CAM::GET_GAMEPLAY_CAM_ROT(2);
CAM::SET_CAM_ROT(cCam, vecRot.x, vecRot.y, vecRot.z, 2);
}
}
free_cam g_free_cam("freecam", "Freecam", "Allows you to move your camera freely?", g.self.free_cam);
}

View File

@ -1,36 +1,27 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastInvisibility = false;
void looped::self_invisibility()
class invisibility : looped_command
{
Ped ped = self::ped;
using looped_command::looped_command;
bool bInvisibility = g.self.invisibility;
if (bInvisibility || (!bInvisibility && bInvisibility != bLastInvisibility))
{
ENTITY::SET_ENTITY_VISIBLE(ped, !g.self.invisibility, 0);
bLastInvisibility = g.self.invisibility;
}
if (NETWORK::NETWORK_IS_SESSION_STARTED())
{
if (g.self.invisibility && g.self.local_visibility)
{
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(ped);
}
}
else
virtual void on_tick() override
{
ENTITY::SET_ENTITY_VISIBLE(self::ped, false, 0);
if (g.self.local_visibility)
{
ENTITY::SET_ENTITY_VISIBLE(ped, true, 0);
}
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(self::ped);
}
}
virtual void on_disable() override
{
ENTITY::SET_ENTITY_VISIBLE(self::ped, true, 0);
}
};
invisibility g_invisibility("invis", "Invisiblity", "Makes you invisible", g.self.invisibility);
bool_command g_local_visibility("localvis", "Visible Locally", "Makes you visible to yourself, other players will still not be able to see you", g.self.local_visibility);
}

View File

@ -1,25 +1,24 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastMobileRadio = false;
void looped::self_mobile_radio()
class mobile_radio : looped_command
{
const bool bMobileRadio = g.self.mobile_radio;
using looped_command::looped_command;
if (bMobileRadio)
virtual void on_tick() override
{
AUDIO::SET_MOBILE_PHONE_RADIO_STATE(true);
AUDIO::SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY(true);
}
else if (bMobileRadio != bLastMobileRadio)
virtual void on_disable() override
{
AUDIO::SET_MOBILE_PHONE_RADIO_STATE(false);
AUDIO::SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY(false);
}
};
bLastMobileRadio = bMobileRadio;
}
mobile_radio g_mobile_radio("mobileradio", "Mobile Radio", "Allows you to listen to the radio on foot", g.self.mobile_radio);
}

View File

@ -1,26 +1,28 @@
#include "backend/looped/looped.hpp"
#include "base/phArchetype.hpp"
#include "base/phBoundComposite.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include <base/phArchetype.hpp>
#include <base/phBoundComposite.hpp>
namespace big
{
static bool bLastNoCollsion = false;
void looped::self_no_collision()
class no_collision : looped_command
{
if (g_local_player == nullptr) return;
using looped_command::looped_command;
bool bNoCollsion = g.self.no_collision;
virtual void on_tick() override
{
if (g_local_player)
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = -1;
}
if (bNoCollsion)
virtual void on_disable() override
{
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = -1;
bLastNoCollsion = bNoCollsion;
if (g_local_player)
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = 0.25;
}
else if (bNoCollsion != bLastNoCollsion)
{
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = 0.25;
bLastNoCollsion = bNoCollsion;
}
}
};
no_collision g_no_collision("nocollision", "No Collision", "Allows you to walk through vehicles and most obstacles", g.self.no_collision);
}

View File

@ -1,19 +1,24 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastNoRagdoll = false;
void looped::self_no_ragdoll()
class no_ragdoll : looped_command
{
bool bNoRagdoll = g.self.no_ragdoll;
using looped_command::looped_command;
if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
virtual void on_tick() override
{
PED::SET_PED_CAN_RAGDOLL(self::ped, !g.self.no_ragdoll);
bLastNoRagdoll = g.self.no_ragdoll;
PED::SET_PED_CAN_RAGDOLL(self::ped, false);
}
}
virtual void on_disable() override
{
PED::SET_PED_CAN_RAGDOLL(self::ped, true);
}
};
no_ragdoll g_no_ragdoll("noragdoll", "No Ragdoll", "Prevents you from ragdolling", g.self.no_ragdoll);
}

View File

@ -1,24 +1,26 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastSelfNoWaterCollsion = false;
void looped::self_no_water_collision()
class no_water_collision : looped_command
{
if (g_local_player == nullptr) return;
using looped_command::looped_command;
bool bNoWaterCollsion = g.self.no_water_collision;
virtual void on_tick() override
{
if (g_local_player)
g_local_player->m_navigation->m_damp->m_water_collision = 0;
}
if (bNoWaterCollsion)
virtual void on_disable() override
{
g_local_player->m_navigation->m_damp->m_water_collision = 0;
bLastSelfNoWaterCollsion = bNoWaterCollsion;
if (g_local_player)
g_local_player->m_navigation->m_damp->m_water_collision = 1;
}
else if (bNoWaterCollsion != bLastSelfNoWaterCollsion)
{
g_local_player->m_navigation->m_damp->m_water_collision = 1;
bLastSelfNoWaterCollsion = bNoWaterCollsion;
}
}
}
};
no_water_collision g_no_water_collision("walkunder", "Walk Underwater", "Allows you to walk and shoot underwater", g.self.no_water_collision);
}

View File

@ -3,10 +3,11 @@
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/entity.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static const ControllerInputs controls[] =
static constexpr ControllerInputs controls[] =
{
ControllerInputs::INPUT_SPRINT,
ControllerInputs::INPUT_MOVE_UP_ONLY,
@ -16,41 +17,32 @@ namespace big
ControllerInputs::INPUT_DUCK
};
static float speed = 20.f;
static float mult = 0.f;
static constexpr float speed = 20.f;
static bool bLastNoclip = false;
static Entity prev = -1;
static Vector3 rot{};
void looped::self_noclip_disable_control_action()
class noclip : looped_command
{
if (g.self.noclip)
using looped_command::looped_command;
Entity m_entity;
float m_speed_multiplier;
virtual void on_tick() override
{
for (const auto& control : controls)
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(control), true);
}
}
void looped::self_noclip()
{
const auto bNoclip = g.self.noclip;
const auto location = self::pos;
const Entity ent = (self::veh != 0 && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) ? self::veh : self::ped;
const auto location = self::pos;
const Entity ent = (self::veh != 0 && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) ? self::veh : self::ped;
// cleanup when changing entities
if (m_entity != ent)
{
ENTITY::FREEZE_ENTITY_POSITION(m_entity, false);
ENTITY::SET_ENTITY_COLLISION(m_entity, true, true);
// cleanup when changing entities
if (prev != ent)
{
ENTITY::FREEZE_ENTITY_POSITION(prev, false);
ENTITY::SET_ENTITY_COLLISION(prev, true, true);
m_entity = ent;
}
prev = ent;
}
if (bNoclip)
{
Vector3 vel = { 0.f, 0.f, 0.f };
// Left Shift
@ -72,20 +64,19 @@ namespace big
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
vel.x += speed;
rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
auto rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
ENTITY::SET_ENTITY_ROTATION(ent, 0.f, rot.y, rot.z, 2, 0);
ENTITY::SET_ENTITY_COLLISION(ent, false, false);
if (vel.x == 0.f && vel.y == 0.f && vel.z == 0.f)
{
// freeze entity to prevent drifting when standing still
ENTITY::FREEZE_ENTITY_POSITION(ent, true);
mult = 0.f;
m_speed_multiplier = 0.f;
}
else
{
if (mult < 20.f)
mult += 0.15f;
if (m_speed_multiplier < 20.f)
m_speed_multiplier += 0.15f;
ENTITY::FREEZE_ENTITY_POSITION(ent, false);
@ -93,18 +84,19 @@ namespace big
vel.x = offset.x - location.x;
vel.y = offset.y - location.y;
ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * mult, vel.y * mult, vel.z * mult);
}
}
else if (bNoclip != bLastNoclip)
{
if (entity::take_control_of(ent))
{
ENTITY::FREEZE_ENTITY_POSITION(ent, false);
ENTITY::SET_ENTITY_COLLISION(ent, true, false);
ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * m_speed_multiplier, vel.y * m_speed_multiplier, vel.z * m_speed_multiplier);
}
}
bLastNoclip = bNoclip;
}
virtual void on_disable() override
{
if (entity::take_control_of(m_entity))
{
ENTITY::FREEZE_ENTITY_POSITION(m_entity, false);
ENTITY::SET_ENTITY_COLLISION(m_entity, true, false);
}
}
};
noclip g_noclip("noclip", "No Clip", "Allows you to fly through the map", g.self.noclip);
}

View File

@ -1,11 +1,24 @@
#include "backend/looped/looped.hpp"
#include "util/mobile.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "core/scr_globals.hpp"
namespace big
{
void looped::self_off_radar()
class off_radar : looped_command
{
if (g.self.off_radar)
mobile::lester::off_radar(g.self.off_radar);
}
}
using looped_command::looped_command;
virtual void on_tick() override
{
*scr_globals::globalplayer_bd.at(PLAYER::GET_PLAYER_INDEX(), scr_globals::size::globalplayer_bd).at(210).as<int*>() = true;
*script_global(2672505).at(56).as<int*>() = NETWORK::GET_NETWORK_TIME() + 1;
}
virtual void on_disable() override
{
*scr_globals::globalplayer_bd.at(PLAYER::GET_PLAYER_INDEX(), scr_globals::size::globalplayer_bd).at(210).as<int*>() = false;
}
};
off_radar g_off_radar("otr", "Off Radar", "Hides your blip from other players", g.self.off_radar);
}

View File

@ -1,53 +1,65 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/math.hpp"
namespace big
{
static float run_speed = 10.f;
static float run_cap = 100.f;
static bool super_run_state = false;
void looped::self_super_run()
class super_run : looped_command
{
if (g.self.super_run && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
using looped_command::looped_command;
const float run_cap = 100.f;
float run_speed = 10.f;
virtual void on_tick() override
{
if (run_speed < run_cap) run_speed += .5f;
if (g_local_player)
{
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
{
if (run_speed < run_cap)
run_speed += .5f;
Vector3 location = self::pos;
Ped ped = self::ped;
Vector3 location = self::pos;
Ped ped = self::ped;
//Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2);
float yaw = math::deg_to_rad(rot.z + 90);
Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2);
float yaw = math::deg_to_rad(rot.z + 90);
Vector3 offset;
offset.x = location.x + (run_speed * cos(yaw));
offset.y = location.y + (run_speed * sin(yaw));
offset.z = location.z + .2f;
Vector3 offset;
offset.x = location.x + (run_speed * cos(yaw));
offset.y = location.y + (run_speed * sin(yaw));
offset.z = location.z + .2f;
float groundZ;
MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false);
if (groundZ < location.z)
offset.z = groundZ;
float groundZ;
MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false);
if (groundZ < location.z)
offset.z = groundZ;
Vector3 vel = offset - location;
Vector3 vel = offset - location;
ENTITY::SET_ENTITY_VELOCITY(ped, vel.x, vel.y, vel.z);
ENTITY::SET_ENTITY_VELOCITY(ped, vel.x, vel.y, vel.z);
g_local_player->m_player_info->m_run_speed = .7f;
}
else if (!g.self.super_run && g.self.super_run != super_run_state)
{
g_local_player->m_player_info->m_run_speed = 1.f;
}
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT))
{
run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f;
g_local_player->m_player_info->m_run_speed = .7f;
}
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT))
{
run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f;
}
}
}
super_run_state = g.self.super_run;
}
}
virtual void on_disable() override
{
if (g_local_player)
{
run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f;
}
}
};
super_run g_super_run("fastrun", "Super Run", "Makes you run much faster", g.self.super_run);
}

View File

@ -1,12 +1,18 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
void looped::self_unlimited_oxygen()
class unlimited_oxygen : looped_command
{
if (g_local_player == nullptr) return;
using looped_command::looped_command;
if (g.self.unlimited_oxygen)
g_local_player->m_oxygen_info->m_oxygen_time = 0;
}
}
virtual void on_tick() override
{
if (g_local_player)
g_local_player->m_oxygen_info->m_oxygen_time = 0;
}
};
unlimited_oxygen g_unlimited_oxygen("infoxy", "Unlimited Oxygen", "Allows you to stay underwater without losing oxygen", g.self.unlimited_oxygen);
}

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/kick.hpp"
#include "backend/player_command.hpp"
namespace big
{
@ -14,7 +14,9 @@ namespace big
g_player_service->iterate([](auto& plyr)
{
if (plyr.second->is_host())
kick::lost_connection_kick(plyr.second);
{
((player_command*)(command::get(RAGE_JOAAT("lckick"))))->call(plyr.second, {});
}
});
}
bLastKickHost = kick_host;

View File

@ -10,6 +10,9 @@ namespace big
{
void looped::system_desync_kick_protection()
{
if (g_player_service->get_self()->is_valid() && g_player_service->get_self()->is_host())
return;
memset(&gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(std::uint64_t));
if (!g_player_service->m_player_to_use_complaint_kick || !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data())
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0;

View File

@ -1,10 +1,23 @@
#include "backend/looped/looped.hpp"
#include "script_global.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "core/scr_globals.hpp"
namespace big
{
void looped::tunables_disable_phone()
class disable_phone : looped_command
{
*script_global(20366).as<bool*>() = g.tunables.disable_phone; // Who even uses that...
}
}
using looped_command::looped_command;
virtual void on_tick() override
{
*script_global(20366).as<bool*>() = true;
}
virtual void on_disable() override
{
*script_global(20366).as<bool*>() = false;
}
};
disable_phone g_disable_phone("nophone", "Disable Phone", "Blocks phone and stops all phone calls", g.tunables.disable_phone);
}

View File

@ -0,0 +1,25 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "gta/enums.hpp"
namespace big
{
class block_homing : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_is_targetable = false;
}
virtual void on_disable() override
{
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_is_targetable = true;
}
};
block_homing g_block_homing("blockhoming", "Block Homing Missiles", "Prevents homing missiles from locking on to your vehicle", g.vehicle.block_homing);
}

View File

@ -1,93 +1,99 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "backend/looped_command.hpp"
#include "util/entity.hpp"
namespace big
{
constexpr auto drive_on_water_surface_hash = RAGE_JOAAT("stt_prop_stunt_bblock_xl3");
static Vector3 drive_on_water_last_loc;
void drive_on_water_hide_surface()
class drive_on_water : looped_command
{
Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
4.0, drive_on_water_surface_hash, 0, 0, 1
);
using looped_command::looped_command;
if (surface)
{
entity::take_control_of(surface);
ENTITY::SET_ENTITY_COORDS(surface, 0, 0, -1000.0f, 0, 0, 0, 1);
script::get_current()->yield(10ms);
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&surface);
ENTITY::DELETE_ENTITY(&surface);
WATER::RESET_DEEP_OCEAN_SCALER();
}
}
const rage::joaat_t drive_on_water_surface_hash = RAGE_JOAAT("stt_prop_stunt_bblock_xl3");
Vector3 drive_on_water_last_loc;
void looped::vehicle_drive_on_water()
{
if (!g.vehicle.drive_on_water || self::veh == 0) {
drive_on_water_hide_surface();
return;
}
Vector3 location = ENTITY::GET_ENTITY_COORDS(self::veh, 1);
float height = 0;
WATER::SET_DEEP_OCEAN_SCALER(0);
if (location.z - height < 10 && WATER::GET_WATER_HEIGHT_NO_WAVES(location.x, location.y, location.z, &height))
void drive_on_water_hide_surface()
{
Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
4.0, drive_on_water_surface_hash, 0, 0, 1
);
if (ENTITY::DOES_ENTITY_EXIST(surface) && height > -50.0f)
if (surface)
{
entity::take_control_of(surface);
ENTITY::SET_ENTITY_COORDS(surface, 0, 0, -1000.0f, 0, 0, 0, 1);
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&surface);
ENTITY::DELETE_ENTITY(&surface);
WATER::RESET_DEEP_OCEAN_SCALER();
}
}
drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f;
ENTITY::SET_ENTITY_COORDS(
surface,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
0, 0, 0, 0
virtual void on_tick() override
{
Vector3 location = ENTITY::GET_ENTITY_COORDS(self::veh, 1);
float height = 0;
WATER::SET_DEEP_OCEAN_SCALER(0);
if (location.z - height < 10 && WATER::GET_WATER_HEIGHT_NO_WAVES(location.x, location.y, location.z, &height) && self::veh)
{
Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
4.0, drive_on_water_surface_hash, 0, 0, 1
);
if (location.z < height - 2.f)
if (ENTITY::DOES_ENTITY_EXIST(surface) && height > -50.0f)
{
entity::take_control_of(self::veh);
ENTITY::SET_ENTITY_COORDS(self::veh, location.x, location.y, height, 0, 0, 0, 0);
entity::take_control_of(surface);
drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f;
ENTITY::SET_ENTITY_COORDS(
surface,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
0, 0, 0, 0
);
if (location.z < height - 2.f)
{
entity::take_control_of(self::veh);
ENTITY::SET_ENTITY_COORDS(self::veh, location.x, location.y, height, 0, 0, 0, 0);
}
}
else
{
STREAMING::REQUEST_MODEL(drive_on_water_surface_hash);
while (!STREAMING::HAS_MODEL_LOADED(drive_on_water_surface_hash))
{
script::get_current()->yield();
}
drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f;
surface = OBJECT::CREATE_OBJECT(
drive_on_water_surface_hash,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
1, 1, 0
);
entity::take_control_of(surface);
ENTITY::FREEZE_ENTITY_POSITION(surface, 1);
ENTITY::SET_ENTITY_ALPHA(surface, 0, 1);
ENTITY::SET_ENTITY_VISIBLE(surface, false, 0);
}
}
else
{
STREAMING::REQUEST_MODEL(drive_on_water_surface_hash);
while (!STREAMING::HAS_MODEL_LOADED(drive_on_water_surface_hash))
{
script::get_current()->yield();
}
drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f;
surface = OBJECT::CREATE_OBJECT(
drive_on_water_surface_hash,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z,
1, 1, 0
);
entity::take_control_of(surface);
ENTITY::FREEZE_ENTITY_POSITION(surface, 1);
ENTITY::SET_ENTITY_ALPHA(surface, 0, 1);
ENTITY::SET_ENTITY_VISIBLE(surface, false, 0);
drive_on_water_hide_surface();
}
}
else
virtual void on_disable() override
{
drive_on_water_hide_surface();
}
}
};
drive_on_water g_drive_on_water("driveonwater", "Drive On Water", "Allows you to drive on water", g.vehicle.drive_on_water);
}

View File

@ -1,38 +1,44 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "gta/enums.hpp"
namespace big
{
static constexpr float hornBoostSpeedDefault = 10.f;
static float hornBoostSpeed = hornBoostSpeedDefault;
static constexpr float hostBoostSpeedMax = 200.f;
void looped::vehicle_horn_boost()
class horn_boost : looped_command
{
if (!g.vehicle.horn_boost) return;
Vehicle vehicle = self::veh;
using looped_command::looped_command;
static constexpr float horn_boost_speed_default = 10.f;
static constexpr float horn_boost_speed_max = 200.f;
static constexpr float horn_boost_speed_increment = 0.3f;
if (vehicle == 0)
float horn_boost_speed = horn_boost_speed_default;
virtual void on_tick() override
{
hornBoostSpeed = hornBoostSpeedDefault;
Vehicle vehicle = self::veh;
return;
if (vehicle == 0)
{
horn_boost_speed = horn_boost_speed_default;
return;
}
if (PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
horn_boost_speed = ENTITY::GET_ENTITY_SPEED(vehicle);
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
{
if (horn_boost_speed < horn_boost_speed_max)
horn_boost_speed += horn_boost_speed_increment;
const auto velocity =
ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(vehicle, 0.f, horn_boost_speed, 0.f) - ENTITY::GET_ENTITY_COORDS(vehicle, true);
ENTITY::SET_ENTITY_VELOCITY(vehicle, velocity.x, velocity.y, velocity.z);
}
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN))
horn_boost_speed = horn_boost_speed_default;
}
};
if (PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
hornBoostSpeed = ENTITY::GET_ENTITY_SPEED(vehicle);
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
{
if (hornBoostSpeed < hostBoostSpeedMax) hornBoostSpeed++;
const auto velocity =
ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(vehicle, 0.f, hornBoostSpeed, 0.f) - ENTITY::GET_ENTITY_COORDS(vehicle, true);
ENTITY::SET_ENTITY_VELOCITY(vehicle, velocity.x, velocity.y, velocity.z);
}
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN))
hornBoostSpeed = hornBoostSpeedDefault;
}
}
horn_boost g_horn_boost("hornboost", "Horn Boost", "Boosts your vehicle forward when you sound the horn", g.vehicle.horn_boost);
}

View File

@ -1,22 +1,22 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "gta/enums.hpp"
namespace big
{
void looped::vehicle_instant_brake()
class instant_brake : looped_command
{
if (!g.vehicle.instant_brake) return;
using looped_command::looped_command;
Vehicle vehicle = self::veh;
if (vehicle == 0 || ENTITY::GET_ENTITY_SPEED_VECTOR(vehicle, true).y < 1.f || !VEHICLE::IS_VEHICLE_ON_ALL_WHEELS(vehicle))
virtual void on_tick() override
{
return;
}
if (self::veh == 0 || ENTITY::GET_ENTITY_SPEED_VECTOR(self::veh, true).y < 1.f || !VEHICLE::IS_VEHICLE_ON_ALL_WHEELS(self::veh))
return;
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0);
}
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
}
};
instant_brake g_instant_brake("instantbrake", "Instant Brake", "Makes your vehicle stop instantly when you press the brake", g.vehicle.instant_brake);
}

View File

@ -1,10 +0,0 @@
#include "backend/looped/looped.hpp"
namespace big
{
void looped::vehicle_is_targetable()
{
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_is_targetable = g.vehicle.is_targetable;
}
}

View File

@ -1,12 +1,19 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/vehicle.hpp"
namespace big
{
void looped::vehicle_keep_vehicle_repaired()
class keep_vehicle_repaired : looped_command
{
if (g.vehicle.keep_vehicle_repaired && VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(self::veh)) {
vehicle::repair(self::veh);
using looped_command::looped_command;
virtual void on_tick() override
{
if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(self::veh))
vehicle::repair(self::veh);
}
}
}
};
keep_vehicle_repaired g_keep_vehicle_repaired("keepfixed", "Keep Vehicle Repaired", "Keeps your vehicle free of wear and tear", g.vehicle.keep_vehicle_repaired);
}

View File

@ -1,24 +1,24 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastVehicleNoWaterCollsion = false;
void looped::vehicle_no_water_collision()
class no_vehicle_water_collision : looped_command
{
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr) return;
using looped_command::looped_command;
bool bNoWaterCollsion = g.vehicle.no_water_collision;
virtual void on_tick() override
{
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_navigation->m_damp->m_water_collision = 0;
}
if (bNoWaterCollsion)
virtual void on_disable() override
{
g_local_player->m_vehicle->m_navigation->m_damp->m_water_collision = 0;
bLastVehicleNoWaterCollsion = bNoWaterCollsion;
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_navigation->m_damp->m_water_collision = 1;
}
else if (bNoWaterCollsion != bLastVehicleNoWaterCollsion)
{
g_local_player->m_vehicle->m_navigation->m_damp->m_water_collision = 1;
bLastVehicleNoWaterCollsion = bNoWaterCollsion;
}
}
}
};
no_vehicle_water_collision g_no_vehicle_water_collision("driveunder", "Drive Underwater", "Allows you to drive underwater", g.vehicle.no_water_collision);
}

View File

@ -1,21 +1,24 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool b_last_seatbelt = false;
void looped::vehicle_seatbelt()
class seatbelt : looped_command
{
bool b_seatbelt = g.vehicle.seatbelt;
using looped_command::looped_command;
if (b_seatbelt || (!b_seatbelt && b_seatbelt != b_last_seatbelt))
virtual void on_tick() override
{
PED::SET_PED_CONFIG_FLAG(self::ped, 32, g.vehicle.seatbelt);
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(self::ped, g.vehicle.seatbelt);
b_last_seatbelt = g.vehicle.seatbelt;
PED::SET_PED_CONFIG_FLAG(self::ped, 32, true);
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(self::ped, true);
}
}
virtual void on_disable() override
{
PED::SET_PED_CONFIG_FLAG(self::ped, 32, false);
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(self::ped, false);
}
};
seatbelt g_seatbelt("seatbelt", "Seatbelt", "Prevent you from falling off bikes or flying through the windshield", g.vehicle.no_water_collision);
}

View File

@ -1,23 +1,21 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "gta/enums.hpp"
namespace big
{
void looped::vehicle_jump()
class vehicle_jump : looped_command
{
if (!g.vehicle.vehicle_jump) return;
using looped_command::looped_command;
const auto vehicle = self::veh;
if (!vehicle || !ENTITY::IS_ENTITY_A_VEHICLE(vehicle))
virtual void on_tick() override
{
return;
if (self::veh && PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
{
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, 0.0, 0.0, 20, 0.0, 0.0, 0.0, 0, 0, 1, 1, 0, 1);
}
}
};
if (PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
{
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, 0.0, 20, 0.0, 0.0, 0.0, 0, 0, 1, 1, 0, 1);
}
}
vehicle_jump g_vehicle_jump("vehjump", "Vehicle Jump", "Makes the vehicle jump when you press the handbrake", g.vehicle.vehicle_jump);
}

View File

@ -1,13 +1,17 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "core/enums.hpp"
#include "backend/looped_command.hpp"
namespace big
{
void looped::weapons_force_crosshairs()
class force_crosshairs : looped_command
{
if (g.weapons.force_crosshairs) {
using looped_command::looped_command;
virtual void on_tick() override
{
HUD::SHOW_HUD_COMPONENT_THIS_FRAME(static_cast<int>(HudComponents::RETICLE));
}
}
}
};
force_crosshairs g_force_crosshairs("crosshairs", "Force Crosshairs", "Shows the crosshair even when you are not aiming", g.weapons.force_crosshairs); // do we need this?
}

View File

@ -1,19 +1,25 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastInfiniteAmmo = false;
void looped::weapons_infinite_ammo()
class infinite_ammo : looped_command
{
bool bInfiniteAmmo = g.weapons.infinite_ammo;
using looped_command::looped_command;
if (bInfiniteAmmo || (!bInfiniteAmmo && bInfiniteAmmo != bLastInfiniteAmmo))
CWeaponInfo* p_modified_weapon = nullptr;
float og_recoil_value = 0.0f;
virtual void on_tick() override
{
WEAPON::SET_PED_INFINITE_AMMO(self::ped, g.weapons.infinite_ammo, NULL);
bLastInfiniteAmmo = g.weapons.infinite_ammo;
WEAPON::SET_PED_INFINITE_AMMO(self::ped, TRUE, NULL);
}
}
}
virtual void on_disable() override
{
WEAPON::SET_PED_INFINITE_AMMO(self::ped, FALSE, NULL);
}
};
infinite_ammo g_infinite_ammo("infammo", "Infinite Ammo", "Never run out of ammo again", g.weapons.no_recoil);
}

View File

@ -1,19 +1,25 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static bool bLastInfiniteMag = false;
void looped::weapons_infinite_mag()
class infinite_mag : looped_command
{
bool bInfiniteMag = g.weapons.infinite_mag;
using looped_command::looped_command;
if (bInfiniteMag || (!bInfiniteMag && bInfiniteMag != bLastInfiniteMag))
CWeaponInfo* p_modified_weapon = nullptr;
float og_recoil_value = 0.0f;
virtual void on_tick() override
{
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, g.weapons.infinite_mag);
bLastInfiniteMag = g.weapons.infinite_mag;
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, TRUE);
}
}
}
virtual void on_disable() override
{
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, FALSE);
}
};
infinite_mag g_infinite_mag("infclip", "Infinite Clip", "Shoot forever without needing to reload", g.weapons.no_recoil);
}

View File

@ -1,54 +1,47 @@
#include "backend/looped/looped.hpp"
#include "pointers.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static std::vector<std::pair<uint32_t, float>> og_recoil_values{};
static uint32_t prev_weapon_hash{};
bool is_recoil_value_cached(uint32_t hash)
class no_recoil : looped_command
{
return std::find_if(og_recoil_values.begin(), og_recoil_values.end(), [hash](auto const entry)
{
return hash == entry.first;
}) != og_recoil_values.end();
}
using looped_command::looped_command;
float get_og_recoil_value(uint32_t hash)
{
return std::find_if(og_recoil_values.begin(), og_recoil_values.end(), [hash](auto const entry)
{
return hash == entry.first;
})->second;
}
CWeaponInfo* p_modified_weapon = nullptr;
float og_recoil_value = 0.0f;
float get_recoil_value(uint32_t hash)
{
return g.weapons.no_recoil
? 0.f
: get_og_recoil_value(hash);
}
void looped::weapons_no_recoil()
{
if (!g_local_player)
virtual void on_tick() override
{
return;
}
auto* const weapon_mgr = g_local_player->m_weapon_manager;
if (weapon_mgr)
{
auto const cur_weapon_hash = weapon_mgr->m_selected_weapon_hash;
if (prev_weapon_hash != cur_weapon_hash)
if (!g_local_player)
{
if (!is_recoil_value_cached(cur_weapon_hash))
return;
}
auto* const weapon_mgr = g_local_player->m_weapon_manager;
if (weapon_mgr)
{
if (p_modified_weapon != weapon_mgr->m_weapon_info && weapon_mgr->m_weapon_info)
{
og_recoil_values.push_back({ cur_weapon_hash, weapon_mgr->m_weapon_info->m_explosion_shake_amplitude });
if (p_modified_weapon)
p_modified_weapon->m_explosion_shake_amplitude = og_recoil_value;
og_recoil_value = weapon_mgr->m_weapon_info->m_explosion_shake_amplitude;
p_modified_weapon = weapon_mgr->m_weapon_info;
weapon_mgr->m_weapon_info->m_explosion_shake_amplitude = 0.0f;
}
weapon_mgr->m_weapon_info->m_explosion_shake_amplitude = get_recoil_value(cur_weapon_hash); // m_explosion_shake_amplitude is the right offset in https://github.com/Yimura/GTAV-Classes
}
}
}
}
virtual void on_disable() override
{
if (g_local_player && p_modified_weapon)
{
p_modified_weapon->m_explosion_shake_amplitude = og_recoil_value;
p_modified_weapon = nullptr;
}
}
};
no_recoil g_no_recoil("norecoil", "No Recoil", "Removes weapon recoil when shooting", g.weapons.no_recoil);
}

View File

@ -1,54 +1,47 @@
#include "backend/looped/looped.hpp"
#include "pointers.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big
{
static std::vector<std::pair<uint32_t, float>> og_spread_values{};
static uint32_t prev_weapon_hash{};
class no_spread : looped_command
{
using looped_command::looped_command;
bool is_spread_value_cached(uint32_t hash)
{
return std::find_if(og_spread_values.begin(), og_spread_values.end(), [hash](auto const entry)
CWeaponInfo* p_modified_weapon = nullptr;
float og_spread_value = 0.0f;
virtual void on_tick() override
{
if (!g_local_player)
{
return hash == entry.first;
}) != og_spread_values.end();
}
return;
}
float get_og_spread_value(uint32_t hash)
{
return std::find_if(og_spread_values.begin(), og_spread_values.end(), [hash](auto const entry)
auto* const weapon_mgr = g_local_player->m_weapon_manager;
if (weapon_mgr)
{
return hash == entry.first;
})->second;
}
float get_spread_value(uint32_t hash)
{
return g.weapons.no_spread
? 0.f
: get_og_spread_value(hash);
}
void looped::weapons_no_spread()
{
if (!g_local_player)
{
return;
}
auto* const weapon_mgr = g_local_player->m_weapon_manager;
if (weapon_mgr)
{
auto const cur_weapon_hash = weapon_mgr->m_selected_weapon_hash;
if (prev_weapon_hash != cur_weapon_hash)
{
if (!is_spread_value_cached(cur_weapon_hash))
if (p_modified_weapon != weapon_mgr->m_weapon_info && weapon_mgr->m_weapon_info)
{
og_spread_values.push_back({ cur_weapon_hash, weapon_mgr->m_weapon_info->m_accuracy_spread });
}
if (p_modified_weapon)
p_modified_weapon->m_accuracy_spread = og_spread_value;
weapon_mgr->m_weapon_info->m_accuracy_spread = get_spread_value(cur_weapon_hash);
og_spread_value = weapon_mgr->m_weapon_info->m_accuracy_spread;
p_modified_weapon = weapon_mgr->m_weapon_info;
weapon_mgr->m_weapon_info->m_accuracy_spread = 0.0f;
}
}
}
virtual void on_disable() override
{
if (g_local_player && p_modified_weapon)
{
p_modified_weapon->m_accuracy_spread = og_spread_value;
p_modified_weapon = nullptr;
}
}
}
}
};
no_spread g_no_spread("nospread", "No Spread", "Removes weapon spread when shooting", g.weapons.no_spread);
}

View File

@ -1,16 +1,18 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/math.hpp"
#include "gui.hpp"
namespace big
{
void looped::weapons_rapid_fire()
{
if (g.weapons.rapid_fire)
{
if(!HUD::IS_PAUSE_MENU_ACTIVE() && !g_gui->is_open() && !PED::IS_PED_DEAD_OR_DYING(self::ped, true))
class rapid_fire : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
if (!HUD::IS_PAUSE_MENU_ACTIVE() && !g_gui->is_open() && !PED::IS_PED_DEAD_OR_DYING(self::ped, true) && !PED::IS_PED_IN_ANY_VEHICLE(self::ped, TRUE))
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{
@ -22,6 +24,8 @@ namespace big
MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(start.x, start.y, start.z, end.x, end.y, end.z, WEAPON::GET_WEAPON_DAMAGE(weapon_hash, 0), true, weapon_hash, self::ped, true, false, -1.0);
}
}
}
}
}
}
};
rapid_fire g_rapid_fire("rapidfire", "Rapid Fire", "Makes your weapon fire insanely fast", g.weapons.rapid_fire);
}