var screen_size = Render.GetScreenSize();

UI.AddCheckbox("Indicator");
UI.AddColorPicker("Indicator color");

function draw() {
    local = Entity.GetLocalPlayer();
    if (!UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Indicator") || !Entity.IsValid(local) || !Entity.IsAlive(local)) return;
    font = Render.AddFont("Verdana", 8, 400);
    x = screen_size[0];
    y = screen_size[1];
    col = UI.GetColor("Misc", "JAVASCRIPT", "Script items", "Indicator color");
    real_yaw = Local.GetRealYaw();
    fake_yaw = Local.GetFakeYaw();
    delta = Math.min(Math.abs(real_yaw - fake_yaw) / 2, 60).toFixed(0);
    delta_size = Render.TextSizeCustom(delta, font);
    Render.StringCustom(x / 2, y / 2 + 20, 1, delta, [255, 255, 255, 255], font);
    Render.Circle(x / 2 + delta_size[0] - 2, y / 2 + 25, 2, [255, 255, 255, 255])
    Render.GradientRect(x / 2, y / 2 + 40, (125 / 60) * delta, 5, 1, col, [0, 0, 0, 0]);
    Render.GradientRect(x / 2 - (125 / 60) * delta + 1, y / 2 + 40, (125 / 60) * delta, 5, 1, [0, 0, 0, 0], col);
}

Cheat.RegisterCallback("Draw", "draw");