Better Aimbot
This commit is contained in:
@ -10,7 +10,6 @@ namespace big
|
||||
using looped_command::looped_command;
|
||||
|
||||
Vector3 aim_lock;
|
||||
Vector2 mouse_movement;
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
@ -57,96 +56,48 @@ namespace big
|
||||
// Jump to here to handle instead of continue statements
|
||||
aim_lock =
|
||||
ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(ped, PED::GET_PED_BONE_INDEX(ped, g.weapons.aimbot.selected_bone));
|
||||
if ((aim_lock.x != 0) && (aim_lock.y != 0) && (aim_lock.z != 0)) // Ensure none of the coords are = to 0
|
||||
{
|
||||
Vector2 screen_dim, movement;
|
||||
GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(aim_lock.x,
|
||||
aim_lock.y,
|
||||
aim_lock.z,
|
||||
&screen_dim.x,
|
||||
&screen_dim.y);
|
||||
if ((screen_dim.x >= 0) && (screen_dim.y >= 0)) // Make sure updated screen dim is greater than 0
|
||||
{
|
||||
auto& io = ImGui::GetIO();
|
||||
ImVec2 center(io.DisplaySize.x / 2.f, io.DisplaySize.y / 2.f); // Use ImGui to get the display size
|
||||
//Screen dim is a float between 0-1, multiply the float by screen coords
|
||||
screen_dim.x *= io.DisplaySize.x;
|
||||
screen_dim.y *= io.DisplaySize.y;
|
||||
|
||||
if (screen_dim.x > center.x) //If the location is greater than the center (right side)
|
||||
{ // Get the amount of distance we need to move, so center of the screen - our location
|
||||
movement.x = -(center.x - screen_dim.x);
|
||||
if (movement.x + center.x > center.x * 2)
|
||||
movement.x = 0;
|
||||
}
|
||||
else
|
||||
{ // if the location is on the left side
|
||||
movement.x = screen_dim.x - center.x;
|
||||
if (movement.x + center.x < 0)
|
||||
movement.x = 0;
|
||||
}
|
||||
|
||||
// Same thing here but for y, so switch right with up and left with down
|
||||
if (screen_dim.y > center.y)
|
||||
{
|
||||
movement.y = -(center.y - screen_dim.y);
|
||||
if (movement.y + center.y > center.y * 2)
|
||||
movement.x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
movement.y = screen_dim.y - center.y;
|
||||
if (movement.y + center.y < 0)
|
||||
movement.y = 0;
|
||||
}
|
||||
|
||||
if (sqrt(pow(movement.x, 2) + pow(movement.y, 2)) < local_fov_change)
|
||||
{ // sqrt of movment x and y ^ 2, handles fov math
|
||||
local_fov_change = sqrt(pow(movement.x, 2) + pow(movement.y, 2));
|
||||
mouse_movement.x = movement.x;
|
||||
mouse_movement.y = movement.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PAD::GET_DISABLED_CONTROL_NORMAL(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
static bool update_time_now = true;
|
||||
static std::chrono::system_clock::time_point current_time;
|
||||
Vector3 camera_target = aim_lock - CAM::GET_GAMEPLAY_CAM_COORD();
|
||||
float camera_heading = atan2f(camera_target.x, camera_target.y) * 180.0 / 3.14159265358979323846;
|
||||
float magnitude = sqrtf(camera_target.x * camera_target.x + camera_target.y * camera_target.y
|
||||
+ camera_target.z * camera_target.z);
|
||||
|
||||
if (update_time_now)
|
||||
float camera_pitch = asinf(camera_target.z / magnitude) * 180.0 / 3.14159265358979323846;
|
||||
float self_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
float self_pitch = ENTITY::GET_ENTITY_PITCH(self::ped);
|
||||
if (camera_heading >= 0.0 && camera_heading <= 180.0)
|
||||
{
|
||||
current_time = std::chrono::system_clock::now();
|
||||
update_time_now = false; //lockout
|
||||
camera_heading = 360.0 - camera_heading;
|
||||
}
|
||||
|
||||
std::chrono::duration<double> elapsed_time = std::chrono::system_clock::now() - current_time;
|
||||
if (elapsed_time.count() > 0.f)
|
||||
else if (camera_heading <= -0.0 && camera_heading >= -180.0)
|
||||
{
|
||||
INPUT mouse_handle; // MOUSEINPUT mi;
|
||||
mouse_handle.type = INPUT_MOUSE;
|
||||
mouse_handle.mi.dwFlags = MOUSEEVENTF_MOVE; // Type = Mouse movement, and the event is emulating the mouse movement
|
||||
|
||||
// Update the mouse by moving it with how much we need / smoothing speed
|
||||
mouse_handle.mi.dx = mouse_movement.x / (g.weapons.aimbot.smoothing ? g.weapons.aimbot.smoothing_speed : 2);
|
||||
mouse_handle.mi.dy = mouse_movement.y / (g.weapons.aimbot.smoothing ? g.weapons.aimbot.smoothing_speed : 2);
|
||||
SendInput(1, &mouse_handle, sizeof(mouse_handle)); //handles the input
|
||||
|
||||
//Reset our variables
|
||||
mouse_movement.x = 0, mouse_movement.y = 0;
|
||||
update_time_now = true; //reset our time
|
||||
camera_heading = -camera_heading;
|
||||
}
|
||||
if (CAM::GET_FOLLOW_PED_CAM_VIEW_MODE() == 4)
|
||||
{
|
||||
CAM::SET_FIRST_PERSON_SHOOTER_CAMERA_HEADING(camera_heading - self_heading);
|
||||
CAM::SET_FIRST_PERSON_SHOOTER_CAMERA_PITCH(camera_pitch - self_pitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAM::SET_GAMEPLAY_CAM_RELATIVE_HEADING(camera_heading - self_heading);
|
||||
CAM::SET_GAMEPLAY_CAM_RELATIVE_PITCH(camera_pitch - self_pitch, 1065353216);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
aimbot g_aimbot("aimbot", "VIEW_OVERLAY_AIMBOT", "BACKEND_LOOPED_WEAPONS_AIMBOT_DESC", g.weapons.aimbot.enable);
|
||||
bool_command g_smoothing("smoothing", "BACKEND_LOOPED_WEAPONS_SMOOTHING", "BACKEND_LOOPED_WEAPONS_SMOOTHING_DESC", g.weapons.aimbot.smoothing);
|
||||
bool_command g_aimbot_on_player("aimatplayer", "PLAYER", "BACKEND_LOOPED_WEAPONS_AIM_AT_PLAYER_DESC", g.weapons.aimbot.on_player);
|
||||
bool_command
|
||||
g_aimbot_on_player("aimatplayer", "PLAYER", "BACKEND_LOOPED_WEAPONS_AIM_AT_PLAYER_DESC", g.weapons.aimbot.on_player);
|
||||
bool_command g_aimbot_on_npc("aimatnpc", "NPC", "BACKEND_LOOPED_WEAPONS_AIM_AT_NPC_DESC", g.weapons.aimbot.on_npc);
|
||||
bool_command g_aimbot_on_police("aimatpolice", "POLICE", "BACKEND_LOOPED_WEAPONS_AIM_AT_POLICE_DESC", g.weapons.aimbot.on_police);
|
||||
bool_command g_aimbot_on_enemy("aimatenemy", "BACKEND_LOOPED_WEAPONS_AIM_AT_ENEMY", "BACKEND_LOOPED_WEAPONS_AIM_AT_ENEMY_DESC", g.weapons.aimbot.on_enemy);
|
||||
bool_command
|
||||
g_aimbot_on_police("aimatpolice", "POLICE", "BACKEND_LOOPED_WEAPONS_AIM_AT_POLICE_DESC", g.weapons.aimbot.on_police);
|
||||
bool_command g_aimbot_on_enemy("aimatenemy", "BACKEND_LOOPED_WEAPONS_AIM_AT_ENEMY", "BACKEND_LOOPED_WEAPONS_AIM_AT_ENEMY_DESC",
|
||||
g.weapons.aimbot.on_enemy);
|
||||
}
|
||||
|
@ -828,8 +828,6 @@ namespace big
|
||||
struct aimbot
|
||||
{
|
||||
bool enable = false;
|
||||
bool smoothing = true;
|
||||
float smoothing_speed = 2.f;
|
||||
bool on_player = true;
|
||||
bool on_enemy = false;
|
||||
bool on_police = false;
|
||||
|
@ -182,14 +182,6 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"aimatenemy">();
|
||||
|
||||
components::command_checkbox<"smoothing">();
|
||||
if (g.weapons.aimbot.smoothing)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(220);
|
||||
ImGui::SliderFloat("VIEW_WEAPON_AIM_SPEED"_T.data(), &g.weapons.aimbot.smoothing_speed, 1.f, 12.f, "%.1f");
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
ImGui::PushItemWidth(350);
|
||||
ImGui::SliderFloat("VIEW_WEAPON_AIM_FOV"_T.data(), &g.weapons.aimbot.fov, 1.f, 360.f, "%.0f");
|
||||
ImGui::SliderFloat("VIEW_SELF_CUSTOM_TELEPORT_DISTANCE"_T.data(), &g.weapons.aimbot.distance, 1.f, 1000.f, "%.0f");
|
||||
|
Reference in New Issue
Block a user