JS-скрипт [v4c]Predicted target hitbox(не мой код) спс челу с синего форума

Начинающий
Статус
Оффлайн
Регистрация
6 Окт 2021
Сообщения
64
Реакции[?]
6
Поинты[?]
4K
[v4c]Predicted target hitbox(не мой код) 1641935850464.png
цвет менять в коде
JavaScript:
UI.AddSubTab(['Rage', 'SUBTAB_MGR'], 'Predicted hitbox')
UI.AddCheckbox(['Rage', 'Predicted hitbox', 'Predicted hitbox'], "Predicted targeted hitbox");
Render.FadedCircle = function(x, y, radius, color) {
    const step = color[3] / radius;

    for (var i = 0; i <= radius; i++) {
        Render.FilledCircle(x, y, i, [color[0], color[1], color[2], color[3] - step * i]);
    }
}
function radToDeg(radians) {
    return radians * 180 / Math.PI;
}
var Cache = {
    values: []
};

Cache.InvokeCallback = function(label, state, func, args) {
    if (this.values[label] == null)
        this.values[label] = null;

    if (this.values[label] === state)
        return;

    this.values[label] = state;

    func.apply(null, args);
}

var Targeting = {
    currentData: { target: null, hitbox: 0, last_hitbox: -1 },

    hitboxMap: [6, 5, 4, 3, 2],

    HITBOX: {
        "UNSURE": -1,
        "BODY": 3,
        "HEAD": 0
    }
};

Targeting.FindOptimalTarget = function() {
    const players = Entity.GetEnemies();
    const me = Entity.GetLocalPlayer();

    if (!me || !Entity.IsAlive(me))
        return null;

    const eye_position = Entity.GetEyePosition(me);
    const view_angles = Local.GetViewAngles();

    var data = {fov: 180, id: null};

    for (var i = 0; i < players.length; i++) {
        const e = players[i];

        if (!Entity.IsAlive(e) || Entity.IsDormant(e))
            continue;

        const head_position = Entity.GetHitboxPosition(e, 0);
        const sub = [head_position[0] - eye_position[0], head_position[1] - eye_position[1], head_position[2] - eye_position[2]];

        const pitch = -radToDeg(Math.atan2(sub[2], Math.sqrt(sub[0] ** 2 + sub[1] ** 2)));
        const yaw = radToDeg(Math.atan2(sub[1], sub[0]));

        const delta_x = Math.abs(view_angles[0] - pitch);
        const delta_y = Math.abs(view_angles[1] % 360 - yaw % 360) % 360;

        const fov = Math.sqrt(delta_x * delta_x + delta_y * delta_y);

        if (fov < data.fov) {
            data.fov = fov;
            data.id = e;
        }
    }

    return data.id;
}

Targeting.GetNextTargetedHitbox = function(e) {
    if (!e)
        return this.HITBOX.UNSURE;

    const me = Entity.GetLocalPlayer();
    const wpn = Entity.GetWeapon(me);

    if (!me || !wpn)
        return this.HITBOX.UNSURE;

    const eye_position = Entity.GetEyePosition(me);

    //const wpn_id = Entity.GetProp(wpn, "CBaseAttributableItem", "m_iItemDefinitionIndex") & 0xFFFF;
    const wpn_name = Entity.GetName(wpn);
    const tab = "General";

    // for (var i = 0; i < this.weaponId.length; i++)
    //     for (var j = 0; j < this.weaponId[i].length; j++)
    //         if (this.weaponId[i][j] === wpn_id)
    //             tab = this.configuration[i+1];

    switch (wpn_name){
        case 'ssg 08' : tab = 'SSG08'; break;
        case 'awp' : tab = 'AWP'; break;
        case 'scar 20' : tab = 'SCAR20'; break;
        case 'g3sg1' : tab = 'G3SG1'; break;
        case 'glock 18' : tab = 'Glock'; break;
        case 'cz75 auto' : tab = 'CZ-75'; break;
        case 'p2000' : tab = 'P2000'; break;
        case 'usp s' : tab = 'USP'; break;
        case 'p250' : tab = 'P250'; break;
        case 'five seven' : tab = 'Five Seven'; break;
        case 'desert eagle' : tab = 'Deagle'; break;
        case 'r8 revolver' : tab = 'Revolver'; break;
        case 'dual berretas' : tab = 'Dualies'; break;
        case 'tec 9' : tab = 'Tec-9'; break;
        default : tab = 'General'; break;
    }
    
    const prefer_baim = UI.GetValue(['Rage', 'Accuracy', tab, 'Prefer body aim']);
    const is_head_aiming = UI.GetValue(['Rage', 'Target', tab, 'Hitboxes']) & (1 << 0);

    if (prefer_baim)
        return this.HITBOX.BODY;

    if (!is_head_aiming)
        return this.HITBOX.BODY;

    const head = Trace.Bullet(me, e, eye_position, Entity.GetHitboxPosition(e, 0));
    const stomach = Trace.Bullet(me, e, eye_position, Entity.GetHitboxPosition(e, 3));
    const health = Entity.GetProp(e, "CBasePlayer", "m_iHealth");

    if (!head[2] && this.currentData.last_hitbox === 0)
    {
        if (health < 25)
            return this.HITBOX.BODY;

        return this.HITBOX.HEAD;
    }

    this.currentData.last_hitbox = -1;

    if (health < stomach[1])
    {
        return this.HITBOX.BODY;
    }

    return this.HITBOX.HEAD;
}
function hkCreateMove() {
    const enabled = UI.GetValue(['Rage', 'Predicted hitbox', 'Predicted hitbox', 'Predicted targeted hitbox'])

    if (!enabled)
        return;

    const target = Targeting.FindOptimalTarget();
    const hitbox = Targeting.GetNextTargetedHitbox(target);

    Targeting.currentData.target = target;
    Targeting.currentData.hitbox = hitbox;
}

function hkRagebotFire() {
    const enabled = UI.GetValue(['Rage', 'Predicted hitbox', 'Predicted hitbox', 'Predicted targeted hitbox'])

    if (!enabled)
        return;

    const target = Event.GetInt("target_index");

    if (target !== Targeting.currentData.target)
        return;

    Targeting.currentData.last_hitbox = Event.GetInt("hitbox");
}

function hkDraw() {
    const enabled = UI.GetValue(['Rage', 'Predicted hitbox', 'Predicted hitbox', 'Predicted targeted hitbox'])

    if (!enabled)
        return;

    const me = Entity.GetLocalPlayer();

    if (!me || !Entity.IsAlive(me))
        return;

    if (!Targeting.currentData.target || !Entity.IsAlive(Targeting.currentData.target) || Targeting.currentData.hitbox < 0)
        return;

    const wts = Render.WorldToScreen(Entity.GetHitboxPosition(Targeting.currentData.target, Targeting.currentData.hitbox));
    const ssize = Render.GetScreenSize();

    if (!wts)
        return;

    if (wts[0] < 0 || wts[0] > ssize[0] || wts[1] < 0 || wts[1] > ssize[1])
        return;

    Render.FadedCircle(wts[0], wts[1], 13, [135,206,235, 20]);
}

Cheat.RegisterCallback("CreateMove", "hkCreateMove");
Cheat.RegisterCallback("Draw", "hkDraw");
Cheat.RegisterCallback("ragebot_fire", "hkRagebotFire");
 
Сверху Снизу