/del

Статус
В этой теме нельзя размещать новые ответы.
Пользователь
Статус
Оффлайн
Регистрация
2 Май 2022
Сообщения
357
Реакции[?]
46
Поинты[?]
24K
2.15. Запрещено редактировать название темы или своё сообщение на «/del» во всех случаях (продажа аккаунта, получение ответа на свой вопрос и так далее), кроме флуда.
приветик) не вижу больше смысла держать что-то в секрете после бана в неверлузе!
1. gamesense dormant [без какого-либо кодстайлинга, просто перенос со скита]
Код:
local ffi = require("ffi")
local csgo_weapons = require("neverlose/csgo_weapons")
local debug_overlay = require 'neverlose/debugoverlay'

local ref = {
    mindmg = ui.find("Aimbot", "Ragebot", "Selection", "Min. Damage"),
    dormantEsp = ui.find("Visuals", "Players", "Enemies", "ESP", "Dormant")
}

local group = ui.create("Dormant", "#MAIN")

local dormant_switch = group:switch("Dormant aimbot")
local tooltips = {}

tooltips[0] = "Inherited"

for i = 1, 26 do
    tooltips[100 + i] = "HP + " .. i
end

local menu = {}
do
    menu.dormantHitboxes = group:selectable("Dormant target hitbox", "Head", "Chest", "Stomach", "Legs")
    menu.dormantAccuracy = group:slider("Dormant aimbot accuracy", 50, 100, 90, 1, "%")
    menu.dormantMindmg = group:slider("Dormant minimum damage", 0, 126, 10, nil, function(num)
        return tooltips[num] ~= nil and tooltips[num + 1] or num
    end)
    menu.experimental = group:switch("Dormant aimbot accurate history [experimental]")
    menu.dormantLogs = group:switch("Log dormant shots")
    menu.dormantlastseen = group:switch("Draw dormant position")
    menu.dormantlastseencolor = menu.dormantlastseen:create():color_picker("Dormant aimbot indicator",
        color(255, 255, 255, 255))
end

local hitboxes = {
    "generic",
    "head",
    "chest",
    "stomach",
    "left arm",
    "right arm",
    "left leg",
    "right leg",
    "neck",
    "?",
    "gear"
}
local hitgroup = {
    "",
    "Head",
    "Chest",
    "Stomach",
    "Chest",
    "Chest",
    "Legs",
    "Legs",
    "Head",
    "",
    ""
}

local function create_hitbox_points(from, to, radius)
    local pitch, yaw = from:to(to):angles():unpack()
    local radian = math.rad(yaw + 90)
    local direction = vector(math.cos(radian), math.sin(radian), 0) * radius

    return {
        {
            text = "Middle",
            vec = to
        },
        {
            text = "Left",
            vec = to + direction
        },
        {
            text = "Right",
            vec = to - direction
        }
    }
end

local function contains(item, value)
    for i = 1, #item do
        if item[i] == value then
            return true
        end
    end

    return false
end

local function velocity_modifier(cmd, goalspeed)
    local minspeed = math.sqrt(cmd.forwardmove * cmd.forwardmove + cmd.sidemove * cmd.sidemove)

    if goalspeed <= 0 or minspeed <= 0 then
        return
    end

    if cmd.in_duck == 1 then
        goalspeed = goalspeed * 2.94117647
    end

    if minspeed <= goalspeed then
        return
    end

    local speedfactor = goalspeed / minspeed

    cmd.forwardmove = cmd.forwardmove * speedfactor
    cmd.sidemove = cmd.sidemove * speedfactor
end

local function generate_enemies_list()
    local list = {}
    local resource = entity.get_player_resource()

    for i = 1, globals.max_players do
        local ent = entity.get(i)

        if ent ~= nil and resource.m_bConnected[i] and ent ~= entity.get_local_player() and ent:is_enemy() then
            list[#list + 1] = ent
        end
    end

    return list
end

local function generate_player_list()
    local list = {}
    local resource = entity.get_player_resource()

    for i = 1, globals.max_players do
        local ent = entity.get(i)

        if resource.m_bConnected[i] ~= true then
            -- block empty
        elseif ent ~= nil and ent:is_dormant() and ent:is_enemy() then
            list[#list + 1] = i
        end
    end

    return list
end

local function contains_first_value(item, key)
    for index, value in ipairs(item) do
        if value[1] == key then
            return true
        end
    end

    return false
end

local roundStarted = 0
local playerList = {}
local points = {}
local hitbox_points = {
    {
        scale = 5,
        hitbox = "Stomach",
        vec = vector(0, 0, 40)
    },
    {
        scale = 6,
        hitbox = "Chest",
        vec = vector(0, 0, 50)
    },
    {
        scale = 3,
        hitbox = "Head",
        vec = vector(0, 0, 58)
    },
    {
        scale = 4,
        hitbox = "Legs",
        vec = vector(0, 0, 20)
    }
}
local logHitboxes = {
    [0] = "Head",
    nil,
    "Stomach",
    nil,
    "Stomach",
    "Chest",
    "Chest",
    "Legs",
    "Legs"
}
local playerIndex = 1
local shot
local aimHitbox
local aimPoint
local aimTarget
local PlayerAlpha
local hit = false

local function get_bind(name)
    local active = false
    local value = 0

    for i = 1, #ui.get_binds() do
        local bind = ui.get_binds()[i]

        if bind.name == name then
            active = true
            value = bind.value
        end
    end

    return active, value
end

local function setup_command(cmd)
    local dormantHitboxes = menu.dormantHitboxes:get()
    local listSomeShit = {}

    for key, value in ipairs(generate_enemies_list()) do
        local bbox = value:get_bbox()

        if bbox.alpha < 1 then
            if not contains_first_value(points, value) then
                table.insert(points, {
                    value,
                    globals.tickcount
                })
            end
        elseif contains_first_value(points, value) then
            for i, v in ipairs(points) do
                if v[1] == value then
                    table.remove(points, i)
                end
            end
        end
    end

    if not dormant_switch:get() then
        return
    end

    local lp = entity.get_local_player()
    local lpWeapon = lp:get_player_weapon()

    if not lpWeapon then
        return
    end

    local inaccuracy = lpWeapon:get_inaccuracy()

    if not inaccuracy then
        return
    end

    local eye_pos = lp:get_eye_position()
    local sim_time = lp.m_flSimulationTime
    local wpn = csgo_weapons(lpWeapon)
    local scoped = lp.m_bIsScoped
    local m_fFlags = bit.band(lp.m_fFlags, bit.lshift(1, 0))
    local player_list = generate_player_list()

    if globals.tickcount % #player_list ~= 0 then
        playerIndex = playerIndex + 1
    else
        playerIndex = 1
    end

    local enemy = entity.get(player_list[playerIndex])

    if not enemy or enemy == nil then
        playerList = {}

        return
    end

    local bbox = enemy:get_bbox()


    if globals.tickcount < roundStarted then
        playerList = {}

        return
    end

    if wpn.type == "grenade" or wpn.type == "knife" then
        playerList = {}

        return
    end

    if cmd.in_jump == 1 and m_fFlags == 0 then
        playerList = {}

        return
    end

    local points2 = {}
    local dormantAccuracy = menu.dormantAccuracy:get()
    local enemy_hp = enemy.m_iHealth

    local key, val1 = get_bind("Min. Damage")

    local is_override = key
    local desired_damage = menu.dormantMindmg:get() == 0 and not is_override and ref.mindmg:get() or
        menu.dormantMindmg:get() == 0 and is_override and val1 or menu.dormantMindmg:get()

    if desired_damage > 100 then
        desired_damage = desired_damage - 100 + enemy_hp
    end

    local m_flDuckAmount = enemy.m_flDuckAmount

    for key, value in ipairs(hitbox_points) do
        if #dormantHitboxes ~= 0 then
            if contains(dormantHitboxes, value.hitbox) then
                if value.hitbox == "Head" then
                    table.insert(points2, {
                        vec = value.vec - vector(0, 0, m_flDuckAmount * 10),
                        scale = value.scale,
                        hitbox = value.hitbox
                    })
                elseif value.hitbox == "Chest" then
                    table.insert(points2, {
                        vec = value.vec - vector(0, 0, m_flDuckAmount * 4),
                        scale = value.scale,
                        hitbox = value.hitbox
                    })
                else
                    table.insert(points2, {
                        vec = value.vec,
                        scale = value.scale,
                        hitbox = value.hitbox
                    })
                end
            end
        else
            table.insert(points2, 1, {
                vec = value.vec,
                scale = value.scale,
                hitbox = value.hitbox
            })
        end
    end

    local ready

    if wpn.is_revolver then
        ready = sim_time > lpWeapon.m_flNextPrimaryAttack
    else
        ready = sim_time >
            math.max(lp.m_flNextAttack, lpWeapon.m_flNextPrimaryAttack,
                lpWeapon.m_flNextSecondaryAttack)
    end

    print_dev(ready)
    if not ready then
        return
    end

    local origin = enemy:get_origin()
    local stomachPosition = enemy:get_hitbox_position(4)

    playerList[enemy] = nil

    for i = 1, 7 do
        if #dormantHitboxes ~= 0 and contains(dormantHitboxes, logHitboxes[i - 1]) and enemy:is_alive() and bbox.alpha > 0 and math.abs(origin.x - stomachPosition.x) < 7 then
            table.insert(listSomeShit, {
                scale = 3,
                hitbox = logHitboxes[i - 1],
                vec = enemy:get_hitbox_position(i - 1)
            })
        end
    end

    local found_pos
    local found_damage
    local found_hbox

    if menu.experimental:get() then
        for key, val in ipairs(listSomeShit) do
            local hbox = create_hitbox_points(eye_pos, val.vec, 3)

            for k, v in ipairs(hbox) do
                local new_position = v.vec
                local dmg, tr = utils.trace_bullet(lp, eye_pos,
                    new_position, entity.get_players(false, false))

                if val.hitbox == "Head" then
                    dmg = dmg * 4
                end

                if dmg ~= 0 and desired_damage < dmg then
                    found_pos = new_position
                    found_damage = dmg
                    found_hbox = val.hitbox

                    break
                end
            end
        end
    end

    if not (dormantAccuracy < math.floor(bbox.alpha * 100) + 5) and not menu.experimental:get() then
        return
    end

    local new_found_pos
    local new_found_damage

    if found_damage ~= nil and found_pos ~= nil then
        new_found_pos = found_pos
        new_found_damage = found_damage
        aimHitbox = found_hbox
        aimPoint = nil
        aimTarget = enemy
        PlayerAlpha = bbox.alpha
    else
        for value1, value2 in ipairs(points2) do
            local vec = origin + value2.vec
            local hitboksik = create_hitbox_points(eye_pos, vec, value2.scale)

            for value3, value4 in ipairs(hitboksik) do
                local vec = value4.vec
                local dmg, tr = utils.trace_bullet(lp, eye_pos,
                    vec, true)

                if tr:is_visible() then
                    return
                end

                if dmg ~= 0 and desired_damage < dmg then
                    new_found_pos = vec
                    new_found_damage = dmg
                    aimHitbox = value2.hitbox
                    aimPoint = value4.text
                    aimTarget = enemy
                    PlayerAlpha = bbox.alpha

                    break
                end
            end

            if new_found_pos and new_found_damage then
                break
            end
        end
    end

    if not new_found_damage then
        return
    end

    if not new_found_pos then
        return
    end

    velocity_modifier(cmd, (scoped and wpn.max_player_speed_alt or wpn.max_player_speed) * 0.33)

    local pitch, yaw = eye_pos:to(new_found_pos):angles():unpack()

    if not scoped and wpn.type == "sniperrifle" and cmd.in_jump == false and m_fFlags == 1 then
        cmd.in_attack2 = 1
    end

    playerList[enemy] = true

    if inaccuracy < 0.01 then
        cmd.view_angles.x = pitch
        cmd.view_angles.y = yaw
        cmd.in_attack = 1
        shot = true
    end
end

events.weapon_fire(function(e)
    utils.execute_after(0.03, function()
        local lp = entity.get_local_player()

        local userid = entity.get(e.userid, true)
        if not userid or userid == nil then
            return
        end
        if userid == lp then
            if shot and not hit then
                events.dormant_miss:call({
                    userid = aimTarget,
                    aim_hitbox = aimHitbox,
                    aim_point = aimPoint,
                    accuracy = PlayerAlpha
                })
            end

            hit = false
            shot = false
            aimHitbox = nil
            aimPoint = nil
            aimTarget = nil
            PlayerAlpha = nil
        end
    end)
end)

local function fire_dormant_hit(e)
    local userid = entity.get(e.userid, true)
    if not userid or userid == nil then
        return
    end

    local attacker = entity.get(e.attacker, true)
    if not attacker or attacker == nil then
        return
    end

    local bbox = userid:get_bbox()
    if attacker == entity.get_local_player() and userid ~= nil and shot == true then
        hit = true

        events.dormant_hit:call({
            userid = userid,
            attacker = attacker,
            health = e.health,
            armor = e.armor,
            weapon = e.weapon,
            dmg_health = e.dmg_health,
            dmg_armor = e.dmg_armor,
            hitgroup = e.hitgroup,
            accuracy = bbox.alpha,
            aim_hitbox = aimHitbox
        })
    end
end

local function roundStart()
    roundStarted = globals.tickcount + (cvar.mp_freezetime:float() + 1) / globals.tickinterval
end

local function visibility()
    local key = dormant_switch:get()

    for k, v in pairs(menu) do
        v:visibility(key)
    end
end

dormant_switch:set_callback(function()
    if dormant_switch:get() then
        ref.dormantEsp:override(dormant_switch:get())
    end

    if dormant_switch:get() then
        events.createmove(setup_command)
        events.round_prestart(roundStart)
        events.player_hurt(fire_dormant_hit)
    else
        events.createmove:unset(setup_command)
        events.round_prestart:unset(roundStart)
        events.player_hurt:unset(fire_dormant_hit)
    end

    visibility()
end)
visibility()

local toDrawHitboxes = {
    0,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    15,
    16,
    17,
    18
}

events.render(function()
    local lp = entity.get_local_player()

    if not lp or lp == nil then
        return
    end

    if menu.dormantlastseen:get() then
        for iter_15_2, v in ipairs(points) do
            local ent = v[1]

            if not ent or ent == nil then
                return
            end

            local origin = ent:get_origin()
            local stomach_pos = ent:get_hitbox_position(4)
            local bbox = ent:get_bbox()
            local r, g, b, a = menu.dormantlastseencolor:get():unpack()



            if bbox.alpha > 0 and ent:is_dormant() and math.abs(origin.x - stomach_pos.x) < 7 then
                debug_overlay.DrawHitboxes(ent, toDrawHitboxes, r, g, b, (math.min(a, bbox.alpha / 10 * a) + 5) * 10,
                    0.06)
            end
        end
    end
end)
events.dormant_hit(function(e)
    if menu.dormantLogs:get() then
        local name = e.userid:get_name()

        if hitgroup[e.hitgroup + 1] == e.aim_hitbox or aimHitbox == "Head" then
            print(string.format("[DA] Hit %s in the %s for %i damage (%i health remaining) (%s accuracy)", name,
                hitboxes[e.hitgroup + 1], e.dmg_health, e.health,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        else
            print(string.format("[DA] Hit %s in the %s for %i damage (%i health remaining) aimed=%s (%s accuracy)",
                name, hitboxes[e.hitgroup + 1], e.dmg_health, e.health, e.aim_hitbox,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        end
    end
end)

events.dormant_miss(function(e)
    if menu.dormantLogs:get() then
        local name = e.userid:get_name()

        if aimPoint ~= nil then
            print(string.format("[DA] Missed %s's %s (mp=%s) (%s accuracy)", name, aimHitbox, aimPoint,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        else
            print(string.format("[DA] Missed %s's %s (%s accuracy)", name, aimHitbox,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        end
    end
end)
2. скит дормант с попыткой код-стайлинга
Код:
local csgo_weapons = require 'neverlose/csgo_weapons'
local debug_overlay = require 'neverlose/debugoverlay'


local Menu = {}
function Menu:Init()
    local private = {}
    private.group_rage = ui.create("DORMANT", "#MAIN")
    private.group_other = ui.create("DORMANT", "#EXTRA")

    private.tooltips = { [0] = "Inherited" }
    for i = 1, 26 do
        private.tooltips[100 + i] = "HP + " .. i
    end

    local public = {}
    public.switch = private.group_rage:switch("Dormant aimbot")
    public.hitboxes = private.group_rage:selectable("Dormant target hitbox", { "Head", "Chest", "Stomach", "Legs" })
    public.hitchance = private.group_rage:slider("Dormant aimbot accuracy", 50, 85, 85, nil, "%")
    public.damage = private.group_rage:slider("Dormant minimum damage", 0, 126, 10, nil, function(num)
        return private.group_rage[num] ~= nil and private.tooltips[num] or num
    end)
    public.experimental = private.group_rage:switch("Dormant accurate history [experimental]")

    public.logs = private.group_other:switch("Log dormant shots")

    setmetatable(public, self)
    self.__index = self;

    return public
end

local Player = {}
function Player:New(as_number)
    local list = {}

    local resource = entity.get_player_resource()

    for i = 1, globals.max_players do
        local ent = entity.get(i)

        if resource.m_bConnected[i] and ent ~= nil and ent:is_dormant() and ent:is_enemy() then
            list[#list + 1] = (as_number == true and as_number ~= nil) and i or ent
        end
    end

    return list
end --@note: usage -> Player:New(as_number).list[i]

local Points = {}
function Points:New(from, to, radius)
    local angle = from:to(to):angles()
    local pitch = angle.x
    local yaw = angle.y
    local radian = math.rad(yaw + 90)
    local direction = vector(math.cos(radian), math.sin(radian), 0) * radius

    return {
        {
            text = "Middle",
            vec = to
        },
        {
            text = "Left",
            vec = to + direction
        },
        {
            text = "Right",
            vec = to - direction
        }
    }
end --@note: usage -> Points:New(from, to, radius)[i].vec

local Contains = {}
function Contains:New(is_first, item, value)
    if is_first then
        for index, v in pairs(item) do
            if v[1] == value then
                return true
            end
        end
    else
        for i = 1, #item do
            if item[i] == value then
                return true
            end
        end
    end

    return false
end

local Feature = {}
function Feature:CanShoot()
    local player = entity:get_local_player()
    if not player then
        return false
    end

    if not player:is_alive() then
        return false
    end

    local weapon = player:get_player_weapon()
    if not weapon then
        return false
    end

    local weapon_data = weapon:get_weapon_info()
    if not weapon_data then
        return false
    end

    local is_gun = weapon_data.weapon_type > 0 and weapon_data.weapon_type < 7 or weapon_data.weapon_type == 8
    local server_time = player["m_nTickBase"]

    if not is_gun and weapon["m_flNextPrimaryAttack"] > server_time * globals.tickinterval then
        return false
    end

    if (is_gun and (weapon["m_iClip1"] < 1) or player["m_flNextAttack"] > server_time * globals.tickinterval) then
        return false
    end

    return not (weapon["m_flNextPrimaryAttack"] > server_time * globals.tickinterval)
end

local menu = Menu:Init()

local Dormant = {
    init = function(self)
        self.points = {}
        self.multipoints = {
            { scale = 5, hitbox = "Stomach", vec = vector(0, 0, 40) },
            { scale = 6, hitbox = "Chest",   vec = vector(0, 0, 50) },
            { scale = 3, hitbox = "Head",    vec = vector(0, 0, 58) },
            { scale = 4, hitbox = "Legs",    vec = vector(0, 0, 20) }
        }
        self.hitbox = { [0] = "Head", nil, "Stomach", nil, "Stomach", "Chest", "Chest", "Legs", "Legs" }
        self.player_index = 1

        self.hit = false

        self.is_shot = false
        self.aim_hitbox = "[?]"

        self.aim_point = "[?]"
        self.aim_target = nil

        self.is_hit = false
        self.roundStarted = 0

        self.player_list = {}
        self.alpha = nil
    end,
    get_bind = function(self, name)
        local active, value = false, 0

        for i = 1, #ui.get_binds() do
            local bind = ui.get_binds()[i]

            if bind.name == name then
                active = true
                value = bind.value
            end
        end

        return active, value
    end,
    createmove = function(self, cmd)
        local main_points = {}
        local hbox = menu.hitboxes:get()

        local as_enemy = Player:New(false)


        for i = 1, #as_enemy do
            local ent = as_enemy[i]

            local bbox = ent:get_bbox()

            if bbox.alpha < 0.8 then
                if not Contains:New(true, self.points, ent) then
                    table.insert(self.points, {
                        ent,
                        globals.tickcount
                    })
                end
            elseif Contains:New(true, self.points, ent) then
                for i, v in pairs(self.points) do
                    if v[1] == ent then
                        table.remove(self.points, i)
                    end
                end
            end
        end

        if not menu.switch:get() then
            return
        end

        local lp = entity.get_local_player()

        if not lp or lp == nil then
            return
        end
        local lpWeapon = lp:get_player_weapon()

        if not lpWeapon or lpWeapon == nil then
            return
        end

        local inaccuracy = lpWeapon:get_inaccuracy()

        if not inaccuracy then
            return
        end

        local eye_pos = lp:get_eye_position()
        local sim_time = lp.m_flSimulationTime
        local wpn = csgo_weapons(lpWeapon)
        local scoped = lp.m_bIsScoped
        local onground = bit.band(lp.m_fFlags, bit.lshift(1, 0)) ~= 0

        local as_number = Player:New(true)


        if globals.tickcount % #as_number ~= 0 then
            self.player_index = self.player_index + 1
        else
            self.player_index = 1
        end

        local enemy = entity.get(as_number[self.player_index])

        if not enemy or enemy == nil then
            self.player_list = {}

            return
        end


        local bbox = enemy:get_bbox()

        if globals.tickcount < self.roundStarted then
            self.player_list = {}

            return
        end


        if wpn.type == "grenade" or wpn.type == "knife" then
            self.player_list = {}

            return
        end

        if cmd.in_jump and onground then
            self.player_list = {}

            return
        end

        local accuracy = menu.hitchance:get()

        local key, vv = self:get_bind("Min. Damage")

        local desired_damage = menu.damage:get() == 0 and not key and
            ui.find("Aimbot", "Ragebot", "Selection", "Min. Damage"):get() or menu.damage:get() == 0 and key and vv or
            menu.damage:get()
        do
            if desired_damage > 100 then
                desired_damage = desired_damage - 100 + enemy.m_iHealth
            end
        end

        local duck = enemy.m_flDuckAmount

        local points = {}

        for index, point in ipairs(self.multipoints) do
            if #hbox ~= 0 then
                if Contains:New(false, hbox, point.hitbox) then
                    if point.hitbox == "Head" then
                        table.insert(points, {
                            vec = point.vec - vector(0, 0, duck * 10),
                            scale = point.scale,
                            hitbox = point.hitbox
                        })
                    elseif point.hitbox == "Chest" then
                        table.insert(points, {
                            vec = point.vec - vector(0, 0, duck * 4),
                            scale = point.scale,
                            hitbox = point.hitbox
                        })
                    else
                        table.insert(points, {
                            vec = point.vec,
                            scale = point.scale,
                            hitbox = point.hitbox
                        })
                    end
                end
            else
                table.insert(points, 1, {
                    vec = point.vec,
                    scale = point.scale,
                    hitbox = point.hitbox
                })
            end
        end

        if not Feature:CanShoot() then
            return
        end


        local origin = enemy:get_origin()
        local stomach = enemy:get_hitbox_position(4)

        self.player_list[enemy] = nil

        for i = 1, 7 do
            if #hbox ~= 0 and Contains:New(false, hbox, self.hitbox[i - 1]) and enemy:is_alive() and bbox.alpha > 0 and math.abs(origin.x - stomach.x) < 7 then
                table.insert(main_points, {
                    scale = 3,
                    hitbox = self.hitbox[i - 1],
                    vec = enemy:get_hitbox_position(i - 1)
                })
            end
        end

        local found_pos
        local found_damage
        local found_hbox

        if menu.experimental:get() then
            for key, value in ipairs(main_points) do
                local point = Points:New(eye_pos, value.vec, 3)

                for iter, iter2 in ipairs(point) do
                    local vec = iter2.vec
                    local dmg, tr = utils.trace_bullet(lp, eye_pos, vec, entity.get_players(false, false))

                    if value.hitbox == "Head" then
                        dmg = dmg * 4
                    end

                    if dmg ~= 0 and desired_damage < dmg then
                        found_pos = vec
                        found_damage = dmg
                        found_hbox = value.hitbox

                        break
                    end
                end
            end
        end

        if not (menu.hitchance:get() < math.floor(bbox.alpha * 100) + 5) and not menu.experimental:get() then
            return
        end

        local schaden     -- @note: damage
        local blickwinkel -- @note: found pos

        if found_damage ~= nil then
            blickwinkel = found_pos
            schaden = found_damage

            self.aim_hitbox = found_hbox
            self.aim_point = nil
            self.aim_target = enemy
            self.alpha = bbox.alpha
        else
            for iter, iter2 in ipairs(points) do
                local vec = origin + iter2.vec
                local point = Points:New(eye_pos, vec, iter2.scale)

                for iter3, iter4 in ipairs(point) do
                    local Vector = iter4.vec
                    local dmg, tr = utils.trace_bullet(lp, eye_pos, Vector, entity.get_players(false, false))

                    if tr:is_visible() then
                        return
                    end
                    if dmg ~= 0 and desired_damage < dmg then
                        blickwinkel = Vector
                        schaden = dmg

                        self.aim_hitbox = iter2.hitbox
                        self.aim_point = iter4.text
                        self.aim_target = enemy
                        self.alpha = bbox.alpha

                        break
                    end
                end

                if schaden and blickwinkel then
                    break
                end
            end
        end

        if not schaden then
            return
        end

        if not blickwinkel then
            return
        end

        local angle = eye_pos:to(blickwinkel):angles()

        cmd.block_movement = 1
        if not scoped and wpn.type == 'sniperrifle' then
            cmd.in_attack2 = true
        end

        self.player_list[enemy] = true


        if inaccuracy < 0.01 then
            cmd.view_angles = angle
            cmd.in_attack = true
            cmd.in_attack2 = true

            self.is_shot = true
        end
    end,
    round_prestart = function(self)
        self.roundStarted = globals.tickcount + (cvar.mp_freezetime:float() + 1) / globals.tickinterval
    end,
    weapon_fire = function(self, e)
        utils.execute_after(0.03, function()
            local lp = entity.get_local_player()

            local userid = entity.get(e.userid, true)

            if not userid or userid == nil then
                return
            end

            if userid == lp then
                if self.is_shot and not self.is_hit then
                    events.dormant_miss:call({
                        userid = self.aim_target,
                        aim_hitbox = self.aim_hitbox,
                        aim_point = self.aim_point,
                        accuracy = self.alpha
                    })
                end

                self.is_shot = false
                self.is_hit = false
                self.aim_hitbox = nil
                self.aim_point = nil
                self.aim_target = nil
                self.alpha = nil
            end
        end)
    end,
    player_hurt = function(self, e)
        local userid = entity.get(e.userid, true)
        if not userid or userid == nil then
            return
        end

        local attacker = entity.get(e.attacker, true)
        if not attacker or attacker == nil then
            return
        end

        local bbox = userid:get_bbox()
        if attacker == entity.get_local_player() and userid ~= nil and self.is_shot == true then
            self.is_hit = true

            events.dormant_hit:call({
                userid = userid,
                attacker = attacker,
                health = e.health,
                armor = e.armor,
                weapon = e.weapon,
                dmg_health = e.dmg_health,
                dmg_armor = e.dmg_armor,
                hitgroup = e.hitgroup,
                accuracy = self.alpha,
                aim_hitbox = self.aim_hitbox
            })
        end
    end
}

local Misc = {}
function Misc:dormant_hit(e)
    if menu.logs:get() then
        local name = e.userid:get_name()

        local hitgroup = {
            "generic",
            "head",
            "chest",
            "stomach",
            "left arm",
            "right arm",
            "left leg",
            "right leg",
            "neck",
            "?",
            "gear"
        }

        if hitgroup[e.hitgroup + 1] == e.aim_hitbox or Dormant.aim_hitbox == "Head" then
            print(string.format("[DA] Hit %s in the %s for %i damage (%i health remaining) (%s accuracy)", name,
                hitgroup[e.hitgroup + 1], e.dmg_health, e.health,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        else
            print(string.format("[DA] Hit %s in the %s for %i damage (%i health remaining) aimed=%s (%s accuracy)",
                name, hitgroup[e.hitgroup + 1], e.dmg_health, e.health, e.aim_hitbox,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        end
    end
end

function Misc:dormant_miss(e)
    if menu.logs:get() then
        local name = e.userid:get_name()

        if Dormant.aim_point ~= nil then
            print(string.format("[DA] Missed %s's %s (mp=%s) (%s accuracy)", name, Dormant.aim_hitbox,
                Dormant.aim_point,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        else
            print(string.format("[DA] Missed %s's %s (%s accuracy)", name, Dormant.aim_hitbox,
                string.format("%.0f", e.accuracy * 100) .. "%"))
        end
    end
end

events.createmove(function(cmd)
    Dormant:createmove(cmd)
end)

events.round_prestart(function()
    Dormant:round_prestart()
end)

events.weapon_fire(function(e)
    Dormant:weapon_fire(e)
end)

events.player_hurt(function(e)
    Dormant:player_hurt(e)
end)


-- @other
events.dormant_hit(function(e)
    Misc:dormant_hit(e)
end)

events.dormant_miss(function(e)
    Misc:dormant_miss(e)
end)

Dormant:init()
3. думаю самый лучший которы йтут есть, имеет хитшанс (аккураси сприд, и dist_to_ray)
Код:
local menu = {
    switch = ui.create("Dormant", "#EXTRA", 1):switch("Dormant Aimbot", false),
    hitchance = ui.create("Dormant", "#EXTRA", 1):slider("Hit Chance", 0, 100, 70),
    alpha_modifier = ui.create("Dormant", "#EXTRA", 1):slider("Alpha Modifier", 50, 100, 78, nil, "%"),
    minimum_damage = ui.create("Dormant", "#EXTRA", 1):slider("Minimum Damage", 0, 120, 10)
}

local Dormant = {}
local HitChance = {}

local HitChance = {
    init = function(self)
        self.spread_values = {}
        for i = 1, 64 do
            local a = utils.random_float(0, 1);
            local b = utils.random_float(0, 6.2831853071795864);
            local c = utils.random_float(0, 1);
            local d = utils.random_float(0, 6.2831853071795864);

            self.spread_values[i] = {
                a = a,
                bcos = math.cos(b),
                bsin = math.sin(b),
                c = c,
                dcos = math.cos(d),
                dsin = math.sin(d)
            }
        end
    end,
    get_depended_hitchance = function(self, cmd, position)
        local lp = entity.get_local_player()

        if not lp or lp == nil then
            return
        end

        local wpn = lp:get_player_weapon()

        if not wpn or wpn == nil then
            return
        end

        local shoot_pos = lp:get_eye_position()
        local ang = shoot_pos:to(position):angles()

        local forward = vector(
            math.cos(math.rad(ang.x)) * math.cos(math.rad(ang.y)),
            math.cos(math.rad(ang.x)) * math.sin(math.rad(ang.y)),
            -math.sin(math.rad(ang.x))
        )

        local right, up = forward:vectors()

        local hits = 0
        for i = 1, 64 do
            local s_val = self.spread_values[i]

            local a = s_val.a
            local c = s_val.c

            local inaccuracy = a * wpn:get_inaccuracy()
            local spread = c * wpn:get_spread()

            if wpn.m_iItemDefinitionIndex == 64 and cmd.in_attack2 == true then
                a = 1 - a * a;
                a = 1 - c * c;
            end

            local direction = forward + (right * (s_val.bcos * inaccuracy + s_val.dcos * spread)) +
                (up * (s_val.bsin * inaccuracy + s_val.dsin * spread))
            direction = direction:normalized()


            if position:dist_to_ray(shoot_pos, direction) < 20 then
                hits = hits + 1
            end
        end

        return (hits / 64)
    end,
    get_player_hitchance = function(self) -- @note: not spread / inaccuracy based
        local lp = entity.get_local_player()

        if not lp or lp == nil then
            return
        end

        local wpn = lp:get_player_weapon()

        if not wpn or wpn == nil then
            return
        end

        local hc = menu.hitchance:get() / 100


        if wpn and wpn:get_weapon_index() == 31 then -- @note: do not forget/taser id
            return bit.band(lp.m_fFlags, 1) == 1 and hc or hc / 2
        end

        if hc < .1 then
            return 0
        end

        return math.clamp(hc + 3 / wpn:get_weapon_info().max_clip1, 0, 1)
    end
}

HitChance:init()

local Dormant = {
    init = function(self)
        self.tickcount = 0
    end,
    run = function(self, cmd)
        if not menu.switch:get() then
            return
        end

        local lp = entity.get_local_player()

        if not lp or lp == nil then
            return
        end

        local wpn = lp:get_player_weapon()

        if not wpn or wpn == nil then
            return
        end

        local m_weapon_info = wpn:get_weapon_info()


        local eyepos = lp:get_eye_position()

        local simtime = lp.m_flSimulationTime
        if not (m_weapon_info.is_revolver and wpn.m_flNextPrimaryAttack < simtime or math.max(lp.m_flNextAttack, wpn.m_flNextPrimaryAttack, wpn.m_flNextSecondaryAttack) < simtime) then
            return
        end

        if m_weapon_info.weapon_type == 9 or m_weapon_info.weapon_type == 0 then
            return
        end

        if globals.tickcount < self.tickcount then
            return
        end

        entity.get_players(true, true, function(player)
            if not player or player == nil then
                return
            end

            if not player:is_enemy() then
                return
            end

            if not player:is_dormant() then
                return
            end

            local bbox = player:get_bbox()
            local origin = player:get_origin()

            if not (menu.alpha_modifier:get() < math.floor(bbox.alpha * 100) + 6) then
                return
            end

            local add_vector = player.m_flDuckAmount > 0.45 and vector(0, 0, 38) or vector(0, 0, 48)
            local vec = origin + add_vector
            local damage, tr = utils.trace_bullet(lp, eyepos, vec, entity.get_players(false, false))

            if damage > 0 then
                cmd.block_movement = 1

                local target_hitchance = HitChance:get_player_hitchance()
                local best_match = HitChance:get_depended_hitchance(cmd, vec)

                if damage >= menu.minimum_damage:get() then
                    if not lp.m_bIsScoped then
                        cmd.in_attack2 = true
                    end
                    if best_match >= target_hitchance then
                        cmd.view_angles = eyepos:to(vec):angles() - lp.m_aimPunchAngle * cvar.weapon_recoil_scale:float()
                        cmd.in_attack = 1
                    end
                end
            end
        end)
    end,
    round_start = function(self)
        self.tickcount = globals.tickcount + (cvar.mp_freezetime:float() + 1) / globals.tickinterval
    end
}

Dormant:init()

events.createmove(function(cmd)
    Dormant:run(cmd)
end)

events.round_start(function()
    Dormant:round_start()
end)
 
godsystem
Пользователь
Статус
Онлайн
Регистрация
26 Авг 2022
Сообщения
296
Реакции[?]
45
Поинты[?]
2K
Статус
В этой теме нельзя размещать новые ответы.
Похожие темы
Сверху Снизу