LUA скрипт Fixed Keybinds For NL

Начинающий
Статус
Оффлайн
Регистрация
8 Мар 2022
Сообщения
11
Реакции[?]
1
Поинты[?]
0
пофикшеные кейбинды из *этой* темы

Код:
local function global()

    local function color(r, g, b, a)
        if a == nil then a = 255 end
        return Color.new(r / 255, g / 255, b / 255, a / 255)
    end

    local function render_conteiner(x, y, w, h, name, line_color, box_alpha, font_size, font)
        local name_size = Render.CalcTextSize(name, font_size, font)
        local line_col = line_color:GetColor()

        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y - 2), Color.new(line_col.r, line_col.g, line_col.b))
        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y + h), color(17, 17, 17, box_alpha:GetInt()))
        Render.Text(name, Vector2.new(x + w / 2 - name_size.x / 2, y + 2), color(280, 280, 280), font_size, font, true)
    end


    local screen = EngineClient.GetScreenSize()
    local font_size = 12
    local font = Render.InitFont("Verdana", font_size)
  
    local adaprive = {Menu.ColorEdit("General", "Line color", color(150, 150, 255)), Menu.SliderInt("General", "Box alpha", 150, 0, 255)}
    local key = {Menu.SliderInt("General", "keybinds x", 300, 1, screen.x), Menu.SliderInt("General", "keybinds y", 10, 1, screen.y)}
    key[1]:SetVisible(false)
    key[2]:SetVisible(false)

    local drag = false

    local width = 0
    local function keybinds()
        local x, y = key[1]:GetInt(), key[2]:GetInt()
        local max_width = 0

        local add_y = 0
        local function render_binds(binds)
            if not binds:IsActive() then return end
            local bind_name = binds:GetName()
            local bind_state = binds:GetValue()

            local bind_state_size = Render.CalcTextSize(bind_state, font_size, font)
            local bind_name_size = Render.CalcTextSize(bind_name, font_size, font)

            Render.Text(bind_name, Vector2.new(x, y + 20 + add_y), color(280, 280, 280), font_size, font, true)
            Render.Text(bind_state, Vector2.new(x + (width - bind_state_size.x), y + 20 + add_y), color(280, 280, 280), font_size, font, true)

            add_y = add_y + 16

            local bind_width = bind_state_size.x + bind_name_size.x + 10
            if bind_width > 80 then
                if bind_width > max_width then
                    max_width = bind_width
                end
            end
        end

        local binds = Cheat.GetBinds()
        for i = 1, #binds do
            render_binds(binds[i])
        end

        width = math.max(80, max_width)

        if Cheat.IsMenuVisible() or (#binds > 0) then
            render_conteiner(x, y, width, 16, "keybinds", adaprive[1], adaprive[2], font_size, font)

            local mouse = Cheat.GetMousePos()
            if Cheat.IsKeyDown(1) then
                if mouse.x >= x and mouse.y >= y and mouse.x <= x + width and mouse.y <= y + 18 or drag then
                    if not drag then
                        drag = true
                    else
                        key[1]:SetInt(mouse.x - math.floor(width / 2))
                        key[2]:SetInt(mouse.y - 8)
                    end
                end
            else
                drag = false
            end
        end
    end
  
    Cheat.RegisterCallback("draw", function()
        keybinds()
    end)
end

global()
 
Похожие темы
Сверху Снизу