JS-скрипт Animated custom keybinds для OTC

*BLUHGANG* vs godless braindead users 15v15 *shayd
Пользователь
Статус
Оффлайн
Регистрация
20 Мар 2020
Сообщения
100
Реакции[?]
52
Поинты[?]
0
Хотел сделать что-то интересное, забил уже на кейбиндах, отдаю вам (Попытался сделать ака закругленный ректангл) Можно настроить скорость фейда и некоторые цвета.
Пожалуйста, авторизуйтесь для просмотра ссылки.
,
Пожалуйста, авторизуйтесь для просмотра ссылки.


Адекватно писать скрипты я толком не умею, думаю от этого кода воняет прилично так

JavaScript:
UI.AddLabel(" == Weak dog == ");
UI.AddDropdown( "Functions", [ "Visuals", "Rage", "Exploits"] );

UI.AddCheckbox("Custom Keybinds");

UI.AddColorPicker("Keybinds Background");
UI.AddColorPicker("Keybinds Border");

UI.AddCheckbox("Fade Bar");
UI.AddSliderFloat("Fade Speed", 0.01, 1.0);

var screen_width = Math.round(Global.GetScreenSize()[0]);

function HSVtoRGB(h, s, v)
{
    var r, g, b, i, f, p, q, t;

    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);

    switch (i % 6)
    {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }

    return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
}

function FadeBar()
{
    var colors = HSVtoRGB(Global.Realtime() * UI.GetValue("Script Items", "Fade Speed"), 1, 1); 
    Render.GradientRect(0, 0, screen_width/2, 4, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
    Render.GradientRect(screen_width/2, 0, screen_width/2, 4, 1, [colors.r, colors.g, colors.b, 255], [colors.b, colors.r, colors.g, 255]);
}

function Keybinds()
{
    if(!World.GetServerString()) return;

    var h = [];
    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 inverter");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force safe point")) {
        h.push("Safe point override");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force body aim")) {
        h.push("Force body aim");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Doubletap")) {
        h.push("Doubletap");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Hide shots")) {
        h.push("Hide shots");
    }
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Damage override")) { //хуй коня
        h.push("Damage override")
    }

    if(h.length > 0)
    {
        const x = 250;
        const y = 100;
        const width = 200;
        var font = Render.AddFont("Michroma", 7, 100);
        var font2 = Render.AddFont("Michroma", 6, 100);
        textSize = Render.TextSizeCustom("Keybinds", font);
    
        var color = UI.GetColor("Script Items", "Keybinds Border");
        var color2 = UI.GetColor("Script Items", "Keybinds Background");
        
        Render.FilledRect(x+1,y-1,width-2,1,color2);
        Render.FilledRect(x+1,y-2,width-2,1,color2);
        Render.FilledRect(x+2,y-3,width-4,1,color2);
        Render.FilledRect(x+3,y-4,width-6,1,color2);
        Render.FilledRect(x,y,width,10,color2);
    
        Symethry(x,y,1,10,color,width,0);
        Symethry(x,y-2,1,2,color,width,1);
        Symethry(x,y-3,1,1,color,width,2);
        Symethry(x,y-4,2,1,color,width,3);
        Render.FilledRect(x+5,y-5,width-10,1,color);
        Render.FilledRect(x,y+10,width,1,color);
    
        var colors = HSVtoRGB(Global.Realtime() *  UI.GetValue("Script Items", "Fade Speed"), 1, 1); 
        Render.GradientRect( x, y+10, width, 2, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
      
        Render.StringCustom( x+(width-textSize[0])/2, y-(19-textSize[1])/2, 0, "Keybinds", [ 255, 255, 255, 255 ], font );

        for (i = 0; i < h.length; i++)
        {
            Render.FilledRect(x,y+15+i*15,width,15,color2);
            Render.FilledRect(x,y+15+i*15,2,15, [colors.g, colors.b, colors.r, 255]);
            Render.FilledRect(x+width-1,y+15+i*15,1,15,color);
            textSizeLocal =  Render.TextSizeCustom(h[i], font2);
            Render.StringCustom(x+(width-textSizeLocal[0])/2, y+15+i*15+1, 0, h[i], [ 255, 255, 255, 255 ], font2 );
        }
    }   
}

function Symethry(x,y,width,height,color,base,delta)
{
    Render.FilledRect(x+delta, y, width, height, color);
    Render.FilledRect(x+base-delta-width, y, width, height, color);
}

function DrawVisuals(value)
{
    UI.SetEnabled("Script items", "Custom Keybinds", value);
    UI.SetEnabled("Script items", "Fade Speed", value);
    if(UI.GetValue("Script items", "Custom Keybinds") == true)
    {
        Keybinds();
        UI.SetEnabled("Script items", "Keybinds Background", 1);
        UI.SetEnabled("Script items", "Keybinds Border", 1);
    }
    else
    {
        UI.SetEnabled("Script items", "Keybinds Background", 0);
        UI.SetEnabled("Script items", "Keybinds Border", 0);
    }
    if(UI.GetValue("Script items", "Fade Bar") == true) FadeBar();
 
}

function SetEnabled()
{
    DrawVisuals(!UI.GetValue("Script items", "Functions"));
}

Global.RegisterCallback("Draw", "SetEnabled");
 
Дизайнер
Статус
Оффлайн
Регистрация
18 Авг 2017
Сообщения
1,933
Реакции[?]
2,259
Поинты[?]
146K
Товары в продаже
1
если тебе нужен нормальный прямоугольник с закругленными углами, используй это:

JavaScript:
// coded by enQ
function rounded_rect (from_x, from_y, to_x, to_y, radius, color) {
    var diameter = radius * 2;

    Render.FilledRect (from_x + radius, from_y,          to_x - diameter, to_y,            color); // vertical
    Render.FilledRect (from_x,          from_y + radius, to_x,            to_y - diameter, color); // horizontal

    // top
    Render.FilledCircle (from_x + radius,        from_y + radius,         radius, color); // left
    Render.FilledCircle (from_x + to_x - radius, from_y + radius,         radius, color); // right
   
    // bottom
    Render.FilledCircle (from_x + radius,        from_y + to_y - radius,  radius, color); // left
    Render.FilledCircle (from_x + to_x - radius, from_y + to_y - radius,  radius, color); // right
}
 
*BLUHGANG* vs godless braindead users 15v15 *shayd
Пользователь
Статус
Оффлайн
Регистрация
20 Мар 2020
Сообщения
100
Реакции[?]
52
Поинты[?]
0
если тебе нужен нормальный прямоугольник с закругленными углами, используй это:

JavaScript:
// coded by enQ
function rounded_rect (from_x, from_y, to_x, to_y, radius, color) {
    var diameter = radius * 2;

    Render.FilledRect (from_x + radius, from_y,          to_x - diameter, to_y,            color); // vertical
    Render.FilledRect (from_x,          from_y + radius, to_x,            to_y - diameter, color); // horizontal

    // top
    Render.FilledCircle (from_x + radius,        from_y + radius,         radius, color); // left
    Render.FilledCircle (from_x + to_x - radius, from_y + radius,         radius, color); // right

    // bottom
    Render.FilledCircle (from_x + radius,        from_y + to_y - radius,  radius, color); // left
    Render.FilledCircle (from_x + to_x - radius, from_y + to_y - radius,  radius, color); // right
}
Я пытался сделать так же, но там проблема в том, что если у цвета будет прозрачность меньше 255, то круги и ректанглы будут "наслаиваться", что будет менять их прозрачность. Во всяком случае у меня так было, думаю тут тоже
 
Начинающий
Статус
Оффлайн
Регистрация
24 Май 2020
Сообщения
12
Реакции[?]
2
Поинты[?]
0
Хотел сделать что-то интересное, забил уже на кейбиндах, отдаю вам (Попытался сделать ака закругленный ректангл) Можно настроить скорость фейда и некоторые цвета.
Пожалуйста, авторизуйтесь для просмотра ссылки.
,
Пожалуйста, авторизуйтесь для просмотра ссылки.


Адекватно писать скрипты я толком не умею, думаю от этого кода воняет прилично так

JavaScript:
UI.AddLabel(" == Weak dog == ");
UI.AddDropdown( "Functions", [ "Visuals", "Rage", "Exploits"] );

UI.AddCheckbox("Custom Keybinds");

UI.AddColorPicker("Keybinds Background");
UI.AddColorPicker("Keybinds Border");

UI.AddCheckbox("Fade Bar");
UI.AddSliderFloat("Fade Speed", 0.01, 1.0);

var screen_width = Math.round(Global.GetScreenSize()[0]);

function HSVtoRGB(h, s, v)
{
    var r, g, b, i, f, p, q, t;

    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);

    switch (i % 6)
    {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }

    return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
}

function FadeBar()
{
    var colors = HSVtoRGB(Global.Realtime() * UI.GetValue("Script Items", "Fade Speed"), 1, 1);
    Render.GradientRect(0, 0, screen_width/2, 4, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
    Render.GradientRect(screen_width/2, 0, screen_width/2, 4, 1, [colors.r, colors.g, colors.b, 255], [colors.b, colors.r, colors.g, 255]);
}

function Keybinds()
{
    if(!World.GetServerString()) return;

    var h = [];
    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 inverter");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force safe point")) {
        h.push("Safe point override");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force body aim")) {
        h.push("Force body aim");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Doubletap")) {
        h.push("Doubletap");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Hide shots")) {
        h.push("Hide shots");
    }
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Damage override")) { //хуй коня
        h.push("Damage override")
    }

    if(h.length > 0)
    {
        const x = 250;
        const y = 100;
        const width = 200;
        var font = Render.AddFont("Michroma", 7, 100);
        var font2 = Render.AddFont("Michroma", 6, 100);
        textSize = Render.TextSizeCustom("Keybinds", font);
   
        var color = UI.GetColor("Script Items", "Keybinds Border");
        var color2 = UI.GetColor("Script Items", "Keybinds Background");
       
        Render.FilledRect(x+1,y-1,width-2,1,color2);
        Render.FilledRect(x+1,y-2,width-2,1,color2);
        Render.FilledRect(x+2,y-3,width-4,1,color2);
        Render.FilledRect(x+3,y-4,width-6,1,color2);
        Render.FilledRect(x,y,width,10,color2);
   
        Symethry(x,y,1,10,color,width,0);
        Symethry(x,y-2,1,2,color,width,1);
        Symethry(x,y-3,1,1,color,width,2);
        Symethry(x,y-4,2,1,color,width,3);
        Render.FilledRect(x+5,y-5,width-10,1,color);
        Render.FilledRect(x,y+10,width,1,color);
   
        var colors = HSVtoRGB(Global.Realtime() *  UI.GetValue("Script Items", "Fade Speed"), 1, 1);
        Render.GradientRect( x, y+10, width, 2, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
     
        Render.StringCustom( x+(width-textSize[0])/2, y-(19-textSize[1])/2, 0, "Keybinds", [ 255, 255, 255, 255 ], font );

        for (i = 0; i < h.length; i++)
        {
            Render.FilledRect(x,y+15+i*15,width,15,color2);
            Render.FilledRect(x,y+15+i*15,2,15, [colors.g, colors.b, colors.r, 255]);
            Render.FilledRect(x+width-1,y+15+i*15,1,15,color);
            textSizeLocal =  Render.TextSizeCustom(h[i], font2);
            Render.StringCustom(x+(width-textSizeLocal[0])/2, y+15+i*15+1, 0, h[i], [ 255, 255, 255, 255 ], font2 );
        }
    }  
}

function Symethry(x,y,width,height,color,base,delta)
{
    Render.FilledRect(x+delta, y, width, height, color);
    Render.FilledRect(x+base-delta-width, y, width, height, color);
}

function DrawVisuals(value)
{
    UI.SetEnabled("Script items", "Custom Keybinds", value);
    UI.SetEnabled("Script items", "Fade Speed", value);
    if(UI.GetValue("Script items", "Custom Keybinds") == true)
    {
        Keybinds();
        UI.SetEnabled("Script items", "Keybinds Background", 1);
        UI.SetEnabled("Script items", "Keybinds Border", 1);
    }
    else
    {
        UI.SetEnabled("Script items", "Keybinds Background", 0);
        UI.SetEnabled("Script items", "Keybinds Border", 0);
    }
    if(UI.GetValue("Script items", "Fade Bar") == true) FadeBar();

}

function SetEnabled()
{
    DrawVisuals(!UI.GetValue("Script items", "Functions"));
}

Global.RegisterCallback("Draw", "SetEnabled");
бля чел кинь джс я код блять спастить уже минут 5 немогу
 
Участник
Статус
Оффлайн
Регистрация
14 Сен 2019
Сообщения
856
Реакции[?]
248
Поинты[?]
2K
Хотел сделать что-то интересное, забил уже на кейбиндах, отдаю вам (Попытался сделать ака закругленный ректангл) Можно настроить скорость фейда и некоторые цвета.
Пожалуйста, авторизуйтесь для просмотра ссылки.
,
Пожалуйста, авторизуйтесь для просмотра ссылки.


Адекватно писать скрипты я толком не умею, думаю от этого кода воняет прилично так

JavaScript:
UI.AddLabel(" == Weak dog == ");
UI.AddDropdown( "Functions", [ "Visuals", "Rage", "Exploits"] );

UI.AddCheckbox("Custom Keybinds");

UI.AddColorPicker("Keybinds Background");
UI.AddColorPicker("Keybinds Border");

UI.AddCheckbox("Fade Bar");
UI.AddSliderFloat("Fade Speed", 0.01, 1.0);

var screen_width = Math.round(Global.GetScreenSize()[0]);

function HSVtoRGB(h, s, v)
{
    var r, g, b, i, f, p, q, t;

    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);

    switch (i % 6)
    {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }

    return { r: Math.round(r * 255), g: Math.round(g * 255), b: Math.round(b * 255) };
}

function FadeBar()
{
    var colors = HSVtoRGB(Global.Realtime() * UI.GetValue("Script Items", "Fade Speed"), 1, 1);
    Render.GradientRect(0, 0, screen_width/2, 4, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
    Render.GradientRect(screen_width/2, 0, screen_width/2, 4, 1, [colors.r, colors.g, colors.b, 255], [colors.b, colors.r, colors.g, 255]);
}

function Keybinds()
{
    if(!World.GetServerString()) return;

    var h = [];
    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 inverter");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force safe point")) {
        h.push("Safe point override");
    }
    if (UI.IsHotkeyActive("Rage", "GENERAL", "General", "Force body aim")) {
        h.push("Force body aim");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Doubletap")) {
        h.push("Doubletap");
    }
    if (UI.IsHotkeyActive("Rage", "Exploits", "Hide shots")) {
        h.push("Hide shots");
    }
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Damage override")) { //хуй коня
        h.push("Damage override")
    }

    if(h.length > 0)
    {
        const x = 250;
        const y = 100;
        const width = 200;
        var font = Render.AddFont("Michroma", 7, 100);
        var font2 = Render.AddFont("Michroma", 6, 100);
        textSize = Render.TextSizeCustom("Keybinds", font);
   
        var color = UI.GetColor("Script Items", "Keybinds Border");
        var color2 = UI.GetColor("Script Items", "Keybinds Background");
       
        Render.FilledRect(x+1,y-1,width-2,1,color2);
        Render.FilledRect(x+1,y-2,width-2,1,color2);
        Render.FilledRect(x+2,y-3,width-4,1,color2);
        Render.FilledRect(x+3,y-4,width-6,1,color2);
        Render.FilledRect(x,y,width,10,color2);
   
        Symethry(x,y,1,10,color,width,0);
        Symethry(x,y-2,1,2,color,width,1);
        Symethry(x,y-3,1,1,color,width,2);
        Symethry(x,y-4,2,1,color,width,3);
        Render.FilledRect(x+5,y-5,width-10,1,color);
        Render.FilledRect(x,y+10,width,1,color);
   
        var colors = HSVtoRGB(Global.Realtime() *  UI.GetValue("Script Items", "Fade Speed"), 1, 1);
        Render.GradientRect( x, y+10, width, 2, 1, [colors.g, colors.b, colors.r, 255], [colors.r, colors.g, colors.b, 255]);
     
        Render.StringCustom( x+(width-textSize[0])/2, y-(19-textSize[1])/2, 0, "Keybinds", [ 255, 255, 255, 255 ], font );

        for (i = 0; i < h.length; i++)
        {
            Render.FilledRect(x,y+15+i*15,width,15,color2);
            Render.FilledRect(x,y+15+i*15,2,15, [colors.g, colors.b, colors.r, 255]);
            Render.FilledRect(x+width-1,y+15+i*15,1,15,color);
            textSizeLocal =  Render.TextSizeCustom(h[i], font2);
            Render.StringCustom(x+(width-textSizeLocal[0])/2, y+15+i*15+1, 0, h[i], [ 255, 255, 255, 255 ], font2 );
        }
    }  
}

function Symethry(x,y,width,height,color,base,delta)
{
    Render.FilledRect(x+delta, y, width, height, color);
    Render.FilledRect(x+base-delta-width, y, width, height, color);
}

function DrawVisuals(value)
{
    UI.SetEnabled("Script items", "Custom Keybinds", value);
    UI.SetEnabled("Script items", "Fade Speed", value);
    if(UI.GetValue("Script items", "Custom Keybinds") == true)
    {
        Keybinds();
        UI.SetEnabled("Script items", "Keybinds Background", 1);
        UI.SetEnabled("Script items", "Keybinds Border", 1);
    }
    else
    {
        UI.SetEnabled("Script items", "Keybinds Background", 0);
        UI.SetEnabled("Script items", "Keybinds Border", 0);
    }
    if(UI.GetValue("Script items", "Fade Bar") == true) FadeBar();

}

function SetEnabled()
{
    DrawVisuals(!UI.GetValue("Script items", "Functions"));
}

Global.RegisterCallback("Draw", "SetEnabled");
Ну не плохо, респект
 
Сверху Снизу