JS info bar [ fps / ping / speed ] for otc3

Статус
В этой теме нельзя размещать новые ответы.
  • 125
  • 38
Контакты для связи отсутствуют.
1611773132943.png


JavaScript:
const draw_outline_text = function(x, y, align, string, color, fontname) {
    Render.StringCustom(x - 1, y - 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x - 1, y, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x - 1, y + 1, align, string, [0, 0, 0, 255], fontname);
 
    Render.StringCustom(x, y + 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x, y - 1, align, string, [0, 0, 0, 255], fontname);
 
    Render.StringCustom(x + 1, y - 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x + 1, y, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x + 1, y + 1, align, string, [0, 0, 0, 255], fontname);
 
    Render.StringCustom(x, y, align, string, color, fontname);
}

const get_velocity = function(index) {
    const velocity = Entity.GetProp(index, "CBasePlayer", "m_vecVelocity[0]");
    return Math.sqrt(velocity[0] * velocity[0] + velocity[1] * velocity[1]);
}

const onDraw = function() {
    const screen = Global.GetScreenSize(),
    x = screen[0] / 2, y = screen[1] - 19;
    const font = Render.AddFont("Calibri", 8, 100);
    const font1 = Render.AddFont("Verdana", 8, 800);
    const fps = Math.floor(1 / Global.Frametime());
    const ping = Math.round(Local.Latency( ) * 1000 - 16);
    const velocity = get_velocity(Entity.GetLocalPlayer());
    const speed = Math.round(velocity);
    if(ping < 1) ping = 0; if(!speed) speed = 0;

    Render.GradientRect(x - 250, y, 250, 19, 1, [40, 40, 40, 0], [0, 0, 0, 90]);
    Render.GradientRect(x, y, 250, 19, 1, [0, 0, 0, 90], [40, 40, 40, 0]);

    Render.StringCustom(x - 117, y + 1, 1, "" + ping, [149, 255, 0, 255], font1);
    draw_outline_text(x - 95, y + 2, 1, "ping", [185, 185, 185, 255], font);

    Render.StringCustom(x - 13, y + 1, 1, "" + fps, [149, 255, 0, 255], font1);
    draw_outline_text(x + 10, y + 2, 1, "fps", [185, 185, 185, 255], font);

    Render.StringCustom(x + 75, y + 1, 1, "" + speed, [185, 185, 185, 255], font1);
    draw_outline_text(x + 105, y + 2, 1, "speed", [185, 185, 185, 255], font);
}

Cheat.RegisterCallback("Draw", "onDraw");
 
  • 7
  • 1
Контакты для связи отсутствуют.
Посмотреть вложение 5573

JavaScript:
const draw_outline_text = function(x, y, align, string, color, fontname) {
    Render.StringCustom(x - 1, y - 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x - 1, y, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x - 1, y + 1, align, string, [0, 0, 0, 255], fontname);

    Render.StringCustom(x, y + 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x, y - 1, align, string, [0, 0, 0, 255], fontname);

    Render.StringCustom(x + 1, y - 1, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x + 1, y, align, string, [0, 0, 0, 255], fontname);
    Render.StringCustom(x + 1, y + 1, align, string, [0, 0, 0, 255], fontname);

    Render.StringCustom(x, y, align, string, color, fontname);
}

const get_velocity = function(index) {
    const velocity = Entity.GetProp(index, "CBasePlayer", "m_vecVelocity[0]");
    return Math.sqrt(velocity[0] * velocity[0] + velocity[1] * velocity[1]);
}

const onDraw = function() {
    const screen = Global.GetScreenSize(),
    x = screen[0] / 2, y = screen[1] - 19;
    const font = Render.AddFont("Calibri", 8, 100);
    const font1 = Render.AddFont("Verdana", 8, 800);
    const fps = Math.floor(1 / Global.Frametime());
    const ping = Math.round(Local.Latency( ) * 1000 - 16);
    const velocity = get_velocity(Entity.GetLocalPlayer());
    const speed = Math.round(velocity);
    if(ping < 1) ping = 0; if(!speed) speed = 0;

    Render.GradientRect(x - 250, y, 250, 19, 1, [40, 40, 40, 0], [0, 0, 0, 90]);
    Render.GradientRect(x, y, 250, 19, 1, [0, 0, 0, 90], [40, 40, 40, 0]);

    Render.StringCustom(x - 117, y + 1, 1, "" + ping, [149, 255, 0, 255], font1);
    draw_outline_text(x - 95, y + 2, 1, "ping", [185, 185, 185, 255], font);

    Render.StringCustom(x - 13, y + 1, 1, "" + fps, [149, 255, 0, 255], font1);
    draw_outline_text(x + 10, y + 2, 1, "fps", [185, 185, 185, 255], font);

    Render.StringCustom(x + 75, y + 1, 1, "" + speed, [185, 185, 185, 255], font1);
    draw_outline_text(x + 105, y + 2, 1, "speed", [185, 185, 185, 255], font);
}

Cheat.RegisterCallback("Draw", "onDraw");
тут какой-то баг, что я ходить не могу даже, а позже вообще крашит
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу