
UI.AddLabel("                 Ragebot               ");

UI.AddLabel("                                ");

var original_aa = true;

UI.AddHotkey("Legit AA Key");

function legit_aa()
{
    if (UI.IsHotkeyActive("Misc", "JAVASCRIPT", "Script items", "Legit AA Key"))
    {
        if (original_aa)
        {
            restrictions_cache = UI.GetValue("Misc", "PERFORMANCE & INFORMATION", "Information", "Restrictions");
            hiderealangle_cache = UI.GetValue ("Anti-Aim", "Fake angles", "Hide real angle");
            yaw_offset_cache = UI.GetValue ("Anti-Aim", "Rage Anti-Aim", "Yaw offset");
            jitter_offset_cache = UI.GetValue ("Anti-Aim", "Rage Anti-Aim", "Jitter offset");
            pitch_cache = UI.GetValue ("Anti-Aim", "Extra", "Pitch");
            original_aa = false;
        }
        UI.SetValue ("Misc", "PERFORMANCE & INFORMATION", "Information", "Restrictions", 0);
        UI.SetValue ("Anti-Aim", "Fake angles", "Hide real angle", true);
        UI.SetValue ("Anti-Aim", "Rage Anti-Aim", "Yaw offset", 180);
        UI.SetValue ("Anti-Aim", "Rage Anti-Aim", "Jitter offset", 0);
        UI.SetValue ("Anti-Aim", "Extra", "Pitch", 0);
    }
    else
    {
        if (!original_aa)
        {
            UI.SetValue ("Misc", "PERFORMANCE & INFORMATION", "Information", "Restrictions", restrictions_cache);
            UI.SetValue ("Anti-Aim", "Fake angles", "Hide real angle", hiderealangle_cache);
            UI.SetValue ("Anti-Aim", "Rage Anti-Aim", "Yaw offset", yaw_offset_cache);
            UI.SetValue ("Anti-Aim", "Rage Anti-Aim", "Jitter offset", jitter_offset_cache);
            UI.SetValue ("Anti-Aim", "Extra", "Pitch", pitch_cache);
            original_aa = true;
        }
    }
}

Cheat.RegisterCallback("CreateMove", "legit_aa");

UI.AddHotkey('Force Head');
seta = false;
setb = true;

function main() {
    if (UI.IsHotkeyActive('Script items', 'Force Head')) {
        if (!seta) {
            hba = UI.GetValue('Rage', 'GENERAL', 'Targeting', 'Hitboxes');
            hbb = UI.GetValue('Rage', 'PISTOL', 'Targeting', 'Hitboxes');
            hbc = UI.GetValue('Rage', 'HEAVY PISTOL', 'Targeting', 'Hitboxes');
            hbd = UI.GetValue('Rage', 'SCOUT', 'Targeting', 'Hitboxes');
            hbe = UI.GetValue('Rage', 'AWP', 'Targeting', 'Hitboxes');
            hbf = UI.GetValue('Rage', 'AUTOSNIPER', 'Targeting', 'Hitboxes');
            UI.SetValue('Rage', 'GENERAL', 'Targeting', 'Hitboxes', 1);
            UI.SetValue('Rage', 'PISTOL', 'Targeting', 'Hitboxes', 1);
            UI.SetValue('Rage', 'HEAVY PISTOL', 'Targeting', 'Hitboxes', 1);
            UI.SetValue('Rage', 'SCOUT', 'Targeting', 'Hitboxes', 1);
            UI.SetValue('Rage', 'AWP', 'Targeting', 'Hitboxes', 1);
            UI.SetValue('Rage', 'AUTOSNIPER', 'Targeting', 'Hitboxes', 1);
            seta = true;
            setb = false
        }
    } else {
        if (!setb) {
            UI.SetValue('Rage', 'GENERAL', 'Targeting', 'Hitboxes', hba);
            UI.SetValue('Rage', 'PISTOL', 'Targeting', 'Hitboxes', hbb);
            UI.SetValue('Rage', 'HEAVY PISTOL', 'Targeting', 'Hitboxes', hbc);
            UI.SetValue('Rage', 'SCOUT', 'Targeting', 'Hitboxes', hbd);
            UI.SetValue('Rage', 'AWP', 'Targeting', 'Hitboxes', hbe);
            UI.SetValue('Rage', 'AUTOSNIPER', 'Targeting', 'Hitboxes', hbf);
            setb = true;
            seta = false
        }
    }
}

UI.AddCheckbox('Safe point on limbs');

function SafepointOnLimbs() {
    if (!UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', 'Safe point on limbs')) {
        return
    };
    Ragebot.ForceHitboxSafety(12), Ragebot.ForceHitboxSafety(11), Ragebot.ForceHitboxSafety(10), Ragebot.ForceHitboxSafety(9)
}

UI.AddLabel("                                ");

UI.AddCheckbox('Jump Scout/Revolver Hitchance');
UI.AddSliderInt('Hitchance', 0, 100);

function SetHitchanceInAir() {
    if (!UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', 'Jump Scout/Revolver Hitchance')) {
        return
    };
    var _0x154cx84 = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()));
    if (_0x154cx84 != 'ssg 08' && _0x154cx84 != 'r8 revolver') {
        return
    };
    var _0x154cx85 = Entity.GetProp(Entity.GetLocalPlayer(), 'CBasePlayer', 'm_fFlags');
    if (!(_0x154cx85 & 1 << 0) && !(_0x154cx85 & 1 << 18)) {
        if ('oxhiI' !== 'oxhiI') {
            function _0x154cx86() {
                var _0x154cx87 = Entity.GetEyePosition(local);
                left_distance = trace(local, [0, _0x154cx87[1] - 33]), right_distance = trace(local, [0, _0x154cx87[1] + 33]);
                if (left_distance > right_distance) {
                    if (UI.IsHotkeyActive('Anti-Aim', 'Fake angles', 'Inverter')) {
                        UI.ToggleHotkey('Anti-Aim', 'Fake angles', 'Inverter')
                    }
                };
                if (right_distance > left_distance) {
                    if (!UI.IsHotkeyActive('Anti-Aim', 'Fake angles', 'Inverter')) {
                        UI.ToggleHotkey('Anti-Aim', 'Fake angles', 'Inverter')
                    }
                }
            }
        } else {
            target = Ragebot.GetTarget(), value = UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', 'Hitchance'), Ragebot.ForceTargetHitchance(target, value)
        }
    }
}

function SetEnabled11() {
    if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', 'Jump Scout/Revolver Hitchance')) {
        UI.SetEnabled('Misc', 'JAVASCRIPT', 'Script items', 'Hitchance', 1)
    } else {
        UI.SetEnabled('Misc', 'JAVASCRIPT', 'Script items', 'Hitchance', 0)
    }
}
Global.RegisterCallback('Draw', 'SetEnabled11');

UI.AddLabel("                                ");

UI.AddHotkey("Mindmg override")

UI.AddLabel("                                ");

UI.AddSliderInt("Heavy Pistol Mindmg", 0, 130)
UI.AddSliderInt("Scout Mindmg", 0, 130)
UI.AddSliderInt("AWP Mindmg", 0, 130)
UI.AddSliderInt("Auto Mindmg", 0, 130)

var heavy_cache = UI.GetValue("Rage", "HEAVY PISTOL", "Targeting", "Minimum damage")
var scout_cache = UI.GetValue("Rage", "SCOUT", "Targeting", "Minimum damage")
var awp_cache = UI.GetValue("Rage", "AWP", "Targeting", "Minimum damage")
var auto_cache = UI.GetValue("Rage", "AUTOSNIPER", "Targeting", "Minimum damage")
function isActive(a)
{
    return UI.IsHotkeyActive("Script items", a)
}
function setValue(cat, value)
{
    UI.SetValue("Rage", cat.toUpperCase(), "Targeting", "Minimum damage", value)
}
function isHeavyPistol(name)
{
    if (name == "r8 revolver" || name == "desert eagle")
    {
        return true
    }
}
function isAutoSniper(name)
{
    if(name == "scar 20" || weapon_name == "g3sg1")
    {
        return true
    }
}
function onCM()
{
    heavy_value = UI.GetValue("Script items", "Heavy Pistol Mindmg")
    scout_value = UI.GetValue("Script items", "Scout Mindmg")
    awp_value = UI.GetValue("Script items", "AWP Mindmg")
    auto_value = UI.GetValue("Script items", "Auto Mindmg")
    weapon_name = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    
    if (isActive("Mindmg override") && isHeavyPistol(weapon_name))
    {
        setValue("HEAVY PISTOL", heavy_value)
    }
    else{
        setValue("HEAVY PISTOL", heavy_cache)
    }
    
    if (isActive("Mindmg override") && weapon_name == "ssg 08")
    {
        setValue("SCOUT", scout_value)
    }
    else{
        setValue("SCOUT", scout_cache)
    }

    if (isActive("Mindmg override") && weapon_name == "awp")
    {
        setValue("AWP", awp_value)
    }
    else{
        setValue("AWP", awp_cache)
    }

    if (isActive("Mindmg override") && isAutoSniper(weapon_name))
    {
        
        setValue("AUTOSNIPER", auto_value)
    }
    else
    {
        setValue("AUTOSNIPER", auto_cache)
    }
    
}
function indicator()
{
    font = Render.AddFont("Tahoma", 15, 600 )
    screen = Render.GetScreenSize()
    wep = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
    x = screen[0]-screen[0] + 8
    y = screen[1] - 150
    heavy ="" + UI.GetValue("Rage", "HEAVY PISTOL", "Targeting", "Minimum damage")
    scout ="" +UI.GetValue("Rage", "SCOUT", "Targeting", "Minimum damage")
    awp ="" +UI.GetValue("Rage", "AWP", "Targeting", "Minimum damage")
    auto ="" +UI.GetValue("Rage", "AUTOSNIPER", "Targeting", "Minimum damage")
    var str = ""
    if (UI.GetValue("Script items", "Display indicator") && Entity.IsValid(Entity.GetLocalPlayer()) && Entity.IsAlive(Entity.GetLocalPlayer()))
    {
        if (isHeavyPistol(wep))
        {
            str = heavy
        }
        else if(wep == "ssg 08")
        {
            str = scout
        }
        else if(wep == "awp")
        {
            str = awp
        }
        else if (isAutoSniper(wep))
        {
            str = auto
        }
    }
    
    if (str == "" + 0)
    {
        str = "DYNAMIC"
    }
    Render.StringCustom(x+1, y+1, 0, str+"", [0,0,0,255], font)
    Render.StringCustom(x, y, 0, str+"", [255,255,255,255], font)
}
Cheat.RegisterCallback("Draw", "indicator")
Cheat.RegisterCallback("CreateMove", "onCM")

UI.AddLabel("                                ");
UI.AddLabel("                  Anti-aim                 ");

var jitter_cache = UI.GetValue("Anti-Aim", "Rage Anti-Aim", "Jitter offset")
var yaw_cache = UI.GetValue("Anti-Aim", "Rage Anti-Aim", "Yaw offset")
UI.AddCheckbox("Safe head");

function Safe_Head()
{
    localplayer_index = Entity.GetLocalPlayer( );


        if (UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Safe head") && UI.IsHotkeyActive("Anti-Aim", "Extra", "Slow walk"))
        {
            UI.SetValue("Anti-Aim", "Rage Anti-Aim", "Yaw offset", 10);
            UI.SetValue("Anti-Aim", "Rage Anti-Aim", "Jitter offset", 0);
            AntiAim.SetOverride(1);
            AntiAim.SetFakeOffset(0);
            AntiAim.SetRealOffset(-30);
        }
        else
        {
            UI.SetValue("Anti-Aim", "Rage Anti-Aim", "Jitter offset", jitter_cache);
            AntiAim.SetOverride(0);
        }
}

Cheat.RegisterCallback("CreateMove", "Safe_Head");

UI.AddLabel("                                ");

UI.AddHotkey('Ping Spike');
var extended_cache = UI.GetValue('Misc', 'GENERAL', 'Extended backtracking');

function isActive(a) {
    return UI.IsHotkeyActive('Script items', a)
}

function pingspike() {
    if (isActive('Ping Spike')) {
        UI.SetValue('Misc', 'GENERAL', 'Extended backtracking', true)
    } else {
        UI.SetValue('Misc', 'GENERAL', 'Extended backtracking', extended_cache)
    }
}

Cheat.RegisterCallback('CreateMove', 'pingspike');

UI.AddSliderInt("Send Limit", 0, 16)
UI.AddSliderInt("Choke Limit", 0, 16)
var tickcount = 0
var flip = false
function onCD()
{
    var send = UI.GetValue("Script items", "Send Limit")
    var choke = UI.GetValue("Script items", "Choke Limit")
    if(tickcount >= choke && !flip)
    {
        flip = true
        tickcount = 0
    }
    if(tickcount >= send && flip)
    {
        flip = false
        tickcount = 0
    }
    UI.SetValue("Anti-Aim", "Fake-Lag", "Limit", !flip ? choke : 0)
    ++tickcount
}
function roundstart()
{
    tickcount = 0
}


Cheat.RegisterCallback("round_start", "roundstart")
Cheat.RegisterCallback("CreateMove", "onCD")

/*var clock = 0
function on_createmove()
{
    clock = clock + 0.5
    if (clock > 1)
    {
        if (UI.GetValue("Misc", "GENERAL", "Movement", "Accurate walk"))
        {
            UI.SetValue("Misc", "GENERAL", "Movement", "Accurate walk", 0);
            clock = 0
        }
        else
        {
            UI.SetValue("Misc", "GENERAL", "Movement", "Accurate walk", 1);
            clock = 0
        }
    }
}
Cheat.RegisterCallback("CreateMove", "on_createmove")*/

Cheat.RegisterCallback("CreateMove", "aaLoop");

multiplierOptions = [-2, -1, 1, 2];

UI.AddSliderInt("Fake", -60, 60)

UI.AddSliderInt("Yaw", -180, 180)

UI.AddSliderInt("LBY", -60, 60)

function aaLoop() {
    AntiAim.SetOverride(1);

    if (getRandomIntInclusive(0, 4)) AntiAim.SetFakeOffset(-10);
    //else if (getRandomIntInclusive(0, 4)) AntiAim.SetFakeOffset(10);
    //else {
        AntiAim.SetFakeOffset(UI.GetValue("Script items", "Fake"));
        AntiAim.SetRealOffset(UI.GetValue("Script items", "Yaw") * multiplierOptions[getRandomIntInclusive(0, multiplierOptions.length)]);
        AntiAim.SetLBYOffset(UI.GetValue("Script items", "LBY"));
    //}
}



function getRandomIntInclusive(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
  }

function prediction()
{

    frametime = Globals.Curtime();
    frametime = Globals.Frametime();

	m_movehelper = Gamemovement.set_host(Entity);

	gamemovement = Gamemovement.StartTrackPredictionErrors(Entity);

	gamemovement = Gamemovement.ProcessMovement(Entity, pMove);

	prediction = Prediction.FinishMove(Entity, m_pcmd, pMoveData);

	gamemovement = Gamemovement.FinishTrackPredictionErrors(Entity);

	movehelper = Movehelper.set_host(nullptr);

    var flSpread = Ragebot.GetSpread()

    var flInaccuracy = Ragebot.GetInaccuracy()

    pWeapon = Ragebot.m_hActiveWeapon();

	if (!pWeapon) {
		flSpread = flInaccuracy = 0;
		return;
	}

}

Cheat.RegisterCallback("CreateMove", "prediction")

var low = 158;
var low_two = 202;
UI.AddSliderInt("When brute low delta", 0, 6)
function fix_low_delta()
{
    if (Ragebot.misses() % 0)
    {
        if (Entity.getVelocity < 200)
        Entity.SetFakeYaw() + 30
        else
        Entity.SetFakeYaw() - 30
    }
    else
    {
        if (Entity.getVelocity < 1.1)
        Entity.SetFakeYaw() + 60
        else
        Entity.SetFakeYaw() - 60
    }

    if (Ragebot.misses() % UI.GetValue("Script items", "When brute low delta"))
    {
        Entity.SetRealYaw() + low
    }
    else
    {
        Entity.SetRealYaw() + low_two
    }
}

Cheat.RegisterCallback("CreateMove", "fix_low_delta")

var clock = 10 * 0
function createmove()
{
    clock = clock + 1.0
    if (clock > 1.0)
    {
        if (UI.GetValue("Misc", "GENERAL", "Movement", "Slide walk"))
        {
            UI.SetValue("Misc", "GENERAL", "Movement", "Slide walk", 0);
            clock = clock + 0.1
        }
        else
        {
            UI.SetValue("Misc", "GENERAL", "Movement", "Slide walk", 1);
            clock = clock + 1.0
        }
    }
}

Cheat.RegisterCallback("CreateMove", "createmove")

function fix_move(_0x154cxf6, _0x154cxf7, _0x154cxf8) {
    var _0x154cxf9 = function (_0x154cxfa) {
        return _0x154cxfa / 0xb4 * Math.PI
    };
    var _0x154cxfb, _0x154cxfc, _0x154cxfd;
    if (_0x154cxf7[0x1] < 0x0) {
        _0x154cxfb = 0x168 + _0x154cxf7[0x1]
    } else {
        _0x154cxfb = _0x154cxf7[0x1]
    };
    if (_0x154cxf6[0x1] < 0x0) {
        _0x154cxfc = 0x168 + _0x154cxf6[0x1]
    } else {
        _0x154cxfc = _0x154cxf6[0x1]
    };
    if (_0x154cxfc < _0x154cxfb) {
        _0x154cxfd = Math[_0x482c('0x61')](_0x154cxfc - _0x154cxfb)
    } else {
        _0x154cxfd = 0x168 - Math[_0x482c('0x61')](_0x154cxfb - _0x154cxfc)
    };
    return [Math[_0x482c('0x49')](_0x154cxf9(_0x154cxfd)) * _0x154cxf8[0x0] + Math.cos(_0x154cxf9(_0x154cxfd + 0x5a)) * _0x154cxf8[0x1], Math[_0x482c('0xb')](_0x154cxf9(_0x154cxfd)) * _0x154cxf8[0x0] + Math[_0x482c('0xb')](_0x154cxf9(_0x154cxfd + 0x5a)) * _0x154cxf8[0x1], 0x0]
}

function move_forward(_0x154cxff) {
    var _0x154cx100 = Local[_0x482c('0x2b')]();
    var _0x154cx101 = [0x1c2, 0x0, 0x0];
    var _0x154cx102 = fix_move(_0x154cxff, _0x154cx100, _0x154cx101);
    var _0x154cx103 = UI[_0x482c('0x51')](_0x482c('0x5'), 'Silent throw (Rage)') == 0x1 ? !![] : ![];
    UserCMD[_0x482c('0x4b')](_0x154cx102);
    UserCMD[_0x482c('0xa')](_0x154cxff, _0x154cx103)
}

function move_to_target(_0x154cx135, _0x154cx136) {
    var _0x154cx137 = Entity.GetLocalPlayer();
    var _0x154cx138 = Entity.GetRenderOrigin(_0x154cx137);
    _0x154cx138[0x2] = Entity.GetEyePosition(_0x154cx137)[0x2];
    var _0x154cx139 = [_0x154cx135[0x0] - _0x154cx138[0x0], _0x154cx135[0x1] - _0x154cx138[0x1], _0x154cx135[0x2] - _0x154cx138[0x2]];
    var _0x154cx13a = Local[_0x482c('0x2b')]()[0x1];
    var _0x154cx13b = [];
    var _0x154cx13c = 0x14;
    _0x154cx13b[0x0] = (Math.sin(_0x154cx13a / 0xb4 * Math.PI) * _0x154cx139[0x1] + Math[_0x482c('0x49')](_0x154cx13a / 0xb4 * Math.PI) * _0x154cx139[0x0]) * _0x154cx13c;
    _0x154cx13b[0x1] = (Math[_0x482c('0xb')](_0x154cx13a / 0xb4 * Math.PI) * _0x154cx139[0x0] + Math[_0x482c('0x49')](_0x154cx13a / 0xb4 * Math.PI) * -_0x154cx139[0x1]) * _0x154cx13c;
    _0x154cx13b[0x2] = 0x0;
    var _0x154cx13d = Math[_0x482c('0x46')](_0x154cx139[0x0] * _0x154cx139[0x0] + _0x154cx139[0x1] * _0x154cx139[0x1] + _0x154cx139[0x2] * _0x154cx139[0x2]);
    var _0x154cx13e = Entity.GetProp(_0x154cx137, 'DT_CSPlayer', 'm_vecVelocity[0]');
    var _0x154cx13f = Math[_0x482c('0x46')](_0x154cx13e[0x0] * _0x154cx13e[0x0] + _0x154cx13e[0x1] * _0x154cx13e[0x1] + _0x154cx13e[0x2] * _0x154cx13e[0x2]);
    UserCMD[_0x482c('0x4b')](_0x154cx13b);
    return _0x154cx13d < (_0x154cx136 ? _0x154cx136 : 0x1) && (_0x154cx13f < 0x2 || _0x154cx136)
}

UI.AddSliderFloat("no pitch on land", 0, 5)


// variables
var local;
var lastAircheck;

var inAir = false;

var firstRun=false; // use on line

var timed1=false;
var delay1 = .2;
var lastTime1=Globals.Curtime();

var timed=false;
var delay = .2;
var lastTime=Globals.Curtime();

var runMainFunction=0;
var info=0;
var delayedPos=0




function setSlide(value){
// turn on and off slide walk
    // 1=on, 0=off
    UI.SetValue("Misc", "GENERAL", "Movement", "Slide walk", value);
}


// 0=off, 1=down, 2=  , 3=zero
function setPitch(val){
    UI.SetValue("Anti-Aim", "Extra", "Pitch", val);
}

function checkIfAlive(){
    local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)){
        return;
    }
}

function checkIfInAir(){
    // shoutout to Ultranite for this code, all credits to him for this function.
    air = Entity.GetProp(local, "CBasePlayer", "m_flFallVelocity");
    if (air < -1 || air > 1) {
        inAir = true;
    } else {
        inAir = false;
    }

}

function checkRestrictions(){
   
    info = UI.GetValue( "Misc", "PERFORMANCE & INFORMATION", "Information", "Restrictions");
    if (info=1){
        UI.SetValue( "Misc", "PERFORMANCE & INFORMATION", "Information", "Restrictions", 0);
    }
}




function poggers(){
    checkRestrictions();
    coolDelay = UI.GetValue( "Misc", "JAVASCRIPT", "Script items", "no pitch on land");
    local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)){
        return;
    }

   
    if (timed1 == false) {
        lastTime1 = Globals.Curtime();
        timed1 = true;
    }
    if (Globals.Curtime() > lastTime1 + .3) { // delays when to check if you're inair so it doesn't go off as much when you're bhopping.
        // shoutout to Ultranite for this code, all credits to him for this function.
        air = Entity.GetProp(local, "CBasePlayer", "m_flFallVelocity");
        if (air < -1 || air > 1) {
            inAir = true;
        } else {
            inAir = false;
        }
        timed1 = false;
    }
   
   
    // if statement, if space is held, return.
    // This should stop any false activations of the zero pitch, i hope ;-;
    if (Input.IsKeyPressed(0x20)){
        return;
    }
   
   
   

    if (lastAircheck == true && inAir==false){
        //Cheat.Print( 'if statement was ran successfully' ); this is working correctly
        if (delayedPos==0 && firstRun==false) {
            firstRun=true;
        }
       
        runMainFunction=1;
    }
   
    if (runMainFunction==1){
        if (timed == false) {
            lastTime = Globals.Curtime();
            timed = true;
        }
        // the var firstRun lets the shit skip the delay for the zero pitch, so then the delay will put the aa down
        if (Globals.Curtime() > lastTime + coolDelay || firstRun==true) {
            if (delayedPos==1){
                //Cheat.Print("1");
                setSlide(0);
                setPitch(1);
                delayedPos=0;
                runMainFunction=0;
                timed = false;
                return;
            }
           
            if (delayedPos==0){
                //Cheat.Print("0");
                setSlide(1);
                setPitch(3);
                delayedPos=1;
                firstRun=false;
                timed = false;
                return;
            }
            //timed = false;
        }
       
    }
   
   
    lastAircheck=inAir;
}







function onUnload() {
    UI.SetValue( "Misc", "Performance & Information", "Information", "Restrictions", 1);
    setPitch(1);
}

Cheat.RegisterCallback("Unload", "onUnload");
Cheat.RegisterCallback("CreateMove", "poggers");

UI.AddLabel("                                ");
UI.AddLabel("                    Visual               ");
UI.AddLabel("                                ");

/*
 * created by kymiko OwO
 */

UI.AddColorPicker("Watermark");
var color = UI.GetColor("Misc", "JAVASCRIPT", "Script items", "Watermark");

if (color[3] == 0)
	UI.SetColor("Misc", "JAVASCRIPT", "Script items", "Watermark", [89, 119, 239, 255]);

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

	var today = new Date();
    var hours1 = today.getHours();
    var minutes1 = today.getMinutes();
	var seconds1 = today.getSeconds();
	
    var hours = hours1 <= 9 ? "0"+hours1+":" : hours1+":";
    var minutes = minutes1 <= 9 ? "0" + minutes1+":" : minutes1+":";
	var seconds = seconds1 <= 9 ? "0" + seconds1 : seconds1;
	
	var server_tickrate = Globals.Tickrate().toString()
	var ebanaya_hueta = Math.round(Entity.GetProp(Entity.GetLocalPlayer(), "CPlayerResource", "m_iPing")).toString() // кто это сделал - контуженный на всю голову ебаный хуесос

	color = UI.GetColor("Misc", "JAVASCRIPT", "Script items", "Watermark");

	var font = Render.AddFont("Verdana", 7, 400);
	var text = "skeet.cc [safety] | N1tr0 | delay: " + ebanaya_hueta + "ms | " + server_tickrate + "tick | " + hours + minutes + seconds;
	
	var w = Render.TextSizeCustom(text, font)[0] + 8;
	var x = Global.GetScreenSize()[0];

	x = x - w - 10;

	Render.FilledRect(x, 10, w, 2, [ color[0], color[1], color[2], 255 ]);
	Render.FilledRect(x, 12, w, 18, [ 17, 17, 17, 0 ]);
	Render.StringCustom(x+4, 10 + 4, 0, text, [ 255, 255, 255, 255 ], font);
}

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

const x1 = UI.AddSliderInt("Hotkeys_x", 0, Global.GetScreenSize()[0]);
const y1 = UI.AddSliderInt("Hotkeys_y", 0, Global.GetScreenSize()[1]);
UI.AddColorPicker("Hotkey color");
var color = UI.GetColor("Misc", "JAVASCRIPT", "Script items", "Hotkeys");
if (color[3] == 0) {
	UI.SetColor("Misc", "JAVASCRIPT", "Script items", "Hotkeys", [89, 119, 239, 255]);
}
function in_bounds(vec, x, y, x2, y2)
{
    return (vec[0] > x) && (vec[1] > y) && (vec[0] < x2) && (vec[1] < y2)
}
function main()
{
	if(!World.GetServerString()) return;
	const x = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_x"),
            y = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_y");
	color = UI.GetColor("Misc", "JAVASCRIPT", "Script items", "Hotkeys");
	var fontpixel = Render.AddFont( "Verdana", 7, 100);
	var h = [];

     if (UI.IsHotkeyActive("Legit", "Extra", "General")) {
       h.push("Slow walk")
     }
     if (UI.IsHotkeyActive("Legit", "Extra", "TriggerBot")) {
       h.push("Trigger")
     }
     if (UI.IsHotkeyActive("Misc", "GENERAL", "Movement", "Auto peek")) {
       h.push("Auto peek")
     }
     if (UI.IsHotkeyActive("Anti-Aim", "Legit Anti-Aim", "Inverter")) {
       h.push("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", "Auto Override")) {
       h.push("Damage override")
     }
	   Render.FilledRect(x, y, 170, 20, [15, 15, 15, 0]);
     Render.StringCustom(x + 60, y + 4, 0, "hotkey list", [255, 255, 255, 255], fontpixel);
     Render.FilledRect(x, y, 170, 2, [color[0], color[1], color[2], 255]);
     Render.FilledRect(x, y + 20, 170, 20 + 15 * (h.length - 1), [15, 15, 15, 0]);
     for (i = 0; i < h.length; i++)
     {
        Render.StringCustom(x + 5, y + 23 + 15 * i, 0, h[i], [255, 255, 255, 255], fontpixel);
        Render.StringCustom(x + 123, y + 23 + 15 * i, 0, "[toggled]", [255, 255, 255, 255], fontpixel);
     }

        if (Global.IsKeyPressed(1) && UI.IsMenuOpen()) {
        const mouse_pos = Global.GetCursorPosition();
        if (in_bounds(mouse_pos, x, y, x + 200, y + 30)) {
            UI.SetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_x", mouse_pos[0] - 100);
            UI.SetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_y", mouse_pos[1] - 20);
        }
    }
    if (Global.IsKeyPressed(1) && UI.IsMenuOpen()) {
        const mouse_pos = Global.GetCursorPosition();
        if (in_bounds(mouse_pos, x, y, x + 200, y + 30)) {
            UI.SetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_x", mouse_pos[0] - 100);
            UI.SetValue("Misc", "JAVASCRIPT", "Script items", "Hotkeys_y", mouse_pos[1] - 20);
        }
    }

}
Global.RegisterCallback("Draw", "main")

//var screen_size = Render.GetScreenSize();

/*UI.AddCheckbox("Indicator");
UI.AddColorPicker("Indicator color");
UI.AddColorPicker("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", 7, 800);
    x = screen_size[0];
    y = screen_size[1];
    var ishide = UI.GetValue("Anti-Aim", "Fake angles", "Hide real angle");
    var ishide_off = UI.GetValue("Anti-Aim", "Fake angles", "Hide real angle", 0);
    isslow = UI.IsHotkeyActive("Anti-Aim", "Extra", "Slow walk");
    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 + 2, y / 2 + 47, 1, "N1TR0 YAW", [ 255, 255, 255, 255 ], font ); 
    Render.StringCustom(x / 2, y / 2 + 25, 1, delta, [255, 255, 255, 255], font);
    Render.Circle(x / 1 + 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);
	
	if (!World.GetServerString()) return;

    //inverted = UI.IsHotkeyActive("Anti-Aim", "Fake angels", "Inverter");
    //font1 = Render.AddFont("Acta Symbols W95 Arrows", 18, 100);
    //color = UI.GetColor("Script items", "color");

    //Render.StringCustom(x / 2 + 55, y / 2 * 0.982, 1, "h", [40, 40, 40, color[3]], font1)
   // Render.StringCustom(x / 2 - 55, y / 2 * 0.982, 1, "g", [40, 40, 40, color[3]], font1)
      
    /*if (UI.IsHotkeyActive('Misc', 'JAVASCRIPT', 'Force Head')) {
        Render.GradientSkeet(7, y - 420 + 105, 170, 30, 1, [0, 0, 0, 55], [0, 0, 0, 0]);
        Render.StringCustom(x, y + 1 - 420 + 105, 0, 'FORCE HEAD', [17, 17, 17, 255], font);
        Render.StringCustom(x, y - 420 + 105, 0, 'FORCE HEAD', [132, 195, 16, 255], font)
    };
    if (isslow) {
        Render.StringCustom(x / 2 + 2, y / 2 + 67, 1, "DEATH WALKED", [ 255, 255, 255, 255 ], font ); 
    }
    if (ishide) {
        Render.StringCustom(x / 2 + 2, y / 2 + 57, 1, "DYNAMIC", [ 255, 255, 255, 255 ], font ); 
    }
    if (ishide) {
        Render.StringCustom(x / 0, y / 0, 1, "", [0, 0, 0,],font);
    }
    if (inverted) {
        Render.StringCustom(x / 2 + 55, y / 2 * 0.982, 1, "h", [color[0], color[1], color[2], 255], font1);
    } else {
        Render.StringCustom(x / 2 - 55, y / 2 * 0.982, 1, "g", [color[0], color[1], color[2], 255], font1);
    }*/

//}

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

/*const circle = function(x, y, r1, r2, s, d, color){
    for (var i = s; i < s + d; i++){
        const 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, color);
    }
}

const drawing = function(){
    const x = Global.GetScreenSize()[0] / 2, y = Global.GetScreenSize()[1] / 2;
    const delta = Math.min(Math.abs(Local.GetRealYaw() - Local.GetFakeYaw()) / 2, 58);

    circle(x, y, 6, 9, 0, (360 / 58) * delta, [255, 255, 255, 255]);
}

Cheat.RegisterCallback("Draw", "drawing");*/

UI.AddSliderInt("Shift", 0, 17)
UI.AddSliderInt("Tolerance", 0, 8)
UI.AddSliderInt("Fire", 0, 17)

function can_shift_shot(ticks_to_shift) {
    var me = Entity.GetLocalPlayer();
    var wpn = Entity.GetWeapon(me);

    if (me == null || wpn == null)
        return false;

    var tickbase = Entity.GetProp(me, "CCSPlayer", "m_nTickBase");
    var curtime = Globals.TickInterval() * (tickbase-ticks_to_shift)

    if (curtime < Entity.GetProp(me, "CCSPlayer", "m_flNextAttack"))
        return false;

    if (curtime < Entity.GetProp(wpn, "CBaseCombatWeapon", "m_flNextPrimaryAttack"))
        return false;

    return true;
}

function _TBC_CREATE_MOVE() {
    var is_charged = Exploit.GetCharge()

    var shift = UI.GetValue("Shift")

    var tolerance = UI.GetValue("Tolerance")

    var shot = UI.GetValue("Fire")

    Exploit[(is_charged != 1 ? "Enable" : "Disable") + "Recharge"]()

    if (can_shift_shot(shot) && is_charged != 1) {
        Exploit.DisableRecharge();
        Exploit.Recharge()
    }

    Exploit.OverrideTolerance(tolerance);
    Exploit.OverrideShift(shift);
}

function _TBC_UNLOAD() {
    Exploit.EnableRecharge();
}

Cheat.RegisterCallback("CreateMove", "_TBC_CREATE_MOVE");
Cheat.RegisterCallback("Unload", "_TBC_UNLOAD");

function on_cm()
{
    chargestate = Exploit.GetCharge()
    Cheat.Print(chargestate + "\n")
}
Cheat.RegisterCallback("CreateMove", "on_cm")