RUST Симуляция Пули | Нужна помощь

Начинающий
Статус
Оффлайн
Регистрация
5 Янв 2023
Сообщения
88
Реакции[?]
10
Поинты[?]
1K
Эррорит на PlayerAttack, мол это нестатичесская ссылка

C++:
#include <map>
#include "Cheat/Game/game.h"
namespace a {
    double CalcBulletDrop(double height, double DepthPlayerTarget, float velocity, float gravity) {
        double pitch = (Vector3::my_atan2(height, DepthPlayerTarget));
        double BulletVelocityXY = velocity * Vector3::my_cos(pitch);
        double Time = DepthPlayerTarget / BulletVelocityXY;
        double TotalVerticalDrop = (0.5f * gravity * Time * Time);
        return TotalVerticalDrop * 10;
    }
    void Prediction(Vector3 local, Vector3& target, Vector3 targetvel, float bulletspeed, float gravity) {
        float Dist = Math::Distance_3D(target, local);
        float BulletTime = Dist / bulletspeed;
        Vector3 vel = Vector3(targetvel.x, 0, targetvel.z) * 0.9f;
        Vector3 PredictVel = vel * BulletTime;
        target += PredictVel;
        double height = target.y - local.y;
        Vector3 dir = target - local;
        float DepthPlayerTarget = Vector3::my_sqrt((dir.x * dir.x) + (dir.z * dir.z));
        float drop = CalcBulletDrop(height, DepthPlayerTarget, bulletspeed, gravity);
        target.y += drop;
    }
    Vector3 get_aim_point(float speed, float gravity) {
        Vector3 ret = reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->get_bone_pos(head);
        Prediction(LocalPlayer::Entity()->get_bone_pos(head), ret, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->newVelocity(), speed, gravity);
        return ret;
    }
}
static float GetFov(BasePlayer* Entity, BoneList Bone, BasePlayer* player) {
    Vector2 ScreenPos;
    if (!utils::w2s(Entity->get_bone_pos(Bone), ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetFovHeli(Vector3 pos) {
    Vector2 ScreenPos;
    if (!utils::w2s(pos, ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetGravity(int ammoid) {
    switch (ammoid) {
    case 14241751:
        return 1.f;
    case -1234735557:
        return 0.75f;
    case 215754713:
        return 0.75f;
    case -1023065463:
        return 0.5f;
    case -2097376851:
        return 0.75f;
    case -1321651331:
        return 1.25f;
    default:
        return 1.f;
    }
}
float GetBulletSpeed() {
    Item* active = LocalPlayer::Entity()->GetActiveWeapon();
    Weapon tar = active->Info();
    int ammo = active->LoadedAmmo();
    if (ammo == 0) return vars::weapons::fast_bullets ? tar.ammo[0].speed * 1.2 + vars::stuff::testFloat : tar.ammo[0].speed + vars::stuff::testFloat;
    for (Ammo am : tar.ammo) {
        for (int id : am.id) {
            if (id == ammo) {
                return vars::weapons::fast_bullets ? am.speed * 1.2 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
            }
        }
        if (am.id[0] == 0) return vars::weapons::fast_bullets ? am.speed * 1.2 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
    }
    return vars::weapons::fast_bullets ? 250.f * 1 + vars::stuff::testFloat : 250.f + vars::stuff::testFloat;
}

void StepConstant(Vector2& angles) {
    bool smooth = vars::combat::smooth;
    Vector2 angles_step = angles - LocalPlayer::Entity()->viewangles();
    Math::Normalize(angles_step.x, angles_step.y);

    if (smooth) {
        float factor_pitch = (vars::combat::smooth_factor / 10.f);
        if (angles_step.x < 0.f) {
            if (factor_pitch > std::abs(angles_step.x)) {
                factor_pitch = std::abs(angles_step.x);
            }
            angles.x = LocalPlayer::Entity()->viewangles().x - factor_pitch;
        }
        else {
            if (factor_pitch > angles_step.x) {
                factor_pitch = angles_step.x;
            }
            angles.x = LocalPlayer::Entity()->viewangles().x + factor_pitch;
        }
    }
    if (smooth) {
        float factor_yaw = (vars::combat::smooth_factor / 10.f);
        if (angles_step.y < 0.f) {
            if (factor_yaw > std::abs(angles_step.y)) {
                factor_yaw = std::abs(angles_step.y);
            }
            angles.y = LocalPlayer::Entity()->viewangles().y - factor_yaw;
        }
        else {
            if (factor_yaw > angles_step.y) {
                factor_yaw = angles_step.y;
            }
            angles.y = LocalPlayer::Entity()->viewangles().y + factor_yaw;
        }
    }
}
void projectile_sim(BasePlayer* player, BoneList Bone, Vector3 position, Vector3 target, float speed) {
    float gravity = GetGravity(14241751);
    float bullet_speed = GetBulletSpeed();
    Vector3 aim_point = a::get_aim_point(bullet_speed, gravity);

    Vector3 start_pos = position;
    Vector3 bullet_dir = aim_point - start_pos;
    float bullet_distance = bullet_dir.magnitude();
    float bullet_time = bullet_distance / speed;
    Vector3 bullet_velocity = bullet_dir.normalized() * speed;
    float bullet_gravity = 9.81f;
    

    Vector3 current_pos = start_pos;
    Vector3 current_vel = bullet_velocity;
    for (int i = 0; i < 1000; i++) {
        float time_step = bullet_time / 1000.0f;
        Vector3 gravity_step = Vector3(0.0f, -bullet_gravity, 0.0f) * time_step;

        current_vel += gravity_step;
        current_pos += current_vel * time_step;

        float current_distance = (current_pos - position).magnitude();
        if (current_distance > bullet_distance) {
            break;
        }

        float fov = GetFov(player, Bone, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer));
        if (fov < vars::combat::fov) {
            PlayerAttack::attack(player);
            break;
        }
    }
    float bullet_speed = GetBulletSpeed();
    if (bullet_speed == 0.f) {
        return;
    }
}

void do_aimbot(BasePlayer* player) {
    if (!LocalPlayer::Entity() || !player) { return; }
    if (!LocalPlayer::Entity()->GetActiveWeapon() || player->IsDestroyed()) { return; }
    bool long_neck = vars::misc::long_neck && GetAsyncKeyState(vars::keys::longneck);
    Vector3 local = long_neck ? LocalPlayer::Entity()->get_bone_pos(head) + Vector3(0, 1.15, 0) : LocalPlayer::Entity()->get_bone_pos(head);
    Vector3 target = vars::combat::bodyaim ? player->get_bone_pos(spine1) : player->get_bone_pos(head);
    a::Prediction(local, target, player->newVelocity(), GetBulletSpeed(), GetGravity(LocalPlayer::Entity()->GetActiveWeapon()->LoadedAmmo()));
    Vector2 Offset = Math::CalcAngle(local, target) - LocalPlayer::Entity()->viewangles();
    Math::Normalize(Offset.y, Offset.x);
    Vector2 AngleToAim = LocalPlayer::Entity()->viewangles() + Offset;
    if (vars::combat::smooth) {
        StepConstant(AngleToAim);
    }
    Math::Normalize(AngleToAim.y, AngleToAim.x);
    LocalPlayer::Entity()->set_viewangles(AngleToAim);
}
 
Начинающий
Статус
Оффлайн
Регистрация
9 Июн 2021
Сообщения
106
Реакции[?]
21
Поинты[?]
6K
Эррорит на PlayerAttack, мол это нестатичесская ссылка

C++:
#include <map>
#include "Cheat/Game/game.h"
namespace a {
    double CalcBulletDrop(double height, double DepthPlayerTarget, float velocity, float gravity) {
        double pitch = (Vector3::my_atan2(height, DepthPlayerTarget));
        double BulletVelocityXY = velocity * Vector3::my_cos(pitch);
        double Time = DepthPlayerTarget / BulletVelocityXY;
        double TotalVerticalDrop = (0.5f * gravity * Time * Time);
        return TotalVerticalDrop * 10;
    }
    void Prediction(Vector3 local, Vector3& target, Vector3 targetvel, float bulletspeed, float gravity) {
        float Dist = Math::Distance_3D(target, local);
        float BulletTime = Dist / bulletspeed;
        Vector3 vel = Vector3(targetvel.x, 0, targetvel.z) * 0.9f;
        Vector3 PredictVel = vel * BulletTime;
        target += PredictVel;
        double height = target.y - local.y;
        Vector3 dir = target - local;
        float DepthPlayerTarget = Vector3::my_sqrt((dir.x * dir.x) + (dir.z * dir.z));
        float drop = CalcBulletDrop(height, DepthPlayerTarget, bulletspeed, gravity);
        target.y += drop;
    }
    Vector3 get_aim_point(float speed, float gravity) {
        Vector3 ret = reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->get_bone_pos(head);
        Prediction(LocalPlayer::Entity()->get_bone_pos(head), ret, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->newVelocity(), speed, gravity);
        return ret;
    }
}
static float GetFov(BasePlayer* Entity, BoneList Bone, BasePlayer* player) {
    Vector2 ScreenPos;
    if (!utils::w2s(Entity->get_bone_pos(Bone), ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetFovHeli(Vector3 pos) {
    Vector2 ScreenPos;
    if (!utils::w2s(pos, ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetGravity(int ammoid) {
    switch (ammoid) {
    case 14241751:
        return 1.f;
    case -1234735557:
        return 0.75f;
    case 215754713:
        return 0.75f;
    case -1023065463:
        return 0.5f;
    case -2097376851:
        return 0.75f;
    case -1321651331:
        return 1.25f;
    default:
        return 1.f;
    }
}
float GetBulletSpeed() {
    Item* active = LocalPlayer::Entity()->GetActiveWeapon();
    Weapon tar = active->Info();
    int ammo = active->LoadedAmmo();
    if (ammo == 0) return vars::weapons::fast_bullets ? tar.ammo[0].speed * 1.2 + vars::stuff::testFloat : tar.ammo[0].speed + vars::stuff::testFloat;
    for (Ammo am : tar.ammo) {
        for (int id : am.id) {
            if (id == ammo) {
                return vars::weapons::fast_bullets ? am.speed * 1.2 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
            }
        }
        if (am.id[0] == 0) return vars::weapons::fast_bullets ? am.speed * 1.2 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
    }
    return vars::weapons::fast_bullets ? 250.f * 1 + vars::stuff::testFloat : 250.f + vars::stuff::testFloat;
}

void StepConstant(Vector2& angles) {
    bool smooth = vars::combat::smooth;
    Vector2 angles_step = angles - LocalPlayer::Entity()->viewangles();
    Math::Normalize(angles_step.x, angles_step.y);

    if (smooth) {
        float factor_pitch = (vars::combat::smooth_factor / 10.f);
        if (angles_step.x < 0.f) {
            if (factor_pitch > std::abs(angles_step.x)) {
                factor_pitch = std::abs(angles_step.x);
            }
            angles.x = LocalPlayer::Entity()->viewangles().x - factor_pitch;
        }
        else {
            if (factor_pitch > angles_step.x) {
                factor_pitch = angles_step.x;
            }
            angles.x = LocalPlayer::Entity()->viewangles().x + factor_pitch;
        }
    }
    if (smooth) {
        float factor_yaw = (vars::combat::smooth_factor / 10.f);
        if (angles_step.y < 0.f) {
            if (factor_yaw > std::abs(angles_step.y)) {
                factor_yaw = std::abs(angles_step.y);
            }
            angles.y = LocalPlayer::Entity()->viewangles().y - factor_yaw;
        }
        else {
            if (factor_yaw > angles_step.y) {
                factor_yaw = angles_step.y;
            }
            angles.y = LocalPlayer::Entity()->viewangles().y + factor_yaw;
        }
    }
}
void projectile_sim(BasePlayer* player, BoneList Bone, Vector3 position, Vector3 target, float speed) {
    float gravity = GetGravity(14241751);
    float bullet_speed = GetBulletSpeed();
    Vector3 aim_point = a::get_aim_point(bullet_speed, gravity);

    Vector3 start_pos = position;
    Vector3 bullet_dir = aim_point - start_pos;
    float bullet_distance = bullet_dir.magnitude();
    float bullet_time = bullet_distance / speed;
    Vector3 bullet_velocity = bullet_dir.normalized() * speed;
    float bullet_gravity = 9.81f;
   

    Vector3 current_pos = start_pos;
    Vector3 current_vel = bullet_velocity;
    for (int i = 0; i < 1000; i++) {
        float time_step = bullet_time / 1000.0f;
        Vector3 gravity_step = Vector3(0.0f, -bullet_gravity, 0.0f) * time_step;

        current_vel += gravity_step;
        current_pos += current_vel * time_step;

        float current_distance = (current_pos - position).magnitude();
        if (current_distance > bullet_distance) {
            break;
        }

        float fov = GetFov(player, Bone, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer));
        if (fov < vars::combat::fov) {
            PlayerAttack::attack(player);
            break;
        }
    }
    float bullet_speed = GetBulletSpeed();
    if (bullet_speed == 0.f) {
        return;
    }
}

void do_aimbot(BasePlayer* player) {
    if (!LocalPlayer::Entity() || !player) { return; }
    if (!LocalPlayer::Entity()->GetActiveWeapon() || player->IsDestroyed()) { return; }
    bool long_neck = vars::misc::long_neck && GetAsyncKeyState(vars::keys::longneck);
    Vector3 local = long_neck ? LocalPlayer::Entity()->get_bone_pos(head) + Vector3(0, 1.15, 0) : LocalPlayer::Entity()->get_bone_pos(head);
    Vector3 target = vars::combat::bodyaim ? player->get_bone_pos(spine1) : player->get_bone_pos(head);
    a::Prediction(local, target, player->newVelocity(), GetBulletSpeed(), GetGravity(LocalPlayer::Entity()->GetActiveWeapon()->LoadedAmmo()));
    Vector2 Offset = Math::CalcAngle(local, target) - LocalPlayer::Entity()->viewangles();
    Math::Normalize(Offset.y, Offset.x);
    Vector2 AngleToAim = LocalPlayer::Entity()->viewangles() + Offset;
    if (vars::combat::smooth) {
        StepConstant(AngleToAim);
    }
    Math::Normalize(AngleToAim.y, AngleToAim.x);
    LocalPlayer::Entity()->set_viewangles(AngleToAim);
}
Так может PlayerAttack класс тогда скинешь?
 
Начинающий
Статус
Оффлайн
Регистрация
5 Янв 2023
Сообщения
88
Реакции[?]
10
Поинты[?]
1K
Так может PlayerAttack класс тогда скинешь?
эту часть я пофиксил, но столкнулся с тем, что предикт не может высчетать нормально траекторию

при стрельбе чит рисует визуальный предикт в одном месте, а пули летят в другое.

C++:
#include <map>
namespace a {
    double CalcBulletDrop(double height, double DepthPlayerTarget, float velocity, float gravity) {
        double pitch = (Vector3::my_atan2(height, DepthPlayerTarget));
        double BulletVelocityXY = velocity * Vector3::my_cos(pitch);
        double bulletrandom = (BulletVelocityXY / gravity);
        double Time = DepthPlayerTarget / BulletVelocityXY;
        double TotalVerticalDrop = (0.35f * gravity * Time * Time);
        return TotalVerticalDrop * 10;
    }
    Vector3 Prediction(Vector3 local, Vector3 target, Vector3 targetvel, float bulletspeed, float gravity) {
        float bullet = (bulletspeed + vars::weapons::fast_bullets / gravity);
        float Dist = Math::Distance_3D(target, local);
        float BulletTime = Dist / bulletspeed;
        Vector3 vel = Vector3(targetvel.x, 0, targetvel.z) * 0.9f;
        Vector3 PredictVel = vel * BulletTime;
        target += PredictVel;
        double height = target.y - local.y;
        Vector3 dir = target - local;
        float DepthPlayerTarget = Vector3::my_sqrt((dir.x * dir.x) + (dir.z * dir.z));
        float drop = CalcBulletDrop(height, DepthPlayerTarget, bulletspeed, gravity);
        target.y += drop;
        return target;
    }
    Vector3 get_aim_point(float speed, float gravity) {
        Vector3 ret = reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->get_bone_pos(head);
        Prediction(LocalPlayer::Entity()->get_bone_pos(head), ret, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->newVelocity(), speed, gravity);
        return ret;
    }
}
float GetFov(BasePlayer* Entity, BoneList Bone) {
    Vector2 ScreenPos;
    if (!utils::w2s(Entity->get_bone_pos(Bone), ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetFovHeli(Vector3 pos) {
    Vector2 ScreenPos;
    if (!utils::w2s(pos, ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetGravity(int ammoid) {
    switch (ammoid) {
    case 14241751: //fire
        return 1.f;
    case -1234735557: //wooden
        return 0.75f;
    case 215754713: //bone
        return 0.75f;
    case -1023065463: //high velocity
        return 0.5f;
    case -2097376851: //nails
        return 0.75f;
    case -1321651331: //expl 5.56
        return 1.25f;
    default:
        return 1.f;
    }
}
float GetBulletSpeed() {
    Item* active = LocalPlayer::Entity()->GetActiveWeapon();
    Weapon tar = active->Info();
    int ammo = active->LoadedAmmo();
    if (ammo == 0) return vars::weapons::fast_bullets ? tar.ammo[0].speed * 1.5 + vars::stuff::testFloat : tar.ammo[0].speed + vars::stuff::testFloat;
    for (Ammo am : tar.ammo) {
        for (int id : am.id) {
            if (id == ammo) {
                return vars::weapons::fast_bullets ? am.speed * 1.5 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
            }
        }
        if (am.id[0] == 0) return vars::weapons::fast_bullets ? am.speed * 1.5 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
    }
    return vars::weapons::fast_bullets ? 500.f * 1.5 + vars::stuff::testFloat : 500.f + vars::stuff::testFloat;
}

void StepConstant(Vector2& angles) {
    bool smooth = vars::combat::smooth;
    Vector2 angles_step = angles - LocalPlayer::Entity()->viewangles();
    Math::Normalize(angles_step.x, angles_step.y);

    if (smooth) {
        float factor_pitch = (vars::combat::smooth_factor / 10.f);
        if (angles_step.x < 0.f) {
            if (factor_pitch > std::abs(angles_step.x)) {
                factor_pitch = std::abs(angles_step.x);
            }
            angles.x = LocalPlayer::Entity()->viewangles().x - factor_pitch;
        }
        else {
            if (factor_pitch > angles_step.x) {
                factor_pitch = angles_step.x;
            }
            angles.x = LocalPlayer::Entity()->viewangles().x + factor_pitch;
        }
    }
    if (smooth) {
        float factor_yaw = (vars::combat::smooth_factor / 10.f);
        if (angles_step.y < 0.f) {
            if (factor_yaw > std::abs(angles_step.y)) {
                factor_yaw = std::abs(angles_step.y);
            }
            angles.y = LocalPlayer::Entity()->viewangles().y - factor_yaw;
        }
        else {
            if (factor_yaw > angles_step.y) {
                factor_yaw = angles_step.y;
            }
            angles.y = LocalPlayer::Entity()->viewangles().y + factor_yaw;
        }
    }
}

void projectile_sim(BasePlayer* player, BoneList Bone, Vector3 position, Vector3 target, float speed) {
    float gravity = GetGravity(14241751);
    float bullet_speed = GetBulletSpeed();
    Vector3 aim_point = a::get_aim_point(bullet_speed, gravity);

    Vector3 start_pos = position;
    Vector3 bullet_dir = aim_point - start_pos;
    float bullet_distance = bullet_dir.magnitude();
    float bullet_time = bullet_distance / speed;
    Vector3 bullet_velocity = bullet_dir.normalized() * speed;
    float bullet_gravity = 0.35f;


    Vector3 current_pos = start_pos;
    Vector3 current_vel = bullet_velocity;
    for (int i = 0; i < 1000; i++) {
        float time_step = bullet_time / 1000.0f;
        Vector3 gravity_step = Vector3(0.0f, -bullet_gravity, 0.0f) * time_step;

        current_vel += gravity_step;
        current_pos += current_vel * time_step;

        float fov = GetFov(player, Bone);
        auto held = LocalPlayer::Entity()->GetHeldEntity<BaseProjectile>();
        if (!held->Empty()) {
            if (fov < vars::combat::fov) {
                held->LaunchProjectile();
                break;
            }
        }
    }
}

void do_aimbot(BasePlayer* player) {
    if (!LocalPlayer::Entity() || !player) { return; }
    if (!LocalPlayer::Entity()->GetActiveWeapon() || player->IsDestroyed()) { return; }
    bool long_neck = vars::misc::long_neck && GetAsyncKeyState(vars::keys::longneck);
    Vector3 local = long_neck ? LocalPlayer::Entity()->get_bone_pos(head) + Vector3(0, 1.15, 0) : LocalPlayer::Entity()->get_bone_pos(head);
    Vector3 target = vars::combat::bodyaim ? player->get_bone_pos(spine1) : player->get_bone_pos(head);
    Vector3 pred_target = a::Prediction(local, target, player->newVelocity(), GetBulletSpeed(), GetGravity(LocalPlayer::Entity()->GetActiveWeapon()->LoadedAmmo()));
    Vector2 Offset = Math::CalcAngle(local, pred_target) - LocalPlayer::Entity()->viewangles();
    Math::Normalize(Offset.y, Offset.x);
    Vector2 AngleToAim = LocalPlayer::Entity()->viewangles() + Offset;
    float speed = vars::weapons::fast_bullets ? GetBulletSpeed() * 1.5f : GetBulletSpeed();
    projectile_sim(player, head, local, pred_target, speed);

    if (vars::combat::smooth) {
        StepConstant(AngleToAim);
    }
    Math::Normalize(AngleToAim.y, AngleToAim.x);
    LocalPlayer::Entity()->set_viewangles(AngleToAim);
}
 
Последнее редактирование:
Чайний гриб
Пользователь
Статус
Оффлайн
Регистрация
28 Окт 2021
Сообщения
329
Реакции[?]
31
Поинты[?]
24K
эту часть я пофиксил, но столкнулся с тем, что предикт не может высчетать нормально траекторию

при стрельбе чит рисует визуальный предикт в одном месте, а пули летят в другое.

C++:
#include <map>
namespace a {
    double CalcBulletDrop(double height, double DepthPlayerTarget, float velocity, float gravity) {
        double pitch = (Vector3::my_atan2(height, DepthPlayerTarget));
        double BulletVelocityXY = velocity * Vector3::my_cos(pitch);
        double bulletrandom = (BulletVelocityXY / gravity);
        double Time = DepthPlayerTarget / BulletVelocityXY;
        double TotalVerticalDrop = (0.35f * gravity * Time * Time);
        return TotalVerticalDrop * 10;
    }
    Vector3 Prediction(Vector3 local, Vector3 target, Vector3 targetvel, float bulletspeed, float gravity) {
        float bullet = (bulletspeed + vars::weapons::fast_bullets / gravity);
        float Dist = Math::Distance_3D(target, local);
        float BulletTime = Dist / bulletspeed;
        Vector3 vel = Vector3(targetvel.x, 0, targetvel.z) * 0.9f;
        Vector3 PredictVel = vel * BulletTime;
        target += PredictVel;
        double height = target.y - local.y;
        Vector3 dir = target - local;
        float DepthPlayerTarget = Vector3::my_sqrt((dir.x * dir.x) + (dir.z * dir.z));
        float drop = CalcBulletDrop(height, DepthPlayerTarget, bulletspeed, gravity);
        target.y += drop;
        return target;
    }
    Vector3 get_aim_point(float speed, float gravity) {
        Vector3 ret = reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->get_bone_pos(head);
        Prediction(LocalPlayer::Entity()->get_bone_pos(head), ret, reinterpret_cast<BasePlayer*>(vars::stor::closestPlayer)->newVelocity(), speed, gravity);
        return ret;
    }
}
float GetFov(BasePlayer* Entity, BoneList Bone) {
    Vector2 ScreenPos;
    if (!utils::w2s(Entity->get_bone_pos(Bone), ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetFovHeli(Vector3 pos) {
    Vector2 ScreenPos;
    if (!utils::w2s(pos, ScreenPos)) return 1000.f;
    return Math::Distance_2D(Vector2(vars::stuff::ScreenWidth / 2, vars::stuff::ScreenHeight / 2), ScreenPos);
}
float GetGravity(int ammoid) {
    switch (ammoid) {
    case 14241751: //fire
        return 1.f;
    case -1234735557: //wooden
        return 0.75f;
    case 215754713: //bone
        return 0.75f;
    case -1023065463: //high velocity
        return 0.5f;
    case -2097376851: //nails
        return 0.75f;
    case -1321651331: //expl 5.56
        return 1.25f;
    default:
        return 1.f;
    }
}
float GetBulletSpeed() {
    Item* active = LocalPlayer::Entity()->GetActiveWeapon();
    Weapon tar = active->Info();
    int ammo = active->LoadedAmmo();
    if (ammo == 0) return vars::weapons::fast_bullets ? tar.ammo[0].speed * 1.5 + vars::stuff::testFloat : tar.ammo[0].speed + vars::stuff::testFloat;
    for (Ammo am : tar.ammo) {
        for (int id : am.id) {
            if (id == ammo) {
                return vars::weapons::fast_bullets ? am.speed * 1.5 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
            }
        }
        if (am.id[0] == 0) return vars::weapons::fast_bullets ? am.speed * 1.5 + vars::stuff::testFloat : am.speed + vars::stuff::testFloat;
    }
    return vars::weapons::fast_bullets ? 500.f * 1.5 + vars::stuff::testFloat : 500.f + vars::stuff::testFloat;
}

void StepConstant(Vector2& angles) {
    bool smooth = vars::combat::smooth;
    Vector2 angles_step = angles - LocalPlayer::Entity()->viewangles();
    Math::Normalize(angles_step.x, angles_step.y);

    if (smooth) {
        float factor_pitch = (vars::combat::smooth_factor / 10.f);
        if (angles_step.x < 0.f) {
            if (factor_pitch > std::abs(angles_step.x)) {
                factor_pitch = std::abs(angles_step.x);
            }
            angles.x = LocalPlayer::Entity()->viewangles().x - factor_pitch;
        }
        else {
            if (factor_pitch > angles_step.x) {
                factor_pitch = angles_step.x;
            }
            angles.x = LocalPlayer::Entity()->viewangles().x + factor_pitch;
        }
    }
    if (smooth) {
        float factor_yaw = (vars::combat::smooth_factor / 10.f);
        if (angles_step.y < 0.f) {
            if (factor_yaw > std::abs(angles_step.y)) {
                factor_yaw = std::abs(angles_step.y);
            }
            angles.y = LocalPlayer::Entity()->viewangles().y - factor_yaw;
        }
        else {
            if (factor_yaw > angles_step.y) {
                factor_yaw = angles_step.y;
            }
            angles.y = LocalPlayer::Entity()->viewangles().y + factor_yaw;
        }
    }
}

void projectile_sim(BasePlayer* player, BoneList Bone, Vector3 position, Vector3 target, float speed) {
    float gravity = GetGravity(14241751);
    float bullet_speed = GetBulletSpeed();
    Vector3 aim_point = a::get_aim_point(bullet_speed, gravity);

    Vector3 start_pos = position;
    Vector3 bullet_dir = aim_point - start_pos;
    float bullet_distance = bullet_dir.magnitude();
    float bullet_time = bullet_distance / speed;
    Vector3 bullet_velocity = bullet_dir.normalized() * speed;
    float bullet_gravity = 0.35f;


    Vector3 current_pos = start_pos;
    Vector3 current_vel = bullet_velocity;
    for (int i = 0; i < 1000; i++) {
        float time_step = bullet_time / 1000.0f;
        Vector3 gravity_step = Vector3(0.0f, -bullet_gravity, 0.0f) * time_step;

        current_vel += gravity_step;
        current_pos += current_vel * time_step;

        float fov = GetFov(player, Bone);
        auto held = LocalPlayer::Entity()->GetHeldEntity<BaseProjectile>();
        if (!held->Empty()) {
            if (fov < vars::combat::fov) {
                held->LaunchProjectile();
                break;
            }
        }
    }
}

void do_aimbot(BasePlayer* player) {
    if (!LocalPlayer::Entity() || !player) { return; }
    if (!LocalPlayer::Entity()->GetActiveWeapon() || player->IsDestroyed()) { return; }
    bool long_neck = vars::misc::long_neck && GetAsyncKeyState(vars::keys::longneck);
    Vector3 local = long_neck ? LocalPlayer::Entity()->get_bone_pos(head) + Vector3(0, 1.15, 0) : LocalPlayer::Entity()->get_bone_pos(head);
    Vector3 target = vars::combat::bodyaim ? player->get_bone_pos(spine1) : player->get_bone_pos(head);
    Vector3 pred_target = a::Prediction(local, target, player->newVelocity(), GetBulletSpeed(), GetGravity(LocalPlayer::Entity()->GetActiveWeapon()->LoadedAmmo()));
    Vector2 Offset = Math::CalcAngle(local, pred_target) - LocalPlayer::Entity()->viewangles();
    Math::Normalize(Offset.y, Offset.x);
    Vector2 AngleToAim = LocalPlayer::Entity()->viewangles() + Offset;
    float speed = vars::weapons::fast_bullets ? GetBulletSpeed() * 1.5f : GetBulletSpeed();
    projectile_sim(player, head, local, pred_target, speed);

    if (vars::combat::smooth) {
        StepConstant(AngleToAim);
    }
    Math::Normalize(AngleToAim.y, AngleToAim.x);
    LocalPlayer::Entity()->set_viewangles(AngleToAim);
}
ну так ты может в "визуальном предикте" юзать начнешь другой предикт
 
Забаненный
Статус
Оффлайн
Регистрация
25 Мар 2023
Сообщения
6
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
может адекватно обратишься к функции attack?
 
Сверху Снизу