Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Вопрос Бинды на луа

nixer chmo
Пользователь
Пользователь
Статус
Оффлайн
Регистрация
21 Июн 2019
Сообщения
286
Реакции
63
Вопросик, я хочю переделать из жс в луа бинды, чтобы было удобней и не было говно кода
сама загвоздка в том что когда я создаю массив в массиве(ну или как там), а как сделать в форе я не могу понять вообще
JavaScript:
Expand Collapse Copy
var info = [
    ["DT", ["Rage", "GENERAL", "Exploits", "Doubletap"], [0, 255, 0, 255]],
    ["HIDE", ["Rage", "GENERAL", "Exploits", "Hide shots"], [255, 255, 255, 255]],
];

function draw(){
    var keybinds = [];
    var screen = Global.GetScreenSize();
    var font = Render.AddFont("Verdana", 7, 400);

    for(var i in info){
        if(UI.IsHotkeyActive.apply(null, info[i][1])){
            keybinds.push(i);
        }
    }

    for(var j in keybinds){
        Render.StringCustom(screen[0] / 2, screen[1] / 2 + 10 - (j * -13), 1, info[keybinds[j]][0], info[keybinds[j]][2], font);
    }
}

Cheat.RegisterCallback("Draw", "draw");
 
Сделал на примере нла


Код:
Expand Collapse Copy
local function rgba(r, g, b, a)
    if a == nil then a = 255 end
    return Color.new(r / 255, g / 255, b / 255, a / 255)
end

local info = {
    {"DT", {"Rage", "GENERAL", "Exploits", "Doubletap"}, {0, 255, 0, 255}},
    {"HIDE", {"Rage", "GENERAL", "Exploits", "Hide shots"}, {255, 255, 255, 255}},
}

local font = g_Render:InitFont("Verdana", 12)
function draw()
    local keybinds = {};
    local screen = g_EngineClient:GetScreenSize();

    for i, k in pairs(info) do
        table.insert(keybinds, {k[1], k[2], k[3]})
    end

    for i, k in pairs(keybinds) do
        local name = k[1]
        local path = k[2]
        local color = k[3]

        g_Render:Text(name, Vector2.new(screen.x / 2, screen.y / 2 + 10 - (i * -13)), rgba(color[1], color[2], color[3], color[4]), 12, font)
    end
end
cheat.RegisterCallback("draw", draw)
 
Сделал на примере нла


Код:
Expand Collapse Copy
local function rgba(r, g, b, a)
    if a == nil then a = 255 end
    return Color.new(r / 255, g / 255, b / 255, a / 255)
end

local info = {
    {"DT", {"Rage", "GENERAL", "Exploits", "Doubletap"}, {0, 255, 0, 255}},
    {"HIDE", {"Rage", "GENERAL", "Exploits", "Hide shots"}, {255, 255, 255, 255}},
}

local font = g_Render:InitFont("Verdana", 12)
function draw()
    local keybinds = {};
    local screen = g_EngineClient:GetScreenSize();

    for i, k in pairs(info) do
        table.insert(keybinds, {k[1], k[2], k[3]})
    end

    for i, k in pairs(keybinds) do
        local name = k[1]
        local path = k[2]
        local color = k[3]

        g_Render:Text(name, Vector2.new(screen.x / 2, screen.y / 2 + 10 - (i * -13)), rgba(color[1], color[2], color[3], color[4]), 12, font)
    end
end
cheat.RegisterCallback("draw", draw)
я уже немного подругому сделал
Код:
Expand Collapse Copy
local item = { 0, 0, 0 }
local alphak = 0
local m = {
["Double tap"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 2},
["Hide shots"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 1},
["Inverter"] = {reference = ui.get_key_bind("antihit_antiaim_flip_bind"), exploit = 0},
["Slow walk"] = {reference = ui.get_key_bind("antihit_extra_slowwalk_bind"), exploit = 0},
["Fake duck"] = {reference = ui.get_key_bind("antihit_extra_fakeduck_bind"), exploit = 0},
["Jump bug"] = {reference = ui.get_key_bind("misc_jump_bug_bind"), exploit = 0},
["Edge jump"] = {reference = ui.get_key_bind("misc_edge_jump_bind"), exploit = 0},
}; 
client.register_callback("paint", function()
    --ui visible
    local screen = screen_ind:get_value(1) or screen_ind:get_value(0)
    watermarkname:set_visible(screen_ind:get_value(1))
    style_line:set_visible(screen) color_line:set_visible(screen)
    keybinds_x:set_visible(false) keybinds_y:set_visible(false)
    --watermark
    if screen_ind:get_value(1) then
        local wtname = ""
        if watermarkname:get_value() ~= "" then wtname = tostring(watermarkname:get_value()) else wtname = "nixerhook.cc" end
        local username = client.get_username()
        local ping = se.get_latency()
        local tickcount = 1 / globalvars.get_interval_per_tick()
        local text = ""
        if engine.is_connected() then
        text = wtname .. " | " .. string.lower(username) .. " | delay: " .. ping .. "ms | " .. tickcount .. "tick | " .. os.date("%X") else
        text = wtname .. " | " .. string.lower(username) .. " | " .. os.date("%X") end
        local screen = engine.get_screen_size()
        local w = renderer.get_text_size(verdana, 12, text).x + 10
        local h = 17
        local x = screen.x - w - 10
        filledbox(x, 8, w, h)
        renderer.text(text, verdana, vec2_t.new(x + 6, 10 + 1), 12, color_t.new(0, 0, 0, 255))
        renderer.text(text, verdana, vec2_t.new(x + 5, 10), 12, color_t.new(255, 255, 255, 255))
    end
    --keybinds
    if screen_ind:get_value(0) and engine.is_connected() then
        local width = 146
        local height = 17
        local offset = 1
        local keybinds = {}
        local xk = keybinds_x:get_value()
        local yk = keybinds_y:get_value()
        for i,v in pairs(m) do
            local exploits = ui.get_combo_box("rage_active_exploit"):get_value()
            if v.exploit == 0 and v.reference:is_active() then
                table.insert(keybinds, i)
            end
            if v.exploit ~= 0 and exploits == v.exploit and v.reference:is_active() then
                table.insert(keybinds, i)
            end
        end

        for k,f in pairs(keybinds) do 
            local v = m[f]
            local state = "["..types[v.reference:get_type() + 1].."]"
            renderer.text(f, verdana, vec2_t.new(xk + 4, yk + 5 + (18 * k)), 12, color_t.new(0, 0, 0, 255))
            renderer.text(f, verdana, vec2_t.new(xk + 3, yk + 4 + (18 * k)), 12, color_t.new(255, 255, 255, 255))
            renderer.text(state, verdana, vec2_t.new(xk + width - renderer.get_text_size(verdana, 12, state).x - 1, yk + 5 + (18 * k)), 12, color_t.new(0, 0, 0, 255))
            renderer.text(state, verdana, vec2_t.new(xk + width - renderer.get_text_size(verdana, 12, state).x - 2, yk + 4 + (18 * k)), 12, color_t.new(255, 255, 255, 255))
            offset = offset + 1
        end
        if #keybinds ~= 0 or ui.is_visible() then
            filledbox(xk, yk, width, height)
            renderer.text("keybinds", verdana, vec2_t.new(xk + (width /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2) + 1, yk + 3), 12, color_t.new(0, 0, 0, 255))
            renderer.text("keybinds", verdana, vec2_t.new(xk + (width /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2), yk + 2), 12, color_t.new(255, 255, 255, 255))
            drag(xk, yk, width, height + 2, keybinds_x, keybinds_y, item)
        end
    end
end)
 
Назад
Сверху Снизу