Вопрос Не передвигается KeyBinds

Начинающий
Статус
Оффлайн
Регистрация
9 Дек 2019
Сообщения
59
Реакции[?]
5
Поинты[?]
0
Не передвигается кейбинд если зажать курсором и вести, что пофиксить надо

JavaScript:
UI.AddCheckbox("Key Binds");
UI.AddSliderInt("keybinds_x", 0, Render.GetScreenSize()[0]);
UI.AddSliderInt("keybinds_y", 0, Render.GetScreenSize()[1]);

//KEY BINDS
function clamp(v, min_int, max_int){
    return Math.max(Math.min(v, max_int), min_int);
}

 function xy()
 {
    if(!UI.GetValue("Script items", "Key Binds")) return;
     UI.SetEnabled("Misc", "JAVASCRIPT", "Script items", "keybinds_x", true)
     UI.SetEnabled("Misc", "JAVASCRIPT", "Script items", "keybinds_y", true)
 }
 xy();

var kb_x = UI.GetValue("Script items", "keybinds_x") || Render.GetScreenSize()[0] - 170;
var kb_y = UI.GetValue("Script items", "keybinds_y") || (Render.GetScreenSize()[1] / 2) - (18 / 2);
function kb()
{
    if(!UI.GetValue("Script items", "Key Binds")) return;
     var h = [];
     const fontpixel = Render.AddFont( "Verdana", 7, 100);

     if (UI.IsHotkeyActive("Anti-Aim", "Extra", "Slow walk")) {
       h.push("Slow Walk")
     }
     if (UI.IsHotkeyActive("Anti-Aim", "Extra", "Fake duck")) {
       h.push("Fake Duck")
     }
     if (UI.IsHotkeyActive("Misc", "General", "Movement", "Auto peek")) {
       h.push("Auto Peek")
     }
     if (UI.IsHotkeyActive("Anti-Aim", "Fake angles", "Inverter")) {
       h.push("Anti-Aim invert")
     }
     if (UI.IsHotkeyActive("Rage", "General", "General", "Force safe point")) {
       h.push("Safe Point")
     }
     if (UI.IsHotkeyActive("Rage", "General", "General", "Force body aim")) {
       h.push("Body Aim")
     }
     if (UI.IsHotkeyActive("Rage", "Exploits", "Double tap")) {
       h.push("Double Tap")
     }
     if (UI.IsHotkeyActive("Rage", "Exploits", "Hide shots")) {
       h.push("Hide shots")
     }
     if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Freestand on Key")) {
        h.push("Freestand")
      }
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Ping Spike on Key")) {
        h.push("Ping Spike")
    }
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Damage Override")) {
        h.push("Min DMG")
    }
     const kb_x = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "keybinds_x"),
           kb_y = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "keybinds_y");

     const rainbow = [
         Math.floor(Math.sin(Global.Realtime() * 2) * 127 + 128),
         Math.floor(Math.sin(Global.Realtime() * 2 + 2) * 127 + 128),
         Math.floor(Math.sin(Global.Realtime() * 2 + 4) * 127 + 128),
         255
     ];
    

     Render.FilledRect(kb_x, kb_y, 170, 20, [15, 15, 15, 255]);
     Render.StringCustom(kb_x + 60, kb_y + 4, 0, "Key Binds", [255, 255, 255, 255], fontpixel);
     Render.FilledRect(kb_x, kb_y, 170, 2, [224, 61, 61, 255]);
     Render.FilledRect(kb_x, kb_y + 20, 170, 20 + 15 * (h.length - 1), [15, 15, 15, 20]);
     for (i = 0; i < h.length; i++)
     {
        Render.StringCustom(kb_x + 5, kb_y + 23 + 15 * i, 0, h[i], [255, 255, 255, 255], fontpixel);
        Render.StringCustom(kb_x + 123, kb_y + 23 + 15 * i, 0, "[toggled]", [255, 255, 255, 255], fontpixel);
     }
}

function movekb() {
    /*Cheat.Print('x:' + kb_x + '\n' + 'y:' + kb_y + '\n');*/
    if(!UI.IsMenuOpen()) return;
    cursor_pos = Input.GetCursorPosition();
    if(!Input.IsKeyPressed(0x01)){
    kb_is_moving = false;
    kb_old_cursor = cursor_pos;
    }
    if((cursor_pos[0] >= kb_x && cursor_pos[0] <= kb_x + 170 && cursor_pos[1] >= kb_y && cursor_pos[1] <= kb_y + 18) || (kb_is_moving)){
    kb_is_moving = true;
    kb_x = clamp(cursor_pos[0] - kb_old_cursor[0] + kb_x, 0, Render.GetScreenSize()[0] - 170);
    kb_y = clamp(cursor_pos[1] - kb_old_cursor[1] + kb_y, 0, Render.GetScreenSize()[1] - 18);
    kb_old_cursor = cursor_pos;
    UI.SetValue("Script items", "keybinds_x", kb_x);
    UI.SetValue("Script items", "keybinds_y", kb_y);
    }
}

Global.RegisterCallback("Draw", "kb");
Cheat.RegisterCallback("Draw", "movekb");
 
Сверху Снизу