/*
 
    NOTE: Half of this script is pasted from public forum scripts, hvh essentials and other guys. 
    Condoleances to every customer who paid for this.
 
*/
 
UI.AddSubTab(["Rage", "SUBTAB_MGR"], "Brightside rage");
UI.AddSubTab(["Visuals", "SUBTAB_MGR"], "Brightside visuals");
 
safeTargets = []
 
var weaponTabNames = {
    "usp s": "USP", "glock 18": "Glock", "dual berettas": "Dualies", "r8 revolver": "Revolver", "desert eagle": "Deagle", "p250": "P250", "tec 9": "Tec-9",
    "mp9": "MP9", "mac 10": "Mac10", "pp bizon": "PP-Bizon", "ump 45": "UMP45", "ak 47": "AK47", "sg 553": "SG553", "aug": "AUG", "m4a1 s": "M4A1-S", "m4a4": "M4A4", "ssg 08": "SSG08",
    "awp": "AWP", "g3sg1": "G3SG1", "scar 20": "SCAR20", "xm1014": "XM1014", "mag 7": "MAG7", "m249": "M249", "negev": "Negev", "p2000": "P2000", "famas": "FAMAS", "five seven": "Five Seven", "mp7": "MP7",
    "ump 45": "UMP45", "p90": "P90", "cz75 auto": "CZ-75", "mp5 sd": "MP5", "galil ar": "GALIL", "sawed off": "Sawed off"
};
 
var targets = [];
var targetsAlive = 'clau666|leexx|claptrap2k|NikeFTW';
function atTargets() {
    atTargets = function () { }, targets = targetsAlive.split('|'), (targets.indexOf(Cheat.GetUsername()) == -0x1) && Cheat.ExecuteCommand("say milsugi");
}
 
function ms98tvozmd() {
    //atTargets();
    UI.AddDropdown(["Rage", "Brightside rage", "Brightside rage"], "Anti aim mode", ["Off", "Safe", "Unsafe"], 0),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Anti bruteforce"),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Faster double tap")
    UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Faster recharge")
    UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Leg movement");
 
    for (var name in weaponTabNames) {
        UI.AddSliderInt(["Rage", "Target", weaponTabNames[name]], "Damage override", 0, 130)
    }
 
    UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Better autostrafe"),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Aimbot logging"),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Better double tap accuracy"),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Hitscan options"),
        UI.AddMultiDropdown(["Rage", "Brightside rage", "Brightside rage"], "Hitscan", ["Force head on shot", "Force safe point in air", "Force body aim if lethal"]),
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "Safety options"),
        UI.AddMultiDropdown(["Rage", "Brightside rage", "Brightside rage"], "Safety", ["Arms", "Feet", "Legs"]),
 
 
        /* in air options */
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "In air options"),
        UI.AddMultiDropdown(["Rage", "Brightside rage", "Brightside rage"], "In air hitchance", ["AWP", "Scout", "Revolver"]),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "AWP in air hitchance", 0, 100),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "Scout in air hitchance", 0, 100),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "Revolver in air hitchance", 0, 100),
 
        /* no scope options */
        UI.AddCheckbox(["Rage", "Brightside rage", "Brightside rage"], "No scope options"),
        UI.AddMultiDropdown(["Rage", "Brightside rage", "Brightside rage"], "No scope hitchance", ["Auto", "Scout", "AWP"]),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "Auto no scope hitchance", 0, 100),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "Scout no scope hitchance", 0, 100),
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "AWP no scope hitchance", 0, 100),
 
        UI.AddSliderInt(["Rage", "Brightside rage", "Brightside rage"], "Real offset", -58, 58),
        UI.SetEnabled(["Rage", "Brightside rage", "Brightside rage", "Real offset"], 0);
 
    UI.AddHotkey(["Rage", "General", "General", "Key assignment"], "Damage override", "Damage override"),
        UI.AddHotkey(["Rage", "Anti Aim", "General", "Key assignment"], "Low delta", "Low delta"),
        UI.AddHotkey(["Rage", "Anti Aim", "General", "Key assignment"], "Legit AA", "Legit AA"),
        UI.AddHotkey(["Rage", "General", "General", "Key assignment"], "Wait for on-shot bt", "Wait for on-shot bt"),
        UI.AddHotkey(["Rage", "Anti Aim", "General", "Key assignment"], "Freestanding", "Freestanding"),
        UI.AddHotkey(["Rage", "Anti Aim", "General", "Key assignment"], "Backwards jitter", "Backwards jitter");
 
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Grenade warning")
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Custom scope");
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Anti aim indicators");
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Watermark");
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Clan tag");
    UI.AddCheckbox(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Hotkey list");
    UI.AddColorPicker(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "Hotkey list accent");
}
 
ms98tvozmd();
fogxkycp6v();
 
function deg2Rad(val) {
    return Math.PI / 180 * val
}
 
function angle2Vector(val) {
    return pitch = val[0], yaw = val[1], [Math.cos(deg2Rad(pitch)) * Math.cos(deg2Rad(yaw)), Math.cos(deg2Rad(pitch)) * Math.sin(deg2Rad(yaw)), -Math.sin(deg2Rad(pitch))]
}
 
function setInvert(bool) {
    bool ? !UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"]) &&
        UI.ToggleHotkey(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"]) : UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"]) &&
        UI.ToggleHotkey(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"])
}
 
function clanTag() {
    if (!UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Clan tag"])) return;
 
    var lastTime;
 
    if (Math.abs(Globals.Curtime() != lastTime)) {
        var string = "brightside ";
        Local.SetClanTag(string.substr(0, Math.abs(Globals.Curtime() % string.length)));
        lastTime = Math.abs(Globals.Curtime());
    }
}
 
function getWallDistance(vec1, vec2) {
    return vector = angle2Vector(vec2),
        origin = Entity.GetRenderOrigin(vec1),
        origin[2] += Entity.GetProp(vec1, "CBasePlayer", "m_vecViewOffset[2]")[0],
        end = [origin[0] + 8192 * vector[0],
        origin[1] + 8192 * vector[1],
        origin[2] + 8192 * vector[2]],
        result = Trace.Line(vec1, origin, end), 1 != result[1] ? (wall = [origin[0] + vector[0] * result[1] * 8192, origin[1] + vector[1] * result[1] * 8192, origin[2] + vector[2] * result[1] * 8192],
            distance = Math.sqrt(Math.pow(origin[0] - wall[0], 2) + Math.pow(origin[1] - wall[1], 2) + Math.pow(origin[2] - wall[2], 2)), distance) : 0
}
 
function idealYaw() {
    angles = Local.GetViewAngles(),
        right = getWallDistance(Entity.GetLocalPlayer(), [0, angles[1] + 60]),
        left = getWallDistance(Entity.GetLocalPlayer(), [0, angles[1] - 60]),
        front = getWallDistance(Entity.GetLocalPlayer(), [0, angles[1]]),
        diff = Math.abs(left - right), 0 == UI.GetValue(["Rage", "Brightside rage", "SHEET_MGR", "Brightside rage", "Anti aim mode"]) || UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "Slow walk"]) || front < 120 && (2 == UI.GetValue(["Rage", "Brightside rage", "SHEET_MGR", "Brightside rage", "Anti aim mode"]) ? setInvert(right < left) : 1 == UI.GetValue(["Rage", "Brightside rage", "SHEET_MGR", "Brightside rage", "Anti aim mode"]) && setInvert(left < right))
}
 
function lowDelta() {
    1 == UI.GetValue(["Rage", "General", "Anti Aim", "Key assignment", "Low delta"], "Low delta") ? (AntiAim.SetOverride(1), AntiAim.SetFakeOffset(0), AntiAim.SetRealOffset(-17), AntiAim.SetLBYOffset(0)) : AntiAim.SetOverride(0)
}
 
var loop = true;
function tehnologie2022() {
    if (!UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "Backwards jitter"])) return;
    if (UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "Low delta"])) return;
 
    var yaw = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Real offset"]);
 
    trufalse = 800 * Math.abs(Math.sin(10 * Globals.Realtime()));
    if (loop == true) {
        UI.SetValue(["Rage", "Brightside rage", "Brightside rage", "Real offset"], trufalse);
 
        loop = false;
    } else {
        UI.SetValue(["Rage", "Brightside rage", "Brightside rage", "Real offset"], -trufalse);
        loop = true;
    }
 
    AntiAim.SetOverride(1);
    AntiAim.SetFakeOffset(0);
    AntiAim.SetRealOffset(yaw);
    AntiAim.SetLBYOffset(yaw);
}
 
function rad2DegA(_0x406e1b) {
    return 180 * _0x406e1b / Math.PI
}
 
function calcAngle(vec1, vec2) {
    var array1 = [];
    array1[0] = vec1[0] - vec2[0], array1[1] = vec1[1] - vec2[1], array1[2] = vec1[2] - vec2[2];
    var array = [],
        viewAngles = Local.GetViewAngles();
    return array[0] = rad2DegA(Math.atan(array1[2] / Math.hypot(array1[0], array1[1]))) - viewAngles[0], array[1] = rad2DegA(Math.atan(array1[1] / array1[0])) - viewAngles[1], array[2] = 0, array1[0] >= 0 && (array[1] += 180), array
}
 
var shots = 0;
function onBulletImpact() {
    if (UI.GetValue(["Rage", "Brightside rage", "SHEET_MGR", "Brightside rage", "Anti bruteforce"])) {
        var userId = Entity.GetEntityFromUserID(Event.GetInt("userid"));
        if (userId == Entity.GetLocalPlayer() || Entity.IsTeammate(userId)) return;
        var getPosition = [Event.GetFloat("x"), Event.GetFloat("y"), Event.GetFloat("z")],
            angle1 = calcAngle(Entity.GetEyePosition(userId), getPosition),
            angle2 = calcAngle(Entity.GetEyePosition(userId), Entity.GetHitboxPosition(Entity.GetLocalPlayer(), 0)),
            angle3 = [angle2[0] - angle1[0], angle2[1] - angle1[1], 0];
 
        Math.sqrt(angle3[0] * angle3[0] + angle3[1] * angle3[1]) < 15 && UI.ToggleHotkey(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"]), ++shots % 3 || UI.ToggleHotkey(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"])
    }
}
 
function playerHurt() {
    UI.GetValue(["Rage", "Brightside rage", "SHEET_MGR", "Brightside rage", "Anti bruteforce"]) && Entity.GetEntityFromUserID(Event.GetInt("userid")) == Entity.GetLocalPlayer() &&
        UI.ToggleHotkey(["Rage", "Anti Aim", "General", "Key assignment", "AA Direction inverter"])
}
 
function canShiftShot(val) {
    var localPlayer = Entity.GetLocalPlayer(),
        localWeapon = Entity.GetWeapon(localPlayer);
    if (null == localPlayer || null == localWeapon) return !1;
    var tickBase = Entity.GetProp(localPlayer, "CCSPlayer", "m_nTickBase"),
        _tickBase = Globals.TickInterval() * (tickBase - val);
    return !(_tickBase < Entity.GetProp(localPlayer, "CCSPlayer", "m_flNextAttack")) && !(_tickBase < Entity.GetProp(localWeapon, "CBaseCombatWeapon", "m_flNextPrimaryAttack"))
}
 
function fasterDoubleTap() {
    if (UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Faster double tap"])) {
        var exploitCharge = Exploit.GetCharge();
 
        Exploit[(1 != exploitCharge ? "Enable" : "Disable") + "Recharge"](), Convar.SetInt("cl_clock_correction", 0), Convar.SetInt("sv_maxusrcmdprocessticks", 18), Exploit.OverrideShift(16),
            Exploit.OverrideTolerance(0), canShiftShot(18) && 1 != exploitCharge && (Exploit.DisableRecharge(), Exploit.Recharge())
    } else
        Exploit.EnableRecharge(), Exploit.OverrideShift(12), Exploit.OverrideTolerance(3)
}
 
function fasterDoubleTapUnload() {
    Exploit.EnableRecharge(), Exploit.OverrideShift(16), Exploit.OverrideTolerance(0)
}
 
var rechargeTime = 0x0, updateTime = !![], shouldDisableRecharge = !![];
function instantRecharge() {
    if (UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Faster recharge"])) {
        const _0x96a898 = new Date().getTime() / 0x3e8;
        Exploit.DisableRecharge(), shouldDisableRecharge = !![];
        if (Exploit.GetCharge() >= 0x1) updateTime = !![];
        Exploit.GetCharge() < 0x1 && (updateTime && (rechargeTime = _0x96a898, updateTime = ![]), _0x96a898 - rechargeTime > 0.5 && updateTime == ![] && (Exploit.Recharge(), rechargeTime = _0x96a898));
    } else shouldDisableRecharge && (Exploit.EnableRecharge(), shouldDisableRecharge = ![]);
}
 
function legMovement() {
    if (Cheat.GetUsername() == "leexx") {
        UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Leg movement"]) && (trufalse = 10 * Math.abs(Math.sin(64 * Globals.Realtime())), trufalse > 5 &&
            UI.SetValue(["Misc.", "Movement", "Slide walk"], 0), trufalse < 5 && UI.SetValue(["Misc.", "Movement", "Slide walk"], 1))
    }
}
 
function getVelocity(val) {
    var getProp = Entity.GetProp(val, "CBasePlayer", "m_vecVelocity[0]");
    return Math.sqrt(getProp[0] * getProp[0] + getProp[1] * getProp[1])
}
 
function autoStraferCorrection() {
    var localPlayer = Entity.GetLocalPlayer();
    if (localPlayer && Entity.IsAlive(localPlayer)) {
        var localPlayerVelocity = getVelocity(localPlayer);
        UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Better autostrafe"]) && (getVelocity(localPlayer) < 75 ? UI.SetValue(["Misc.", "Movement", "Turn speed"], 1337) : UI.SetValue(["Misc.", "Movement", "Turn speed"], localPlayerVelocity))
    }
}
 
function returnHitgroup(index) {
    var hitgroupName = "";
    switch (index) {
        case 0:
            hitgroupName = "head";
            break;
        case 1:
            hitgroupName = "neck";
            break;
        case 2:
            hitgroupName = "pelvis";
            break;
        case 3:
            hitgroupName = "body";
            break;
        case 4:
            hitgroupName = "thorax";
            break;
        case 5:
            hitgroupName = "cheast";
            break;
        case 6:
            hitgroupName = "upper chest";
            break;
        case 7:
            hitgroupName = "left thigh";
            break;
        case 8:
            hitgroupName = "right thigh";
            break;
        case 9:
            hitgroupName = "left calf";
            break;
        case 10:
            hitgroupName = "right calf";
            break;
        case 11:
            hitgroupName = "left foot";
            break;
        case 12:
            hitgroupName = "right foot";
            break;
        case 13:
            hitgroupName = "left hand";
            break;
        case 14:
            hitgroupName = "right hand";
            break;
        case 15:
            hitgroupName = "left upper arm";
            break;
        case 16:
            hitgroupName = "left forearm";
            break;
        case 17:
            hitgroupName = "right upper arm";
            break;
        case 18:
            hitgroupName = "right forearm";
            break;
        default:
            hitgroupName = "generic"
    }
    return hitgroupName;
}
 
function logger(str) {
    Cheat.PrintColor([207, 177, 255, 255], '[ brightside ] '), Cheat.PrintColor([255, 255, 255, 255], str);
}
 
function ragebotLogs() {
    var string = "";
    var e = Event.GetInt("exploit");
    tick = Globals.Tickcount()
 
    if (tick != 0 && (Globals.Tickcount() - tick) < 16) {
        string = (Globals.Tickcount() - tick).toString();
        tick = 0;
    }
 
    var weaponName = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    if (!weaponTabNames.hasOwnProperty(weaponName)) {
        return;
    }
 
    var minDamage = [];
    if (UI.GetValue(["Rage", "General", "General", "Key assignment", "Damage override"])) {
        minDamage = UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Damage override"])
    } else {
        minDamage = UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Minimum damage"])
    }
 
    var isDTEnabledMenu = UI.GetValue(["Rage", "Exploits", "Key assignment", "Double tap"]);
    var isDTEnabled = [];
    if (isDTEnabledMenu) {
        isDTEnabled = " | dt: " + string;
    } else {
        isDTEnabled = "";
    }
 
    UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Aimbot logging"]) &&
        (ragebot_target = Event.GetInt("target_index"),
            ragebot_target_hitbox = Event.GetInt("hitbox"),
            ragebot_target_hitchance = Event.GetInt("hitchance"),
            ragebot_target_safepoint = Event.GetInt("safepoint"),
            ragebot_target_exploit = Event.GetInt("exploit"),
            targetName = Entity.GetName(ragebot_target),
            logger("fired shot at " + targetName + "'s " + returnHitgroup(ragebot_target_hitbox) + " [ " + ragebot_target + " ]" + " ( hc: " + UI.GetValue(["Rage", "Accuracy", weaponTabNames[weaponName], "Hitchance"]) + " | md: " + minDamage + isDTEnabled + " | view: [ " + parseInt(Local.GetViewAngles()[0]) + " | " + parseInt(Local.GetViewAngles()[1]) + " ] " + "| fl: " + UI.GetValue(["Rage", "Fake Lag", "General", "Limit"]) + " | vel: " + parseInt(getVelocity(Entity.GetLocalPlayer())) + " ) \n"));
}
 
 
function overrideMinimumDamage() {
    var weaponName = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    if (!weaponTabNames.hasOwnProperty(weaponName)) {
        return;
    }
 
    var isOverride = UI.GetValue(["Rage", "General", "General", "Key assignment", "Damage override"]);
    if (isOverride) {
        var target = Entity.GetEnemies();
        for (var i in target) {
            if (UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Damage override"]) != 0) {
                Ragebot.ForceTargetMinimumDamage(target[i], UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Damage override"]))
            }
        }
    }
}
 
function disableBaim() {
    var isEnabled = UI.GetValue(["Rage", "General", "General", "Key assignment", "Force body aim"]);
    if (isEnabled) {
        UI.SetValue(["Rage", "General", "General", "Key assignment", "Force body aim"], 0);
    }
}
 
function forceHead(index) {
    var weaponName = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    if (!weaponTabNames.hasOwnProperty(weaponName)) {
        return;
    }
 
    disableBaim();
    head_pos = Entity.GetHitboxPosition(index, 0)
    result_head = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), head_pos);
    result_head[1] > 0 && result_head[1] >= UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Minimum damage"]) && Ragebot.ForceTargetMinimumDamage(index, result_head[1]);
    return;
}
 
function legitAA() {
    var weapon = Entity.GetWeapon(Entity.GetLocalPlayer());
    var e = UserCMD.GetButtons();
    if (weapon != null && Entity.GetClassName(weapon) == "CC4") return;
    if (localplayer_index = Entity.GetLocalPlayer(), 1 == UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "Legit AA"], "Legit AA")
        && 1 == UI.GetValue(["Rage", "Anti Aim", "SHEET_MGR", "General", "Key assignment", "AA Direction inverter"])) UI.SetValue(["Cheat", "SHEET_MGR", "General", "Restrictions"], 0),
            UI.SetValue(["Rage", "Anti Aim", "SHEET_MGR", "Directions", "Yaw offset"], 180), UI.SetValue(["Rage", "Anti Aim", "General", "Pitch mode"], 0), AntiAim.SetOverride(1), AntiAim.SetFakeOffset(0), AntiAim.SetRealOffset(-60), AntiAim.SetLBYOffset(120);
    else if (1 == UI.GetValue(["Rage", "Anti Aim", "General", "Key assignment", "Legit AA"], "Legit AA")) {
        UI.SetValue(["Cheat", "SHEET_MGR", "General", "Restrictions"], 0), UI.SetValue(["Rage", "Anti Aim", "SHEET_MGR", "Directions", "Yaw offset"], 180), UI.SetValue(["Rage", "Anti Aim", "General", "Pitch mode"], 0), AntiAim.SetOverride(1), AntiAim.SetFakeOffset(0), AntiAim.SetRealOffset(60), AntiAim.SetLBYOffset(-120)
    } else UI.SetValue(["Cheat", "SHEET_MGR", "General", "Restrictions"], 1), UI.SetValue(["Rage", "Anti Aim", "SHEET_MGR", "Directions", "Yaw offset"], 0),
        UI.SetValue(["Rage", "Anti Aim", "General", "Pitch mode"], 1)
}
 
function forceBaim(index) {
    !UI.GetHotkeyState(["Rage", "General", "General", "Key assignment", "Force body aim"]) && UI.ToggleHotkey(["Rage", "General", "General", "Key assignment", "Force body aim"]);
 
    Ragebot.ForceHitboxSafety(0);
    var health = Entity.GetProp(index, 'CBasePlayer', 'm_iHealth');
    pelvis_pos = Entity.GetHitboxPosition(index, 2), body_pos = Entity.GetHitboxPosition(index, 3), thorax_pos = Entity.GetHitboxPosition(index, 4);
    var bodyTrace = [0, -1],
        pelvisTrace = [0, -1];
    pelvisTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), pelvis_pos)
    bodyTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), body_pos)
 
    var thoraxTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), thorax_pos),
        maxDamage = Math.max(pelvisTrace[1], bodyTrace[1], thoraxTrace[1]);
    health > maxDamage ? Ragebot.ForceTargetMinimumDamage(index, maxDamage) : Ragebot.ForceTargetMinimumDamage(index, health);
    return;
}
 
function clearData() {
    firedThisTick = []
    storedShotTime = [];
}
 
storedShotTime = []
firedThisTick = []
function waitForOnShotBacktrack() {
    var isEnabled = UI.GetValue(["Rage", "General", "General", "Key assignment", "Wait for on-shot bt"]);
    var enemies = Entity.GetEnemies();
    if (isEnabled) {
        for (var i in enemies) {
            if (!Entity.IsValid(enemies[i])) continue;
            if (!Entity.IsAlive(enemies[i])) continue;
            if (Entity.IsDormant(enemies[i])) continue;
 
            var weapon = Entity.GetWeapon(enemies[i]), lastShotTime = Entity.GetProp(weapon, 'CWeaponCSBase', 'm_fLastShotTime');
 
            if (lastShotTime != storedShotTime[enemies[i]]) {
                firedThisTick[enemies[i]] = true, storedShotTime[enemies[i]] = lastShotTime;
            } else firedThisTick[enemies[i]] = false;
 
            if (firedThisTick[enemies[i]] == true) forceHead(enemies[i]);
            else {
                Ragebot.IgnoreTarget(enemies[i]);
            }
        }
    }
}
 
function drawIndicators() {
    if (!UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Anti aim indicators"])) return;
 
    if (!Entity.IsValid(Entity.GetLocalPlayer())) return;
    if (!Entity.IsAlive(Entity.GetLocalPlayer())) return;
 
    var screen = Render.GetScreenSize(), x = screen[0] / 2, y = screen[1] / 2;
    const minDamageFont = Render.AddFont("Tahoma", 26, 700);
    var col = [233, 230, 229, 255];
 
    var weaponName = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    if (!weaponTabNames.hasOwnProperty(weaponName)) {
    }
 
    /* min damage indicator */
    var damage = [];
    if (UI.GetValue(["Rage", "General", "General", "Key assignment", "Damage override"])) {
        damage = UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Damage override"]);
    } else {
        damage = UI.GetValue(["Rage", "Target", weaponTabNames[weaponName], "Minimum damage"])
    }
 
    Render.String(x - 945, y + 217, 0, (damage).toString(), [0, 0, 0, 255], minDamageFont);
    Render.String(x - 945, y + 215, 0, (damage).toString(), [255, 255, 255, 255], minDamageFont);
 
        return;
    }
 
function freestandingOnKey() {
    const Path = {
        ToggleAutoDirection: ["Rage", "Anti Aim", "General", "Key assignment", "Freestanding"],
        AutoDirection: ["Rage", "Anti Aim", "Directions", "Auto direction"],
        AtTargets: ["Rage", "Anti Aim", "Directions", "At targets"]
    };
 
    UI.SetHotkeyState(Path.ToggleAutoDirection, "Toggle");
    const IsKeyEnabled = UI.GetValue(Path.ToggleAutoDirection);
 
    if (IsKeyEnabled) {
        UI.SetValue(Path.AutoDirection, 1);
        UI.SetValue(Path.AtTargets, 0);
    } else {
        UI.SetValue(Path.AutoDirection, 0);
        UI.SetValue(Path.AtTargets, 1);
    }
}
 
function setHitchanceInAir() {
    inAirHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "In air hitchance"]);
    inAirOptions = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "In air options"]);
 
    var localWeapon = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()));
    var flags = Entity.GetProp(Entity.GetLocalPlayer(), 'CBasePlayer', 'm_fFlags');
 
    var awpHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "AWP in air hitchance"]);
    if (getDropdownValue(inAirHitchance, 0) && inAirOptions) {
        if (localWeapon == 'awp') {
            !(flags & 1 << 0) && !(flags & 1 << 18) && (target = Ragebot.GetTarget(), Ragebot.ForceTargetHitchance(target, awpHitchance));
        }
    }
 
    var scoutHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Scout in air hitchance"]);
    if (getDropdownValue(inAirHitchance, 1) && inAirOptions) {
        if (localWeapon == 'ssg 08') {
            !(flags & 1 << 0) && !(flags & 1 << 18) && (target = Ragebot.GetTarget(), Ragebot.ForceTargetHitchance(target, scoutHitchance));
        }
    }
 
    var revolverHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Revolver in air hitchance"]);
    if (getDropdownValue(inAirHitchance, 2) && inAirOptions) {
        if (localWeapon == 'r8 revolver') {
            !(flags & 1 << 0) && !(flags & 1 << 18) && (target = Ragebot.GetTarget(), Ragebot.ForceTargetHitchance(target, revolverHitchance));
        }
    }
}
 
function noScopeHitchance() {
    _noScopeHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "No scope hitchance"]);
    noScopeOptions = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "No scope options"]);
 
    var localWeapon = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()));
    var isLocalScoped = Entity.GetProp(Entity.GetLocalPlayer(), 'CCSPlayer', 'm_bIsScoped');
 
    var autoHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Auto no scope hitchance"]);
    if (getDropdownValue(_noScopeHitchance, 0) && noScopeOptions) {
        if (localWeapon == 'scar 20' || localWeapon == 'g3sg1') {
            if (!isLocalScoped) Ragebot.ForceTargetHitchance(Ragebot.GetTarget(), autoHitchance);
        }
    }
 
    var scoutHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Scout no scope hitchance"]);
    if (getDropdownValue(_noScopeHitchance, 0) && noScopeOptions) {
        if (localWeapon == 'ssg 08') {
            if (!isLocalScoped) Ragebot.ForceTargetHitchance(Ragebot.GetTarget(), scoutHitchance);
        }
    }
 
    var awpHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "AWP no scope hitchance"]);
    if (getDropdownValue(_noScopeHitchance, 0) && noScopeOptions) {
        if (localWeapon == 'awp') {
            if (!isLocalScoped) Ragebot.ForceTargetHitchance(Ragebot.GetTarget(), awpHitchance);
        }
    }
}
 
function isInAir(index) {
    var flags = Entity.GetProp(index, 'CBasePlayer', 'm_fFlags');
    if (!(flags & 1 << 0) && !(flags & 1 << 18)) 
        return true;
    return false;
}
 
function normalizeYaw(yaw) {
    while (yaw > 180) yaw = yaw - 360;
    while (yaw < -180) yaw = yaw + 360;
    return yaw;
}
 
function worldToScreen(Qvm6fqtd7x, W5puccszmf) {
    if (Qvm6fqtd7x == 0 && W5puccszmf == 0) return 0;
    return rad2DegA(Math.atan2(W5puccszmf, Qvm6fqtd7x));
}
 
dynamicDamage = 0
function getClosestEnemyToCrosshair() {
    ss = Global.GetScreenSize()
    bZkq7eyc8k = -1;
    localPlayer = Entity.GetLocalPlayer()
    localPlayerAlive = Entity.IsAlive(localPlayer);
    if (!localPlayer) return;
    if (!localPlayerAlive) return;
    localPlayerWeapon = Entity.GetName(Entity.GetWeapon(localPlayer)), enemiesArr = Entity.GetEnemies();
    if (!enemiesArr) return;
    uMrt42tnhj = 180
    vecOrigin = Entity.GetProp(localPlayer, 'CBaseEntity', 'm_vecOrigin')
    viewAngles = Global.GetViewAngles();
    for (var i = 0; i < enemiesArr.length; i++) {
        if (!Entity.IsAlive(enemiesArr[i])) continue;
        var vecOrigin = Entity.GetProp(enemiesArr[i], 'CBaseEntity', 'm_vecOrigin'),
            y3F8x63yvb = Math.abs(normalizeYaw(worldToScreen(vecOrigin[0] - vecOrigin[0], vecOrigin[1] - vecOrigin[1]) - viewAngles[1] + 180));
        if (y3F8x63yvb < uMrt42tnhj) {
            uMrt42tnhj = y3F8x63yvb
            bZkq7eyc8k = enemiesArr[i];
        }
    }
    return bZkq7eyc8k;
}
 
function extrapolateTick(ticks) {
    var localPlayer = Entity.GetLocalPlayer(),
        localHeadPos = Entity.GetHitboxPosition(localPlayer, 0),
        localVel = Entity.GetProp(localPlayer, 'CBasePlayer', 'm_vecVelocity\[0\]'),
        extrapolatedPos = [];
    return extrapolatedPos[0] = localHeadPos[0] + localVel[0] * Globals.TickInterval() * ticks, extrapolatedPos[1] = localHeadPos[1] + localVel[1] * Globals.TickInterval() * ticks, extrapolatedPos[2] = localHeadPos[2] + localVel[2] * Globals.TickInterval() * ticks, extrapolatedPos;
}
 
function isExploitCharged() {
    if (Exploit.GetCharge() == 1) return true;
    return false;
}
 
//STRAIGHT OUT OF HVH ESSENTIALS LMAOOOOO
function attemptTwoShotKill(dXm8nmbeef) {
    if (!UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Better double tap accuracy"])) return false;
 
    if (UI.GetValue(["Rage", "Anti Aim", "Key assignment", "Fake duck"])) return false;
    var localWeapon = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()));
    if (localWeapon != 'scar 20' && localWeapon != 'g3sg1') return false;
    Ragebot.ForceHitboxSafety(0);
    var cLvs6anps2 = Entity.GetProp(dXm8nmbeef, 'CBasePlayer', 'm_iHealth'),
        d7Qeyanvsw = getClosestEnemyToCrosshair();
    pelvis_pos = Entity.GetHitboxPosition(dXm8nmbeef, 2), body_pos = Entity.GetHitboxPosition(dXm8nmbeef, 3), thorax_pos = Entity.GetHitboxPosition(dXm8nmbeef, 4);
    var pKz4ghbrnb = [0, -1],
        kF65sxpnun = [0, -1],
        KF65sxpnun = [0, -1],
        VEk5kwzgtz = [0, -1];
    result_thorax = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, Entity.GetEyePosition(Entity.GetLocalPlayer()), thorax_pos);
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = result_thorax[1];
    if (result_thorax[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
    kF65sxpnun = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, Entity.GetEyePosition(Entity.GetLocalPlayer()), pelvis_pos), pKz4ghbrnb = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, Entity.GetEyePosition(Entity.GetLocalPlayer()), body_pos);
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = kF65sxpnun[1];
    if (kF65sxpnun[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = pKz4ghbrnb[1];
    if (pKz4ghbrnb[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
 
    result_thorax_extrapolated = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, extrapolateTick(15), thorax_pos);
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = result_thorax_extrapolated[1];
    if (result_thorax_extrapolated[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
    VEk5kwzgtz = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, extrapolateTick(25), pelvis_pos), KF65sxpnun = Trace.Bullet(Entity.GetLocalPlayer(), dXm8nmbeef, extrapolateTick(25), body_pos);
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = VEk5kwzgtz[1];
    if (VEk5kwzgtz[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) {
        return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
    }
    if (dXm8nmbeef = d7Qeyanvsw) dynamicDamage = KF65sxpnun[1];
    if (KF65sxpnun[1] * 2 >= cLvs6anps2 && isExploitCharged() == true) return Ragebot.ForceTargetMinimumDamage(dXm8nmbeef, cLvs6anps2 / 2 + 1), true;
 
    return dynamicDamage = 0, false;
}
 
function getDropdownValue(Clvs6anps2, F9trm78mwl) {
    var H6tzwk68kz = 1 << F9trm78mwl;
    return Clvs6anps2 & H6tzwk68kz ? true : false;
}
 
function isCrouchTerrorist(index) {
    team = Entity.GetProp(index, 'CBasePlayer', 'm_iTeamNum')
    flags = Entity.GetProp(index, 'CBasePlayer', 'm_fFlags');
    if (team == 2 && flags & 1 << 1) return true;
    else return false;
}
 
function isCrouch(index) {
    var flags = Entity.GetProp(index, 'CBasePlayer', 'm_fFlags');
    if (flags & 1 << 1) return true;
    else return false;
}
 
function isSlowwalking(index) {
    var velocity = Entity.GetProp(index, 'CBasePlayer', 'm_vecVelocity\[0\]'),
        totalVelocity = Math.sqrt(velocity[0] * velocity[0] + velocity[1] * velocity[1]);
    if (totalVelocity >= 10 && totalVelocity <= 85) return true;
    else return false;
}
 
function isStanding(index) {
    var velocity = Entity.GetProp(index, 'CBasePlayer', 'm_vecVelocity\[0\]'),
        totalVelocity = Math.sqrt(velocity[0] * velocity[0] + velocity[1] * velocity[1]);
    if (totalVelocity <= 5) return true;
    else return false;
}
 
function isLethal(index) {
    var health = Entity.GetProp(index, 'CBasePlayer', 'm_iHealth');
    pelvis_pos = Entity.GetHitboxPosition(index, 2)
    body_pos = Entity.GetHitboxPosition(index, 3)
    thorax_pos = Entity.GetHitboxPosition(index, 4)
    bodyTrace = [0, -1]
    pelvisTrace = [0, -1]
    extrapolatedBodyTrace = [0, -1]
    extrapolatedPelvisTrace = [0, -1];
    result_thorax = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), thorax_pos);
    if (result_thorax[1] >= health) return true;
    pelvisTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), pelvis_pos)
    bodyTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, Entity.GetEyePosition(Entity.GetLocalPlayer()), body_pos);
    if (pelvisTrace[1] >= health) return true;
    if (bodyTrace[1] >= health) return true;
 
    result_thorax_extrapolated = Trace.Bullet(Entity.GetLocalPlayer(), index, extrapolateTick(20), thorax_pos);
    if (result_thorax_extrapolated[1] >= health) return Ragebot.ForceTargetSafety(index), true;
    extrapolatedPelvisTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, extrapolateTick(25), pelvis_pos)
    extrapolatedBodyTrace = Trace.Bullet(Entity.GetLocalPlayer(), index, extrapolateTick(25), body_pos)
    if (extrapolatedPelvisTrace[1] >= health) return true;
    if (extrapolatedBodyTrace[1] >= health) return true;
 
    return false;
}
 
function safetyOptions() {
    if (!UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Safety options"])) return;
 
    safetyOptionsEnabled = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Safety"]);
    if (getDropdownValue(safetyOptionsEnabled, 0)) {
        Ragebot.ForceHitboxSafety(13);
        Ragebot.ForceHitboxSafety(14);
        Ragebot.ForceHitboxSafety(15);
        Ragebot.ForceHitboxSafety(16);
        Ragebot.ForceHitboxSafety(17);
        Ragebot.ForceHitboxSafety(18);
    }
 
    if (getDropdownValue(safetyOptionsEnabled, 1)) {
        Ragebot.ForceHitboxSafety(7);
        Ragebot.ForceHitboxSafety(8);
        Ragebot.ForceHitboxSafety(9);
        Ragebot.ForceHitboxSafety(10);
    }
 
    if (getDropdownValue(safetyOptionsEnabled, 2)) {
        Ragebot.ForceHitboxSafety(11);
        Ragebot.ForceHitboxSafety(12);
    }
}
 
function forceConditions() {
    if (!UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Hitscan options"])) return;
    if (UI.GetValue(["Rage", "General", "General", "Key assignment", "Wait for on-shot bt"])) return;
    if (UI.GetValue(["Rage", "General", "General", "Key assignment", "Damage override"])) return;
 
    enemies = Entity.GetEnemies()
    hitscanOptionsEnabled = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Hitscan"])
 
    for (i = 0; i < enemies.length; i++) {
        if (!Entity.IsValid(enemies[i])) continue;
        if (!Entity.IsAlive(enemies[i])) continue;
        if (Entity.IsDormant(enemies[i])) continue;
 
        safeTargets[enemies[i]] = false;
        target = Ragebot.GetTarget();
 
        if (attemptTwoShotKill(enemies[i]) == true && UI.GetValue["Rage", "Brightside rage", "Brightside rage", "Better double tap accuracy"]) {
            continue;
        }
 
        /* conditions */
        if (getDropdownValue(hitscanOptionsEnabled, 0) && firedThisTick[enemies[i] == true]) {
            forceHead(enemies[i]);
        }
 
        if (getDropdownValue(hitscanOptionsEnabled, 1) && isInAir(enemies[i]) && (safeTargets[enemies[i]] = true)) {
            Ragebot.ForceTargetSafety(enemies[i]);
        }
 
        if (getDropdownValue(hitscanOptionsEnabled, 2) && isLethal(enemies[i])) {
            if (target == enemies[i]) forceBaim(enemies[i]);
        }
    }
}
 
(function () {
    for (var i in UI) {
        if (!~i.indexOf("Add"))
            continue;
 
        (function (cur) {
            UI[i] = function () {
                cur.apply(this, Array.prototype.slice.call(arguments));
                return arguments[0].concat(arguments[1]);
            }
        }(UI[i]));
    }
})();
 
const math = {
    clamp: function (val, min, max) {
        return Math.min(max, Math.max(min, val));
    }
};
 
const draggable = {
    draggables: [],
 
    create_draggable: function (startingSizeX, startingSizeY, callback) {
        const screenSize = Render.GetScreenSize();
 
        const sliderX = UI.AddSliderInt(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "_draggable_" + this.draggables.length + "_x", 0, screenSize[0]);
        const sliderY = UI.AddSliderInt(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals"], "_draggable_" + this.draggables.length + "_y", 0, screenSize[1]);
 
        UI.SetEnabled(sliderX, 0);
        UI.SetEnabled(sliderY, 0);
 
        this.draggables.push({
            pos: [UI.GetValue(sliderX), UI.GetValue(sliderY)],
            size: [startingSizeX, startingSizeY],
 
            isDragging: false,
 
            initialDragPosition: [sliderX, sliderY],
            sliders: [sliderX, sliderY],
 
            callbackFunction: callback,
 
            update: function () {
                const screenSize = Render.GetScreenSize();
                const menuOpened = UI.IsMenuOpen();
 
                if (menuOpened) {
                    if (Input.IsKeyPressed(1)) {
                        const mousePosition = Input.GetCursorPosition();
 
                        if (!this.isDragging && mousePosition[0] >= this.pos[0] && mousePosition[1] >= this.pos[1] && mousePosition[0] <= this.pos[0] + this.size[0] && mousePosition[1] <= this.pos[1] + this.size[1]) {
                            this.isDragging = true;
                            this.initialDragPosition = [mousePosition[0] - this.pos[0], mousePosition[1] - this.pos[1]];
                        } else if (this.isDragging) {
                            this.pos = [math.clamp(mousePosition[0] - this.initialDragPosition[0], 0, screenSize[0]), math.clamp(mousePosition[1] - this.initialDragPosition[1], 0, screenSize[1])];
 
                            for (var i in this.pos) {
                                UI.SetValue(this.sliders[i], this.pos[i]);
                            }
                        }
                    } else if (this.isDragging) {
                        this.isDragging = false;
                        this.initialDragPosition = [0, 0];
                    }
                }
 
                this.callbackFunction.apply(this, [menuOpened]);
            }
        });
    },
 
    updateDraggables: function () {
        for (var i in this.draggables) {
            this.draggables[i].update();
        }
    }
};
 
const hotkeyOnDraw = function () {
    draggable.updateDraggables();
};
 
const hotkeyList = {
    listInternalData: {
        alpha: 0
    }
};
 
var samp = ["Ragebot activation", "Resolver override", "Left direction", "Right direction", "Back direction", "Mouse direction", "AA Direction inverter", "Jitter", "Slow walk", "Edge jump",
    "Thirdperson", "Zoom", "Freecam", "Thirdperson", "Disable Autowall", "Extended backtrack", "Disable autowall"];
 
(function () {
    const addHotkeyToList = function (bindPath) {
        const keys = UI.GetChildren(bindPath);
        for (var i in keys) {
            hotkeyList[keys[i]] = {
                name: keys[i],
                path: bindPath.concat(keys[i]),
                alpha: 0
            }
        }
    };
 
    addHotkeyToList(["Rage", "General", "SHEET_MGR", "General", "Key assignment"]);
    addHotkeyToList(["Rage", "Exploits", "SHEET_MGR", "Key assignment"]);
    addHotkeyToList(["Rage", "Anti Aim", "SHEET_MGR", "Key assignment"]);
    addHotkeyToList(["Misc.", "Keys", "SHEET_MGR", "Key assignment"]);
    addHotkeyToList(["Config", "Scripts", "SHEET_MGR", "Keys", "JS Keybinds"]);
 
    for (var i in samp) {
        hotkeyList[samp[i]] = undefined;
    }
 
})();
 
const keybindModes = {
    "Hold": "[holding]",
    "Toggle": "[toggled]",
    "Always": "[always]"
};
 
draggable.create_draggable(152, 18, function (menuOpened) {
    if (UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Hotkey list"])) {
        const localPlayer = Entity.GetLocalPlayer();
        const isAnyHotkeyActive = (function () {
            for (var i in hotkeyList) {
                if (hotkeyList[i] && hotkeyList[i].name && UI.GetValue(hotkeyList[i].path) && keybindModes[UI.GetHotkeyState(hotkeyList[i].path)]) {
                    return true;
                }
            }
            return false;
        })();
 
        const newAlphaValue = Globals.Frametime() * 8 * ((menuOpened || Entity.IsValid(localPlayer) && isAnyHotkeyActive) ? 1 : -1);
        hotkeyList.listInternalData.alpha = math.clamp(hotkeyList.listInternalData.alpha + newAlphaValue, 0, 1);
 
        if (hotkeyList.listInternalData.alpha > 0) {
            const hotkeyListAccent = UI.GetColor(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Hotkey list accent"]);
            const hotkeyTitleFont = Render.AddFont("Verdana", 10, 900);
 
            const renderPosition = [this.pos[0], this.pos[1]];
 
            Render.FilledRect(renderPosition[0], renderPosition[1] + 2, this.size[0], this.size[1] + 6, [10, 6, 2, 150]);
            Render.FilledRect(renderPosition[0], renderPosition[1], this.size[0], 2, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 200]);
            Render.String(renderPosition[0] + this.size[0] / 2, renderPosition[1] + this.size[1] / 5 - 2, 1, "active keys", [0, 0, 0, 255], hotkeyTitleFont);
            Render.String(renderPosition[0] + this.size[0] / 2, renderPosition[1] + this.size[1] / 5 - 1, 1, "active keys", [233, 230, 229, 255], hotkeyTitleFont);
 
            Render.GradientRect(renderPosition[0] + 75, renderPosition[1] + 18, this.size[0] / 2.5, 1, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 0]);
            Render.GradientRect(renderPosition[0] + 75, renderPosition[1] + 19, this.size[0] / 2.5, 1, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 0]);
 
            Render.GradientRect(renderPosition[0] + 19, renderPosition[1] + 18, this.size[0] / 2.5, 1, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 0], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255]);
            Render.GradientRect(renderPosition[0] + 19, renderPosition[1] + 19, this.size[0] / 2.5, 1, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 0], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255]);
 
            renderPosition[1] += this.size[1];
 
            if (!menuOpened) {
                const hotkeyFont = Render.AddFont("Verdana", 10, 900);
 
                for (var i in hotkeyList) {
                    if (hotkeyList[i] && hotkeyList[i].name) {
                        const active = UI.GetValue(hotkeyList[i].path);
                        const mode = keybindModes[UI.GetHotkeyState(hotkeyList[i].path)];
                        const alphaAdditive = Globals.Frametime() * 8 * ((active && !!mode) ? 1 : -1);
 
                        hotkeyList[i].alpha = math.clamp(hotkeyList[i].alpha + alphaAdditive, 0, 1);
                        if (hotkeyList[i].alpha > 0) {
                            renderPosition[1] += 6;
                            const measuredName = Render.TextSize(i, hotkeyFont);
                            const measuredMode = Render.TextSize(mode, hotkeyFont);
 
                            if (!active && hotkeyList[i].alpha < 0.15) {
                                renderPosition[1] -= measuredName[1] * hotkeyList[i].alpha * Math.abs(alphaAdditive) * 7.5;
                            }
 
                            Render.FilledRect(renderPosition[0], renderPosition[1] + 2, this.size[0], this.size[1] - 2, [10, 6, 2, hotkeyList[i].alpha * 150]);
 
                            Render.String(renderPosition[0] + 4, renderPosition[1] + 1, 0, i.toLowerCase(), [0, 0, 0, hotkeyList[i].alpha * 255], hotkeyTitleFont)
                            Render.String(renderPosition[0] + 4, renderPosition[1], 0, i.toLowerCase(), [233, 230, 229, hotkeyList[i].alpha * 255], hotkeyTitleFont);
 
                            Render.String(renderPosition[0] + this.size[0] - 4 - measuredMode[0], renderPosition[1] + 1, 0, mode, [0, 0, 0, hotkeyList[i].alpha * 255], hotkeyTitleFont);
                            Render.String(renderPosition[0] + this.size[0] - 4 - measuredMode[0], renderPosition[1], 0, mode, [233, 230, 229, hotkeyList[i].alpha * 255], hotkeyTitleFont);
 
                            if (hotkeyList[i].alpha > 0.15) {
                                renderPosition[1] += measuredName[1]
                            }
                        }
                    }
                }
            }
        }
    }
});
 
function rect(x, y, w, h, dir, color1, color2) {
    Render.GradientRect(x - Math.round(w / 2), y - Math.round(h / 2), w, h, dir, color1, color2);
}
 
var startX = Render.GetScreenSize()[0] / 2;
var startY = Render.GetScreenSize()[1] / 2;
 
localplayer_index = Entity.GetLocalPlayer();
localplayer_alive = Entity.IsAlive(localplayer_index);
 
function customScope() {
    if (!Entity.IsValid(Entity.GetLocalPlayer())) return;
    if (!Entity.IsAlive(Entity.GetLocalPlayer())) return;
 
    var sizeX = 190;
    var sizeY = 2;
    var off = sizeX / 2 + 20;
    var c2 = [150, 200, 255, 255];
    var c1 = [150, 0, 200, 0];
 
    if (UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Custom scope"]) && localplayer_alive && Entity.GetProp(Entity.GetLocalPlayer(), "CCSPlayer", "m_bIsScoped")) {
        rect(startX - off, startY, sizeX, sizeY, 1, c1, c2);
        rect(startX + off, startY, sizeX, sizeY, 1, c2, c1);
        rect(startX, startY - off, sizeY, sizeX, 0, c1, c2);
        rect(startX, startY + off, sizeY, sizeX, 0, c2, c1);
    }
}
 
var positions = [];
var trace = [];
var render = [];
var local = Entity.GetLocalPlayer();
 
function Clamp(v, min, max) {
    return Math.max(Math.min(v, max), min);
}
 
render.arc = function (x, y, r1, r2, s, d, col) {
    for (var i = s; i < s + d; i++) {
 
        var rad = i * Math.PI / 180;
 
        Render.Line(x + Math.cos(rad) * r1, y + Math.sin(rad) * r1, x + Math.cos(rad) * r2, y + Math.sin(rad) * r2, col);
    }
}
 
function ImportGrenades() {
    var grenades = Entity.GetEntitiesByClassID(9).concat(Entity.GetEntitiesByClassID(113).concat(Entity.GetEntitiesByClassID(100)));
    for (e in grenades) {
        pass = false;
        for (g in positions) {
            if (positions[g][0] == grenades[e]) {
                pass = true;
                continue;
            }
        }
        if (pass)
            continue;
 
        positions.push([grenades[e], Globals.Curtime(), [Entity.GetRenderOrigin(grenades[e])], Globals.Curtime()]);
    }
}
 
// pasted from april LMAO
 
function GrenadeWarning() {
    var grenades = Entity.GetEntitiesByClassID(9).concat(Entity.GetEntitiesByClassID(113).concat(Entity.GetEntitiesByClassID(100)));
    if (UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Grenade warning"]) == 1) {
        if (!Entity.IsAlive(local))
            return;
 
        for (g in grenades) {
            for (var i = 0; i < grenades.length; i++) {
                var g = grenades[i];
                var isInferno = Entity.GetClassID(g) === 100;
                var isHeGrenade = Entity.GetClassID(g) === 9;
                var isMolotov = Entity.GetClassID(g) === 113;
                var DistanceInFeet = function (origin, destination) {
                    var sub = [destination[0] - origin[0], destination[1] - origin[1], destination[2] - origin[2]];
                    return Math.round(Math.sqrt(sub[0] ** 2 + sub[1] ** 2 + sub[2] ** 2) / 12);
                }
                var destination = Entity.GetRenderOrigin(g);
                var origin = Entity.GetEyePosition(local);
                var s = Render.WorldToScreen(origin);
                var distance = DistanceInFeet(origin, destination);
                var screen = Render.WorldToScreen(destination);
                var isSafe = distance > (isInferno ? 15 : 20) || trace[1] < 0.61;
 
                if (distance > 256) {
                    continue;
                }
 
                if (isHeGrenade && Entity.GetProp(g, "CBaseCSGrenadeProjectile", "m_nExplodeEffectTickBegin")) {
                    continue;
                }
 
                if (isMolotov || Entity.GetProp(g, "CBaseCSGrenadeProjectile", "m_nExplodeEffectTickBegin")) {
                    continue;
                }
 
                const font = Render.AddFont("Tahoma", 10, 700);
                const fontArrow = Render.AddFont("Tahoma", 24, 700);
 
                Render.FilledCircle(screen[0], screen[1] - 50, 23, [30, 25, 22, 200])
                Render.FilledCircle(screen[0], screen[1] - 50, 22, !isSafe ? [204, 48, 14, 220] : [30, 25, 22, 200])
                Render.String(screen[0], screen[1] - 73, 1, "!", [252, 240, 3, 255], fontArrow);
                Render.String(screen[0], screen[1] - 46, 1, distance + " ft", [0, 0, 0, 200], font);
                Render.String(screen[0], screen[1] - 45, 1, distance + " ft", [232, 232, 232, 200], font);
            }
        }
    }
}
 
function grenadeWarningOnDraw() {
    ImportGrenades();
    GrenadeWarning();
}
 
function Watermark() {
    if (!UI.GetValue(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Watermark"])) return;
 
    screenSize = Render.GetScreenSize();
 
    /* text related */
    var date = new Date(),
        dateHours = date.getHours(),
        dateMinutes = date.getMinutes(),
        dateSeconds = date.getSeconds(),
        timeHours = dateHours <= 9 ? '0' + dateHours + ':' : dateHours + ':',
        timeMinutes = dateMinutes <= 9 ? '0' + dateMinutes + ':' : dateMinutes + ':',
        timeSeconds = dateSeconds <= 9 ? '0' + dateSeconds : dateSeconds;
 
    var username = Cheat.GetUsername();
    var text = username + ' | brightside | ' + timeHours + timeMinutes + timeSeconds;
    var font = Render.AddFont('Verdana', 10, 900);
 
    const stringSize = Render.TextSize(text, font);
    const renderPosition = [Render.GetScreenSize()[0] - stringSize[0] - 15, 10];
 
    const samp = Math.abs(stringSize[0] + 8) + renderPosition[0] - 19;
 
    const hotkeyListAccent = UI.GetColor(["Visuals", "Brightside visuals", "SHEET_MGR", "Brightside visuals", "Hotkey list accent"]);
 
    /* background */
    Render.FilledRect(renderPosition[0] - 1, renderPosition[1] - 2, stringSize[0] + 8, 18, [10, 6, 2, 150]);
 
    /* left corner */
    Render.GradientRect(renderPosition[0] - 3, renderPosition[1] + 14, 20, 2, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 50]);
    Render.GradientRect(renderPosition[0] - 3, renderPosition[1] - 2, 2, 16, 0, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 50], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255]);
 
    /* right corner */
    Render.GradientRect(samp, renderPosition[1] - 2, 20, 2, 1, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 50], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255]);
    Render.GradientRect(samp + 18, renderPosition[1], 2, 16, 0, [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 255], [hotkeyListAccent[0], hotkeyListAccent[1], hotkeyListAccent[2], 50]);
 
    Render.String(renderPosition[0] + 3, renderPosition[1] - 1, 0, text, [233, 230, 229, 255], font);
}
 
function Draw() {
    if (UI.IsMenuOpen()) {
        UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Hitscan'], UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Hitscan options"]));
        UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Safety'], UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "Safety options"]));
        UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'In air hitchance'], UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "In air options"]));
        UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'No scope hitchance'], UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "No scope options"]));
    }
 
    /* in air options */
    inAirHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "In air hitchance"]);
    inAirOptions = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "In air options"]);
 
    getDropdownValue(inAirHitchance, 0) && inAirOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'AWP in air hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'AWP in air hitchance'], 0);
    getDropdownValue(inAirHitchance, 1) && inAirOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Scout in air hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Scout in air hitchance'], 0);
    getDropdownValue(inAirHitchance, 2) && inAirOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Revolver in air hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Revolver in air hitchance'], 0);
 
    /* no scope options */
    _noScopeHitchance = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "No scope hitchance"]);
    noScopeOptions = UI.GetValue(["Rage", "Brightside rage", "Brightside rage", "No scope options"]);
 
    getDropdownValue(_noScopeHitchance, 0) && noScopeOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Auto no scope hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Auto no scope hitchance'], 0);
    getDropdownValue(_noScopeHitchance, 1) && noScopeOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Scout no scope hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'Scout no scope hitchance'], 0);
    getDropdownValue(_noScopeHitchance, 2) && noScopeOptions ? UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'AWP no scope hitchance'], 1) : UI.SetEnabled(['Rage', 'Brightside rage', 'Brightside rage', 'AWP no scope hitchance'], 0);
 
    autoStraferCorrection();
    drawIndicators();
    hotkeyOnDraw();
    grenadeWarningOnDraw();
    customScope();
    Watermark();
}
 
function createMove() {
    if (!Entity.IsValid(Entity.GetLocalPlayer())) return;
    if (!Entity.IsAlive(Entity.GetLocalPlayer())) return;
 
    idealYaw();
    fasterDoubleTap();
    instantRecharge();
    legMovement();
    legitAA();
    lowDelta();
    setHitchanceInAir();
    forceConditions();
    noScopeHitchance();
    waitForOnShotBacktrack();
    overrideMinimumDamage();
    safetyOptions();
    freestandingOnKey();
    tehnologie2022();
}
 
function fogxkycp6v() {
 
    for (i = 0; i < 64; i++) {
        safeTargets[i] = false;
    }
 
    Cheat.RegisterCallback("Draw", "Draw");
    Cheat.RegisterCallback("CreateMove", "createMove");
    Cheat.RegisterCallback("CreateMove", "clanTag");
    Cheat.RegisterCallback("Unload", "fasterDoubleTapUnload");
    Cheat.RegisterCallback("player_hurt", "playerHurt");
    Cheat.RegisterCallback("bullet_impact", "onBulletImpact");
    Cheat.RegisterCallback("ragebot_fire", "ragebotLogs");
    Cheat.RegisterCallback('round_start', 'clearData');
}