/*
author - rmx#6930
*/
/*
feel free to paste this code, just remember to give me credits
*/
/* UI */
UI.AddCheckbox("Desync indicator");
UI.AddColorPicker("Color");
/* function */
function desyncind() {
if (UI.GetValue("Script items", "Desync indicator")) {
var color = UI.GetColor("Script items", "Color");
var screen = Render.GetScreenSize();
x = screen[0];
y = screen[1];
font = Render.AddFont("Verdana", 10, 100);
local = Entity.GetLocalPlayer();
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);
/* outline */
Render.String(x / 2.002, y / 1.996 + 10, 1, delta, [0, 0, 0, 225]);
/* text and line */
Render.StringCustom(x / 2, y / 2 + 10, 1, delta, [color[0], color[1], color[2], color[3]], font);
Render.GradientRect(x / 2, y / 1.975 + 25, 0.983 * delta, 3.3, 1, [color[0], color[1], color[2], color[3]], [color[0], color[1], color[2], color[3]]);
Render.GradientRect(x / 2 - 0.983 * delta + 1, y / 1.975 + 25, 0.983 * delta, 3.3, 1, [color[0], color[1], color[2], color[3]], [color[0], color[1], color[2], color[3]]);
}
}
/* callback */
Cheat.RegisterCallback("Draw", "desyncind");