Crack Lua Melonity.solutions src leak

Начинающий
Статус
Оффлайн
Регистрация
29 Июн 2020
Сообщения
54
Реакции[?]
4
Поинты[?]
1K

Данный скрипт не проверялся модераторами, так как является кряком приватной LUA и в нём может присутствовать обфускация. Даже известные пользователи могут выложить вредоносный скрипт под видом крякнутого, поэтому любое использование исключительно на свой страх и риск.

Hellfish#9343

Код:
local info = [[

    ███╗░░░███╗███████╗██╗░░░░░░█████╗░███╗░░██╗██╗████████╗██╗░░░██╗
    ████╗░████║██╔════╝██║░░░░░██╔══██╗████╗░██║██║╚══██╔══╝╚██╗░██╔╝
    ██╔████╔██║█████╗░░██║░░░░░██║░░██║██╔██╗██║██║░░░██║░░░░╚████╔╝░
    ██║╚██╔╝██║██╔══╝░░██║░░░░░██║░░██║██║╚████║██║░░░██║░░░░░╚██╔╝░░
    ██║░╚═╝░██║███████╗███████╗╚█████╔╝██║░╚███║██║░░░██║░░░░░░██║░░░
    ╚═╝░░░░░╚═╝╚══════╝╚══════╝░╚════╝░╚═╝░░╚══╝╚═╝░░░╚═╝░░░░░░╚═╝░░░
    
    ░██████╗░█████╗░██╗░░░░░██╗░░░██╗████████╗██╗░█████╗░███╗░░██╗░██████╗
    ██╔════╝██╔══██╗██║░░░░░██║░░░██║╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
    ╚█████╗░██║░░██║██║░░░░░██║░░░██║░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
    ░╚═══██╗██║░░██║██║░░░░░██║░░░██║░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
    ██████╔╝╚█████╔╝███████╗╚██████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
    ╚═════╝░░╚════╝░╚══════╝░╚═════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░


Our Website - https://melonity.solutions
Our Shoppy - https://shoppy.gg/@melonity
Our Discord - https://discord.gg/UAuh9Y9gMG
Best Private Servers - https://ghosty.company
Best League - https://discord.gg/ghosty]]
local build = "Beta"
local version = "0.1.3"
local lua_name = "Melonity Beta - "
local update = [[- Added "Chat Logs" with color.

[+] - Functions that need a binding

[-] - Functions that don't need a binding

[~] - Of your choice ]]
EngineClient.ExecuteClientCmd("clear")
print(info)

local cur_shot = 0
local logs = {}
local username = Cheat.GetCheatUserName()
local should_hide = true

welcome_back = Menu.Text("--> Global", "Info", "Welcome Back, " ..username.."")
info_lua = Menu.Text("--> Global", "Info", "Current build: " .. build .."")
update_log = Menu.Text("--> Global", "Info", "Update Log: ")
update_lua = Menu.Text("--> Global", "Info", update)



local helpers = {
    set_visibility = function(array, visibility, iskluchenie)
        for i, element in pairs(array) do
            if iskluchenie and i == iskluchenie then
                goto continue
            end
            element:SetVisible(visibility)
            ::continue::
        end
    end,
    round = function(x)
        return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
    end,
    lerp = function(start, end_pos, time)
        time = GlobalVars.frametime * (time * 175)
        if time < 0 then
            time = 0.01
        elseif time > 1 then
            time = 1
        end
        local delta = end_pos - start
        delta = delta * time
        delta = delta + start
        return delta
    end,
    HSVToRGB = function(h, s, v)
        local r, g, b

        local i = math.floor(h * 6);
        local f = h * 6 - i;
        local p = v * (1 - s);
        local q = v * (1 - f * s);
        local t = v * (1 - (1 - f) * s);

        i = i % 6

        if i == 0 then
            r, g, b = v, t, p
        elseif i == 1 then
            r, g, b = q, v, p
        elseif i == 2 then
            r, g, b = p, v, t
        elseif i == 3 then
            r, g, b = p, q, v
        elseif i == 4 then
            r, g, b = t, p, v
        elseif i == 5 then
            r, g, b = v, p, q
        end

        return Color.new(r, g, b, 1)
    end,
    get_entity_address = function(entity_index)
        local addr = GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER, entity_index)
        return addr
    end,
    is_entity_alive = function(entity)
        if not entity then
            return false
        end
        local hp = entity:GetProp("m_iHealth")
        if not hp then
            return false
        end
        return entity:GetProp("m_iHealth") > 0
    end
}

local ui_array = {

}

local ofuncs = {
    {"Switch" , Menu.Switch},
    {"Combo" , Menu.Combo},
    {"ColorEdit" , Menu.ColorEdit},
    {"MultiCombo" , Menu.MultiCombo},
    {"SliderInt" , Menu.SliderInt},
    {"TextBox" , Menu.TextBox},
}

for i=1 , #ofuncs do
    Menu[ofuncs[i][1]] = function(tab, name,...) --mega iq fix for messy code
        local res = ofuncs[i][2](tab,name,...)
        if not ui_array[tab] then ui_array[tab] = {} end
        ui_array[tab][name] =  res
        return res
    end
end

local discord_button = Menu.Button("--> Global","Info", "Discord Server", "Join to our Discord Server", function()
    local panorama_handle = Panorama.Open(); local discord = panorama_handle.SteamOverlayAPI.OpenExternalBrowserURL("https://discord.gg/UAuh9Y9gMG")
end)

local ffi = require("ffi")
 
ffi.cdef[[
    bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes);
    void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);

    bool DeleteUrlCacheEntryA(const char* lpszUrlName);
]]
local urlmon = ffi.load 'UrlMon'
local wininet = ffi.load 'WinInet'

local function Download(from, to)
    wininet.DeleteUrlCacheEntryA(from)
    urlmon.URLDownloadToFileA(nil, from, to, 0,0)
end

local function CreateDir(path)
    ffi.C.CreateDirectoryA(path, NULL)
end

local get_font = Menu.Button("--> Global", "Info", "Download Files", "Download Files", function()
    CreateDir("nl\\Melonity Solutions\\")
    CreateDir("nl\\Melonity Solutions\\fonts")
    Download('https://api.melonity.solutions/bullet.ttf', 'nl\\Melonity Solutions\\fonts\\bullet.ttf')
    Download('https://api.melonity.solutions/smallest_pixel-7.ttf', 'nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf')
    Download('https://api.melonity.solutions/Acta_Symbols_W95_Arrows.ttf', 'nl\\Melonity Solutions\\fonts\\Acta_Symbols_W95_Arrows.ttf')
    CreateDir("csgo\\sound\\buttons\\")
    Download('https://api.melonity.solutions/skeet.wav', 'csgo\\sound\\buttons\\hitsound.wav')
    Cheat.AddNotify("Melonity Solutions" , "Files have been successfully installed. Reload the script.")
    end)


local function color(r,g,b,a)
    if not a then a = 255 end
    if not b then b = 0 end
    return Color.new(r/255,g/255,b/255,a/255)
end

local refs = {
    dt = Menu.FindVar("Aimbot", "Ragebot", "Exploits", "Double Tap"),
    yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    hs = Menu.FindVar("Aimbot", "Ragebot", "Exploits", "Hide Shots"),
    fd = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Fake Duck"),
    sw = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Slow Walk"),
    left_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Left Limit"),
    lbymode = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "LBY Mode"),
    right_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Right Limit"),
    fakeopt = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Fake Options"),
    invert = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Inverter"),
    baim = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"),
    safe = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Safe Points"),
    free_dsy = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Freestanding Desync"),
    shot_dsy = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Desync On Shot"),
    yaw_b = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    yaw_add = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Add"),
    desync = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Enable Fake Angle"),
    yaw_mod = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Modifier"),
    yaw_mod_deg = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Modifier Degree"),
    peek = Menu.FindVar("Miscellaneous", "Main", "Movement", "Auto Peek"),
    stop = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Conditions"),
    fl_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Lag", "Limit"),
    hitsound = Menu.FindVar("Visuals" , "World" , "Hit" , "Hit Sound"),
    wind = Menu.FindVar("Miscellaneous", "Main", "Other", "Windows"),
    logs = Menu.FindVar("Miscellaneous", "Main", "Other", "Event Log"),
    antiaimmodes = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    autopeekforlua = Menu.FindVar("Miscellaneous","Main","Movement","Auto Peek"),
    sp = Menu.FindVar("Aimbot","Ragebot","Misc","Safe Points"),
    damage_override_count = Menu.FindVar("Aimbot","Ragebot","Accuracy","Minimum Damage"),
    hc = Menu.FindVar("Aimbot", "Ragebot","Accuracy" ,"Hit Chance"),
}

local importants = {
    hitboxes = {"generic", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "?"},
}

local menu_elements = {
    teleport_in_air = Menu.Switch("> Rage", "Main", "[-] Teleport In Air", false),
    teleport_weapons = Menu.MultiCombo("> Rage", "Main", "Select Weapons", {"Scout", "AWP", "Pistols", "Zeus", "Knife", "Nades", "Other"}, 0),
    anti_defensive = Menu.Switch("> Rage", "Main", "[-] Enable Anti-Defensive", false, "Automatic Anti-Defensive"),
    custom_aa = Menu.Switch("> Anti Aim", "Main", "[-] Enable Custom AA", false, "You can configure Anti Aim how you want"),
    BodyDT = Menu.Switch("> Rage", "Other", "[-] Prefer body on DT", false, "Force Body on DT"),
    custom_type = Menu.Combo("> Anti Aim", "Main" , "AA Type" , {"Custom" , "Preset"} , 1),
    custom_presets = Menu.Combo("> Anti Aim", "Main", "Preset" , {"None" , "Alternative" , "Ideal Yaw" , "Hybrid", "LordwaVe", "KitKat"} , 0),
    custom_cond = Menu.Combo("> Anti Aim", "Custom Anti Aim" , "Configure for" , {"Stand" , "Slow Walk" , "Move" , "Air", "Crouch"} , 0),
    yaw_add_r = {},
    yaw_add_l = {},
    r_limit = {},
    l_limit = {},
    inv_jitter = {},
    random = {},
    freestand_desync = {},
    desync_on_shot = {},
    yaw_modifier = {},
    yaw_modifier_degree = {},
    fake_options = {},
    lby_mode = {},
    switch = Menu.Switch("> Anti-Bruteforce", "Main" , "[-] Enable Anti-Bruteforce" , false),
}

for i=1 , 5 do
    local text = i==1 and "[S] " or i==2 and "[SW] " or i==3 and "[M] " or i==4 and "[A] " or "[C] "
    menu_elements.yaw_add_r[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , ""..text.."Yaw Add Right" , 0 , -180 , 180)
    menu_elements.yaw_add_l[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , ""..text.."Yaw Add Left" , 0 , -180 , 180)
    menu_elements.yaw_modifier[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Yaw Modifier", {"Disabled", "Center", "Offset", "Random", "Spin"}, 0, "")
    menu_elements.yaw_modifier_degree[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Modifier Degree" , 0 , -180 , 180)
    menu_elements.r_limit[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Right Limit" , 60 , 0 , 60)
    menu_elements.l_limit[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Left Limit" , 60 , 0 , 60)
    menu_elements.inv_jitter[i] = Menu.Switch("> Anti Aim", "Custom Anti Aim" , text.."Invert Jitter" , false)
    menu_elements.random[i] = Menu.Switch("> Anti Aim", "Custom Anti Aim" , text.."Randomize" , false)
    menu_elements.freestand_desync[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Freestand Desync", {"Off", "Peek Fake", "Peek Real"}, 0, "")
    menu_elements.desync_on_shot[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Desync On Shot", {"Disabled", "Opposite", "Freestanding", "Switch"}, 0, "")
    menu_elements.fake_options[i] = Menu.MultiCombo("> Anti Aim", "Custom Anti Aim" , text.."Fake Options", {"Avoid Overlap", "Jitter", "Randomize Jitter", "Anti Bruteforce"}, 0)
    menu_elements.lby_mode[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."LBY Mode", {"Disabled", "Opposite", "Sway"}, 0, "")
end
local aa_links = {
    Menu.FindVar( "Aimbot", "Anti Aim", "Fake Angle", "Freestanding Desync" ),
    Menu.FindVar( "Aimbot", "Anti Aim", "Fake Angle", "Desync On Shot" ),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Modifier"),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Modifier Degree"),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Add"),
    Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Fake Options"),
    Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "LBY Mode"),
}

local handlers = {
    callbacks = {},
    subscribe = function(self, callback, funct)
        local isExists = false
        for i = 1, #self.callbacks do
            if self.callbacks[i].callback == callback then
                isExists = true
                break
            end
        end
        if not isExists then
            table.insert(self.callbacks, {callback = callback, functions = {}})
            isExists = true
        end
        for i = 1, #self.callbacks do
            if self.callbacks[i].callback == callback then
                table.insert(self.callbacks[i].functions, funct)
                break
            end
        end

        self:update()
    end,
    update = function(self)
        for i = 1, #self.callbacks do
            local function run(...)
                for j = 1, #self.callbacks[i].functions do
                    self.callbacks[i].functions[j](...)
                end
            end
            Cheat.RegisterCallback(self.callbacks[i].callback, run)
        end
    end
}


local function preferbaim()
    
        
    if not menu_elements.BodyDT:GetBool() then return end
    if Exploits:GetCharge() == 1 then
        Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"):SetInt(1)
    else
        Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"):SetInt(0)
    end
    
end

enable_indicators = Menu.Switch("> Visuals", "Main", "[-] Enable Indicators", false)
indicators_list = Menu.Combo("> Visuals", "Main" , "Indicators type" , {"Disabled", "Melonity", "Melonity 2.0"} , 0)

local color123456 = Menu.ColorEdit("> Visuals", "Main", "Main Color", Color.RGBA(185, 129, 235, 255))
local indic2_color = Menu.ColorEdit("> Visuals", "Main" , "Text Color" , Color.RGBA(185, 129, 235, 255))

arrows_type = Menu.Combo("> Visuals", "Main", "Arrows Type", {"Disabled", "Default", "Team Skeet", "Prediction"}, 0)

local font = Render.InitFont("Verdana", 12)

local normalize_yaw = function(yaw)
    while yaw > 180 do yaw = yaw - 360 end
    while yaw < -180 do yaw = yaw + 360 end
    return yaw
end

local import = Menu.Button("--> Global", "Config System", "Import Config", "Import config from clipboard")
local export = Menu.Button("--> Global", "Config System", "Export Config", "Export config to clipboard")
local load_def = Menu.Button("--> Global", "Config System", "Load Default Config", "Load Default config")


load_def:RegisterCallback(function()
    menu_elements.BodyDT:SetBool(true)
    menu_elements.teleport_in_air:SetBool(true)
    menu_elements.teleport_weapons:SetInt(1)
    menu_elements.custom_aa:SetBool(true)
    menu_elements.custom_type:SetInt(1)
    menu_elements.custom_presets:SetInt(4)
    legit_aa:SetBool(true)
    enable_indicators:SetBool(true)
    indicators_list:SetInt(1)
    enable_debug_panel:SetBool(true)
    keybinds_123:SetBool(true)
    select_ui_windows:SetInt(1)
    ui_themes:SetInt(3)
    enable_logs:SetBool(true)
    type2_of_logs:SetInt(1)
    type3_of_logs:SetInt(2 and 3)
    hitsound:SetBool(true)
    hitsound_vol:SetInt(100)
    d_switch:SetBool(true)
    d_min_damage:SetInt(1)
    enable_animation_breaker:SetBool(true)
    animation_breaker:SetInt(2 and 3)
    blur_background:SetBool(true)
    ttonkill:SetBool(true)
    
    
    Cheat.AddNotify("Melonity Solutions" , "Default Config successfully loaded")
    end)

local arrows_color = Menu.ColorEdit("> Visuals", "Main" , "Arrows Color" , Color.RGBA(185, 129, 235, 255))

function arrows_indicator()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==1 then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    local w = 25;
    local bgGap = 4;
    local player = EntityList.GetLocalPlayer();   
    local lifeState = player:GetProp("m_lifeState");
    local screen_size = EngineClient:GetScreenSize()
    local x = screen_size.x / 2;
    local y = screen_size.y / 2;
    local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
    local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
    local screen_size_middle3 = Vector2.new(screen_size.x / 2 + 59, screen_size.y / 2 - 11);
    local screen_size_middle4 = Vector2.new(screen_size.x / 2 - 68, screen_size.y / 2 - 11);
    local real_rotation = AntiAim.GetCurrentRealRotation();
    local desync_rotation = AntiAim.GetFakeRotation();
    local desync_delta = real_rotation - desync_rotation
    local yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base");
    local inverter_state = AntiAim.GetInverterState() == true
    local add_y = 0;
    if not player then return end   
    if not lifeState then
    if inverter_state then
        Render.Text(">", screen_size_middle, Color.new(1,1,1,1), 22, false) -- arrows_color:GetColor()
        Render.Text("<", screen_size_middle2, arrows_color:GetColor(), 22, false) -- Color.new(1,1,1,1)
        if  yawbase:Get() == 2  then
            Render.Text(">", screen_size_middle3, arrows_color:GetColor(), 22, false)
        end     
    else
        Render.Text(">", screen_size_middle,  arrows_color:GetColor(), 22, false)
        Render.Text("<", screen_size_middle2, Color.new(1,1,1,1), 22, false)
        if yawbase:Get() == 3 then
            Render.Text("<", screen_size_middle4, arrows_color:GetColor(), 22, false)
        end
    end
    end
end
end
end

local screen_size = EngineClient:GetScreenSize()
local x = screen_size.x / 2;
local y = screen_size.y / 2;
local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
local font_arrows = Render.InitFont("nl\\Melonity Solutions\\fonts\\Acta_Symbols_W95_Arrows.ttf", 55, {' '} )

function prediction_arrows()
    local player = EntityList.GetLocalPlayer();

    if not player then return end
    local lifeState = player:GetProp("m_lifeState");
    if not lifeState then
    if not enable_indicators:Get() then return end   
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==3 then
    local inverter_state = AntiAim.GetInverterState() == true
    if inverter_state then
        Render.Text("x", screen_size_middle, Color.new(255,255,255,255), 22, font_arrows, false)
        Render.Text("w", screen_size_middle2, arrows_color:GetColor(), 22, font_arrows, false)
    else
       Render.Text("x", screen_size_middle, arrows_color:GetColor(), 22, font_arrows, false)
        Render.Text("w", screen_size_middle2, Color.new(255,255,255,255), 22, font_arrows, false)
    end
end
end
end

end


local arrows_inverted_color = Menu.ColorEdit("> Visuals", "Main" , "Inverted Arrows Color" , Color.RGBA(255, 255, 255, 255))

function teamskeet_arrows()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==2 then
        local w = 25;
        local bgGap = 4;
        local screen_size = EngineClient:GetScreenSize()
        local x = screen_size.x / 2;
        local y = screen_size.y / 2;
        local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
        local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
        local screen_size_middle3 = Vector2.new(screen_size.x / 2 + 59, screen_size.y / 2 - 11);
        local screen_size_middle4 = Vector2.new(screen_size.x / 2 - 68, screen_size.y / 2 - 11);
        local real_rotation = AntiAim.GetCurrentRealRotation();
        local desync_rotation = AntiAim.GetFakeRotation();
        local desync_delta = real_rotation - desync_rotation
        local yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base");
        local inverter_state = AntiAim.GetInverterState() == true
        local player = EntityList.GetLocalPlayer();

        if not player then return end
    
        local lifeState = player:GetProp("m_lifeState");
        if not lifeState then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    if inverter_state then
        Render.BoxFilled(Vector2.new(x - 48, y - 10), Vector2.new(x - 46, y + 9), arrows_inverted_color:GetColor())
        Render.BoxFilled(Vector2.new(x + 49, y - 10), Vector2.new(x + 47, y + 9), Color.new(0, 0, 0, 0.3))
    else
        Render.BoxFilled(Vector2.new(x + 49, y - 10), Vector2.new(x + 47, y + 9), arrows_inverted_color:GetColor())
        Render.BoxFilled(Vector2.new(x - 48, y - 10), Vector2.new(x - 46, y + 9), Color.new(0, 0, 0, 0.3))
    end
    if yawbase:Get() == 2 then
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(arrows_color:GetColor(), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    elseif yawbase:Get() == 3 then           
        Render.PolyFilled(arrows_color:GetColor(), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    else
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    end
end
end
end
end

local is_dmg_override = false
local pixel = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)

function desync_delta()
    local desync_rotation = AntiAim.GetFakeRotation()
    local real_rotation = AntiAim.GetCurrentRealRotation()
    local delta_to_draw = math.min(math.abs(real_rotation - desync_rotation) / 2, 60)
    return string.format("%.1f", delta_to_draw)
end

local fake = desync_delta()
local currentTime = GlobalVars.curtime

local font = Render.InitFont("Verdana", 12)

enable_debug_panel = Menu.Switch("> Visuals", "Main" , "[-] Enable debug panel" , false)
list_debug_panel = Menu.Combo("> Visuals", "Main", "Select Debug Panel", {"Default", "Old"}, 0)

local last_spamd = GlobalVars.tickcount;
local islegitaa = 0;

local function calcDist(target1, target2)
    local lx = target1.x;
    local ly = target1.y;
    local lz = target1.z;
    local tx = target2.x;
    local ty = target2.y;
    local tz = target2.z;
    local dx = lx - tx;
    local dy = ly - ty;
    local dz = lz - tz;
    return math.sqrt(dx * dx + dy * dy + dz * dz);
end

local huy = false
local legit_aa_on = false
local dist = 0
function hostage_check(getplayer)
    local ents = EntityList.GetEntitiesByClassID(97)
    local lp_pos = getplayer:GetRenderOrigin()
    for i = 1, #ents do
        if ents[i] ~= nil then
            local ent = ents[i]
            local origin = ent:GetRenderOrigin()
            local dist = lp_pos:DistTo(origin)
            if dist < 64 then
                return false
            end
        end

    end
    return true
end

function bomb_check(me)
    local weap = me:GetActiveWeapon()
    if weap ~= nil then
        if weap:GetClassId() == 34 then
            return false
        else
            return true
        end
    else
        return false
    end
end

function defuse_check(getplayer)
    local ents = EntityList.GetEntitiesByClassID(129)
    local lp_pos = getplayer:GetRenderOrigin()
    for i = 1, #ents do
        if ents[i] ~= nil then
            local ent = ents[i]
            local origin = ent:GetRenderOrigin()
            local dist = lp_pos:DistTo(origin)
            if dist < 100 then
                return false
            end
        end

    end
    return true
end

local anti_brute = {
    working = false,
    num_phases = Menu.SliderInt("> Anti-Bruteforce", "Anti-Bruteforce" , "" , 2 , 2 , 10),
    cur_phase = 0,
    timer = 0,
    phases = {},


    adjust_abrute = function(self)
        local n = self.num_phases:Get()
        local b = menu_elements.switch:Get()
        self.add_phase:SetVisible(b)
        self.remove_phase:SetVisible(b)
        for i=1 , 10 do
            self.phases[i]:SetVisible(i-1<n and b)
        end
    end
}

for i=1 , 10 do
    anti_brute.phases[i] = Menu.SliderInt("> Anti-Bruteforce", "Anti-Bruteforce" , "Phase "..i , 60 , -60 , 60)
end

anti_brute.num_phases:SetVisible(false)

anti_brute.add_phase = Menu.Button("> Anti-Bruteforce", "Anti-Bruteforce" , "Add Phase" , "" , function()





    if anti_brute.num_phases:Get() > 9 then
        Cheat.AddNotify("Melonity Solutions" , "Cannot add more phases")
        return
    end


    anti_brute.num_phases:Set( anti_brute.num_phases:Get() +1)
    anti_brute:adjust_abrute()
end)

anti_brute.remove_phase = Menu.Button("> Anti-Bruteforce", "Anti-Bruteforce" , "Remove Phase" , "" , function()
    if anti_brute.num_phases:Get() < 3 then
        Cheat.AddNotify("Melonity Solutions" , "Cannot remove more phases")
        return
    end

    anti_brute.num_phases:Set( anti_brute.num_phases:Get() -1)
    anti_brute:adjust_abrute()
end)

menu_elements.switch:RegisterCallback(function() anti_brute:adjust_abrute() end)
anti_brute:adjust_abrute()

local externded_desync_switch = Menu.Switch("> Anti Aim", "Main", "[~] Extended Desync" , false)
handlers:subscribe("prediction" , function(cmd)
    if not externded_desync_switch:Get() then return end

    if  refs.sw:Get() or  EntityList.GetLocalPlayer():GetProp("m_vecVelocity"):Length() <20 then 

    local side = AntiAim.GetInverterState() and 1 or -1
    cmd.viewangles.roll = 44 * side
    end
end)

function indicators_melonity2()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()==2 then
    local player = EntityList.GetLocalPlayer();

    if not player then return end

    local lifeState = player:GetProp("m_lifeState");
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end 
    local indic2_color2 = indic2_color:GetColor()
    local x = EngineClient.GetScreenSize().x+8
    local y = EngineClient.GetScreenSize().y

    if AntiAim.GetInverterState() == false then
        invert ="R"
    else
        invert ="L"
    end

    local  is_dmg_override = false
    local binds = Cheat.GetBinds()
    for i=1, #binds do
        local bind = binds[i]
        if bind:IsActive() then
            if bind:GetName()=="Minimum Damage" then
                is_dmg_override = true
            end
        end
    end

    if currentTime + 0.38 < GlobalVars.curtime then
        currentTime = GlobalVars.curtime
        fake = desync_delta()
    end

    local function clamp(val, min, max) if val > max then return max end if min > val then return min end return val end
    local real_rotation = AntiAim.GetCurrentRealRotation();
    local desync_rotation = AntiAim.GetFakeRotation();
    local  desync_delta = clamp(math.floor(math.abs(real_rotation - desync_rotation)) , 0 , 58)

    local ay = 20
    local alpha = math.min(math.floor(math.sin((GlobalVars.realtime%3) * 2) * 190 + 60), 255)

    if not player then return end
    if not lifeState then
    local eternal_ts = Render.CalcTextSize("MELONI ", 10, pixel)
    Render.Text("MELONITY", Vector2.new(x/2, y/2+ay), indic2_color2, 10, pixel, true)
    Render.Text("BETA", Vector2.new(x/2+eternal_ts.x+6, y/2+ay), Color.RGBA(255, 255, 255, alpha), 10, pixel, true)
    ay = ay + 10.5
    
    local text_ =""
    local clr0 = Color.RGBA(0, 0, 0, 0)
    if refs.sw:GetBool() then
        text_ ="LAVELAS MODE: "
        clr0 = Color.RGBA(255, 50, 50, 255)
    else
        text_ ="DYNAMIC: "
        clr0 = Color.RGBA(130, 130, 255, 255)
    end


    local d_ts = Render.CalcTextSize(text_, 10, pixel)
    Render.Text(text_, Vector2.new(x/2, y/2+ay), clr0, 10, pixel, true)
    Render.Text(desync_delta.."°", Vector2.new(x/2+d_ts.x, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
    ay = ay + 10.5
    

    local fake_ts = Render.CalcTextSize("FAKE YAW: ", 10, pixel)
    Render.Text("FAKE YAW:", Vector2.new(x/2, y/2+ay), Color.RGBA(185, 129, 235, 255), 10, pixel, true)
    Render.Text(invert, Vector2.new(x/2+fake_ts.x, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
    ay = ay + 10.5

    local asadsa = math.min(math.floor(math.sin((Exploits.GetCharge()%2) * 1) * 122), 100)
        if refs.dt:GetBool() then
            Render.Text("DT", Vector2.new(x/2, y/2+ay), Exploits.GetCharge() == 1 and Color.RGBA(0, 255, 0, 255) or Color.RGBA(255, 0, 0, 255), 10, pixel, true)
            ay = ay + 10.5
    end


    if is_dmg_override then
        Render.Text("DMG: "..tostring(refs.damage_override_count:Get()), Vector2.new(x/2, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
        ay = ay + 10.5
    end

    local ax = 0
    if refs.hs:GetBool() then
        Render.Text("HS", Vector2.new(x/2, y/2+ay), Color.RGBA(250, 173, 181, 255), 10, pixel, true)
        ay = ay + 10.5
    end

    Render.Text("BAIM", Vector2.new(x/2, y/2+ay), refs.baim:Get() == 2 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("BAIM ", 10, pixel).x

    Render.Text("SP", Vector2.new(x/2+ax, y/2+ay), refs.sp:Get() == 2 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("SP ", 10, pixel).x

    Render.Text("FS", Vector2.new(x/2+ax, y/2+ay), refs.yaw_b:Get() == 5 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("FS ", 10, pixel).x

    Render.Text("RL", Vector2.new(x/2+ax, y/2+ay), externded_desync_switch:Get() and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
end
end
end

function melonity_main_indic()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()==1 then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    local invert = AntiAim.GetInverterState() == true
    local x = EngineClient.GetScreenSize().x/2
    local y = EngineClient.GetScreenSize().y/2
    local ay = 23
    local delta = math.abs(normalize_yaw(AntiAim.GetCurrentRealRotation() % 360 - AntiAim.GetFakeRotation() % 360)) / 2
    local clr = Color.new(color123456:GetColor().r, color123456:GetColor().g, color123456:GetColor().b, 0)
    local clr1 = Color.new(color123456:GetColor().r, color123456:GetColor().g, color123456:GetColor().b, 1)
    local Render_Indicator = function(text, ay2, color, size, font)
        ts = Render.CalcTextSize(text, size, font)
        Render.Text(text, Vector2.new(x-ts.x/2+4, y+ay2+1), Color.RGBA(0,0,0,255), size, font)
        Render.Text(text, Vector2.new(x-ts.x/2+3, y+ay2), Color.RGBA(255,255,255,255), size, font)
    end
    if lp:GetPlayer():IsAlive() then
        local z = Render.CalcTextSize(">", 24)
        Render.Text(">", Vector2.new(x + 38, y - z.y/2), invert and Color.RGBA(255,255,255,255) or clr1, 23, true)
        Render.Text("<", Vector2.new(x - z.x - 38, y - z.y/2), invert and clr1 or Color.RGBA(255,255,255,255), 23, true)


        Render_Indicator(math.floor(delta).."°", ay, Color.RGBA(255,255,255,255), 12, font)

        Render.GradientBoxFilled(Vector2.new(x-math.floor(delta), y+36), Vector2.new(x, y+39), clr, clr1, clr, clr1)
        Render.GradientBoxFilled(Vector2.new(x+math.floor(delta), y+36), Vector2.new(x, y+39), clr, clr1, clr, clr1)

        local local_player = EngineClient.GetLocalPlayer()
        local player = EntityList.GetClientEntity(local_player)
        local is_moving = #(EntityList.GetLocalPlayer():GetProp("m_vecVelocity"))>5
        if not player then
            return
        end

        local flags = player:GetProp("m_fFlags")
        
        local aa_state = "STANDING"
        if is_moving then
            aa_state = "MOVING"
        end
        
        if (flags == 256) then
            aa_state = "AIR"
        end

        if player:GetProp("m_flDuckAmount") > 0.9 then
            aa_state = "CROUCHING"   
        end

        if refs.sw:GetBool() then
            aa_state = "SLOW-WALKING"
        end

        if externded_desync_switch:Get() then
            aa_state = "ROLL AA"
        end

        Render_Indicator("Melonity - ".. aa_state .."", ay+22, Color.RGBA(255,255,255,255), 12, font)
    end
end
end


enable_antibackstab = Menu.Switch("> Anti Aim", "Main", "[~] Anti-Backstab", false)


switch_flick = Menu.Switch("> Anti Aim", "Other", "[~] Fake Flick", false)
sliderint_flick = Menu.SliderInt("> Anti Aim", "Other", "Fake Flick Delta", 90, 35, 120, "")

local a = 0.0;
local b = true;
local flick_on_prediction = function()
    if not switch_flick:Get() or not EntityList.GetLocalPlayer() or EntityList.GetLocalPlayer():GetProp('m_vecVelocity'):Length2D() > 5 or bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1) == 0 then return end

    if GlobalVars.realtime - a >= 0.22 + (b and 0.01 or -0.01) then
        AntiAim.OverrideYawOffset(sliderint_flick:Get() * (AntiAim.GetInverterState() and -1 or 1));
        a = GlobalVars.realtime;
        b = not b;
    end
end

enable_animation_breaker = Menu.Switch("> Anti Aim", "Other", "[~] Enable Animation Breaker", false, "Your animations will be broken")
animation_breaker = Menu.MultiCombo("> Anti Aim", "Other", "Select Breaker", {"Static legs in air", "Leg Breaker" , "Pitch 0 on land"}, 0)

legit_aa = Menu.Switch("> Anti Aim", "Main", "[~] Anti-Aim on Use", false, "Working 'E', Bomb Planting and etc")

local function normalize_angle(angle)
    if angle < -180 then angle = angle + 360 end
    if angle > 180 then angle = angle - 360 end
    return angle
end

local checks = {false , false , false , false}
local jit = 1
handlers:subscribe("pre_prediction" , function()
    
    if FakeLag.SentPackets() ~= 0 then
        jit = jit * -1
    end
    

end )

function aa_main(args)
    if not menu_elements.custom_aa:Get() or legit_aa_on or edge_on or anti_brute.working then return end
    local localplayer = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
    local getplayer = localplayer:GetPlayer()
    local localplayer_velocity = Vector.new(localplayer:GetProp( "m_vecVelocity[0]") , localplayer:GetProp("m_vecVelocity[1]")  , localplayer:GetProp( "m_vecVelocity[2]") )
    local localplayer_speed =math.ceil(localplayer_velocity:Length2D())
    local lp = EntityList.GetLocalPlayer()
    local crouch_check = lp:GetProp("m_flDuckAmount") > 0.89 and not refs.fd:Get()
    local stand_check = localplayer_speed<10
    local preset = menu_elements.custom_presets
    local air_check = bit.band(getplayer:GetProp("m_fFlags") , 1 ) == 0
    local sw_check = refs.sw:Get() or refs.sw:Get()
    local move_check = not sw_check and not air_check and not stand_check and not crouch_check
    checks = {stand_check , sw_check , move_check , air_check, crouch_check}
   -- if menu_elements.custom_type:Get()==0 then
    for i=1 , 5 do
        if checks[i] then
            local yaw_add = AntiAim.GetInverterState() and menu_elements.yaw_add_r[i]:Get() or menu_elements.yaw_add_l[i]:Get()
            AntiAim.OverrideLimit(menu_elements.random[i]:Get() and Utils.RandomInt(25, 45) or  refs.invert:Get() and menu_elements.l_limit[i]:Get() or menu_elements.r_limit[i]:Get() )
            if menu_elements.inv_jitter[i]:Get() and not menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(jit == 1 )
            elseif menu_elements.inv_jitter[i]:Get() and  menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(Utils.RandomInt(0, 100)%2==0 )
            elseif  menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(refs.invert:Get() )
            end
            aa_links[1]:Set( menu_elements.freestand_desync[i]:Get() )
            aa_links[2]:Set( menu_elements.desync_on_shot[i]:Get() )
            aa_links[3]:Set( menu_elements.yaw_modifier[i]:Get() )
            aa_links[4]:Set( menu_elements.yaw_modifier_degree[i]:Get() )
            aa_links[5]:Set( yaw_add )
            aa_links[6]:Set( menu_elements.fake_options[i]:Get() )
            aa_links[7]:Set( menu_elements.lby_mode[i]:Get() )
        end
    end
 -- end

    if menu_elements.custom_type:Get()==1 then
        if preset:Get()==0 then
            for i=1 , 5 do
                menu_elements.yaw_add_r[i]:SetInt(0)
                menu_elements.yaw_add_l[i]:SetInt(0)
                menu_elements.r_limit[i]:SetInt(60)
                menu_elements.l_limit[i]:SetInt(60)
                menu_elements.inv_jitter[i]:SetBool(false)
                menu_elements.random[i]:SetBool(false)
                menu_elements.freestand_desync[i]:Set(0)
                menu_elements.desync_on_shot[i]:Set(0)
                menu_elements.yaw_modifier[i]:Set(0)
                menu_elements.yaw_modifier_degree[i]:Set(0)
            end
        end
        if preset:Get()==3 then
            menu_elements.random[1]:SetBool(true)
            menu_elements.yaw_add_r[2]:SetInt(-5)
            menu_elements.yaw_add_l[2]:SetInt(-5)
            menu_elements.r_limit[2]:SetInt(17)
            menu_elements.l_limit[2]:SetInt(17)
            menu_elements.inv_jitter[3]:SetBool(true)
            menu_elements.r_limit[2]:SetInt(45)
            menu_elements.l_limit[2]:SetInt(45)
            menu_elements.r_limit[3]:SetInt(55)
            menu_elements.l_limit[3]:SetInt(55)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(55)
            menu_elements.l_limit[4]:SetInt(55)
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(0)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(0)
            menu_elements.inv_jitter[3]:Set(false)
            menu_elements.inv_jitter[2]:Set(false)
            menu_elements.random[1]:Set(true)
        end

        if preset:Get()==2 then
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(0)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(0)
            menu_elements.inv_jitter[3]:Set(true)
            menu_elements.inv_jitter[2]:Set(true)
            menu_elements.random[1]:Set(true)
            menu_elements.r_limit[2]:SetInt(45)
            menu_elements.l_limit[2]:SetInt(45)
            menu_elements.r_limit[3]:SetInt(55)
            menu_elements.l_limit[3]:SetInt(55)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(55)
            menu_elements.l_limit[4]:SetInt(55)
        end

        
        if preset:Get()==1 then
            
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(-12)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(-7)
            menu_elements.r_limit[2]:SetInt(60)
            menu_elements.inv_jitter[3]:Set(true)
            menu_elements.inv_jitter[4]:Set(true)
            menu_elements.inv_jitter[1]:Set(true)
            menu_elements.inv_jitter[2]:Set(true)
            menu_elements.l_limit[2]:SetInt(60)
            menu_elements.r_limit[3]:SetInt(60)
            menu_elements.l_limit[3]:SetInt(60)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(60)
            menu_elements.l_limit[4]:SetInt(60)

        end

        if preset:Get()==4 then
            -- stand
            menu_elements.yaw_add_r[1]:SetInt(22)
            menu_elements.yaw_add_l[1]:SetInt(-15)
            menu_elements.yaw_modifier[1]:SetInt(1)
            menu_elements.yaw_modifier_degree[1]:SetInt(22)
            menu_elements.r_limit[1]:SetInt(60)
            menu_elements.l_limit[1]:SetInt(60)
            menu_elements.fake_options[1]:Set(2)
            menu_elements.lby_mode[1]:Set(1)
            menu_elements.freestand_desync[1]:Set(0)
            menu_elements.desync_on_shot[1]:Set(2)
            -- slowwalk
            menu_elements.yaw_add_r[2]:SetInt(20)
            menu_elements.yaw_add_l[2]:SetInt(-12)
            menu_elements.yaw_modifier[2]:SetInt(1)
            menu_elements.yaw_modifier_degree[2]:SetInt(30)
            menu_elements.r_limit[2]:SetInt(60)
            menu_elements.l_limit[2]:SetInt(60)
            menu_elements.fake_options[2]:Set(2)
            menu_elements.lby_mode[2]:Set(1)
            menu_elements.freestand_desync[2]:Set(0)
            menu_elements.desync_on_shot[2]:Set(2)
            -- move
            menu_elements.yaw_add_r[3]:SetInt(22)
            menu_elements.yaw_add_l[3]:SetInt(-15)
            menu_elements.yaw_modifier[3]:SetInt(1)
            menu_elements.yaw_modifier_degree[3]:SetInt(48)
            menu_elements.r_limit[3]:SetInt(60)
            menu_elements.l_limit[3]:SetInt(60)
            menu_elements.fake_options[3]:Set(2)
            menu_elements.lby_mode[3]:Set(0)
            menu_elements.freestand_desync[3]:Set(0)
            menu_elements.desync_on_shot[3]:Set(2)
            -- air
            menu_elements.yaw_add_r[4]:SetInt(-12)
            menu_elements.yaw_add_l[4]:SetInt(-7)
            menu_elements.yaw_modifier[4]:SetInt(1)
            menu_elements.yaw_modifier_degree[4]:SetInt(48)
            menu_elements.r_limit[4]:SetInt(47)
            menu_elements.l_limit[4]:SetInt(47)
            menu_elements.fake_options[4]:Set(2)
            menu_elements.fake_options[4]:Set(3)
            menu_elements.lby_mode[4]:Set(1)
            menu_elements.freestand_desync[4]:Set(0)
            menu_elements.desync_on_shot[4]:Set(2)
            -- crouch
            menu_elements.yaw_add_r[5]:SetInt(-29)
            menu_elements.yaw_add_l[5]:SetInt(-20)
            menu_elements.yaw_modifier[5]:SetInt(1)
            menu_elements.yaw_modifier_degree[5]:SetInt(22)
            menu_elements.r_limit[5]:SetInt(60)
            menu_elements.l_limit[5]:SetInt(60)
            menu_elements.fake_options[5]:Set(2)
            menu_elements.lby_mode[5]:Set(1)
            menu_elements.freestand_desync[5]:Set(0)
            menu_elements.desync_on_shot[5]:Set(1)
        end

        if preset:Get()==5 then
            -- stand
            menu_elements.yaw_add_r[1]:SetInt(5)
            menu_elements.yaw_add_l[1]:SetInt(-5)
            menu_elements.yaw_modifier[1]:SetInt(0)
            menu_elements.yaw_modifier_degree[1]:SetInt(0)
            menu_elements.r_limit[1]:SetInt(36)
            menu_elements.l_limit[1]:SetInt(41)
            menu_elements.fake_options[1]:Set(0)
            menu_elements.lby_mode[1]:Set(1)
            menu_elements.freestand_desync[1]:Set(1)
            menu_elements.desync_on_shot[1]:Set(2)
            -- slowwalk
            menu_elements.yaw_add_r[2]:SetInt(-5)
            menu_elements.yaw_add_l[2]:SetInt(11)
            menu_elements.yaw_modifier[2]:SetInt(4)
            menu_elements.yaw_modifier_degree[2]:SetInt(22)
            menu_elements.r_limit[2]:SetInt(30)
            menu_elements.l_limit[2]:SetInt(30)
            menu_elements.random[2]:SetBool(true)
            menu_elements.fake_options[2]:Set(2)
            menu_elements.lby_mode[2]:Set(0)
            menu_elements.freestand_desync[2]:Set(0)
            menu_elements.desync_on_shot[2]:Set(0)
            -- move
            menu_elements.yaw_add_r[3]:SetInt(-15)
            menu_elements.yaw_add_l[3]:SetInt(21)
            menu_elements.yaw_modifier[3]:SetInt(1)
            menu_elements.yaw_modifier_degree[3]:SetInt(51)
            menu_elements.r_limit[3]:SetInt(41)
            menu_elements.l_limit[3]:SetInt(45)
            menu_elements.random[3]:SetBool(true)
            menu_elements.fake_options[3]:Set(2)
            menu_elements.lby_mode[3]:Set(1)
            menu_elements.freestand_desync[3]:Set(0)
            menu_elements.desync_on_shot[3]:Set(1)
            -- air
            menu_elements.yaw_add_r[4]:SetInt(-3)
            menu_elements.yaw_add_l[4]:SetInt(3)
            menu_elements.yaw_modifier[4]:SetInt(0)
            menu_elements.yaw_modifier_degree[4]:SetInt(0)
            menu_elements.r_limit[4]:SetInt(37)
            menu_elements.l_limit[4]:SetInt(31)
            menu_elements.fake_options[4]:Set(0)
            menu_elements.lby_mode[4]:Set(1)
            menu_elements.freestand_desync[4]:Set(0)
            menu_elements.desync_on_shot[4]:Set(3)
            -- crouch
            menu_elements.yaw_add_r[5]:SetInt(-7)
            menu_elements.yaw_add_l[5]:SetInt(7)
            menu_elements.yaw_modifier[5]:SetInt(0)
            menu_elements.yaw_modifier_degree[5]:SetInt(0)
            menu_elements.r_limit[5]:SetInt(38)
            menu_elements.l_limit[5]:SetInt(33)
            menu_elements.fake_options[5]:Set(0)
            menu_elements.lby_mode[5]:Set(2)
            menu_elements.freestand_desync[5]:Set(0)
            menu_elements.desync_on_shot[5]:Set(1)

        end

    end

    if externded_desync_switch:Get() then
        menu_elements.yaw_modifier[1]:SetInt(0)
        menu_elements.yaw_modifier_degree[1]:SetInt(0)
        menu_elements.fake_options[1]:Set(0)
        menu_elements.r_limit[1]:SetInt(45)
        menu_elements.l_limit[1]:SetInt(45)
        menu_elements.fake_options[1]:Set(0)
        menu_elements.lby_mode[1]:Set(0)
        menu_elements.freestand_desync[1]:Set(0)
        menu_elements.desync_on_shot[1]:Set(0)
        menu_elements.yaw_modifier[2]:SetInt(0)
        menu_elements.yaw_modifier_degree[2]:SetInt(0)
        menu_elements.fake_options[2]:Set(0)
        menu_elements.r_limit[2]:SetInt(45)
        menu_elements.l_limit[2]:SetInt(45)
        menu_elements.fake_options[2]:Set(0)
        menu_elements.lby_mode[2]:Set(0)
        menu_elements.freestand_desync[2]:Set(0)
        menu_elements.desync_on_shot[2]:Set(0)
        menu_elements.yaw_modifier[3]:SetInt(0)
        menu_elements.yaw_modifier_degree[1]:SetInt(0)
        menu_elements.fake_options[3]:Set(0)
        menu_elements.r_limit[3]:SetInt(45)
        menu_elements.l_limit[3]:SetInt(45)
        menu_elements.fake_options[3]:Set(0)
        menu_elements.lby_mode[3]:Set(0)
        menu_elements.freestand_desync[3]:Set(0)
        menu_elements.desync_on_shot[3]:Set(0)
        menu_elements.yaw_modifier[4]:SetInt(0)
        menu_elements.yaw_modifier_degree[4]:SetInt(0)
        menu_elements.fake_options[4]:Set(0)
        menu_elements.r_limit[4]:SetInt(45)
        menu_elements.l_limit[4]:SetInt(45)
        menu_elements.fake_options[4]:Set(0)
        menu_elements.lby_mode[4]:Set(0)
        menu_elements.freestand_desync[4]:Set(0)
        menu_elements.desync_on_shot[4]:Set(0)
        menu_elements.yaw_modifier[5]:SetInt(0)
        menu_elements.yaw_modifier_degree[5]:SetInt(0)
        menu_elements.fake_options[5]:Set(0)
        menu_elements.r_limit[5]:SetInt(45)
        menu_elements.l_limit[5]:SetInt(45)
        menu_elements.fake_options[5]:Set(0)
        menu_elements.lby_mode[5]:Set(0)
        menu_elements.freestand_desync[5]:Set(0)
        menu_elements.desync_on_shot[5]:Set(0)
    end

end

menu_elements.custom_type:RegisterCallback(function()
    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetInt(0)
        menu_elements.yaw_add_l[i]:SetInt(0)
        menu_elements.r_limit[i]:SetInt(60)
        menu_elements.l_limit[i]:SetInt(60)
        menu_elements.inv_jitter[i]:SetBool(false)
        menu_elements.random[i]:SetBool(false)
        menu_elements.freestand_desync[i]:Set(0)
        menu_elements.desync_on_shot[i]:Set(0)
        menu_elements.yaw_modifier[i]:Set(0)
        menu_elements.yaw_modifier_degree[i]:Set(0)
        menu_elements.fake_options[i]:Set(0)
        menu_elements.lby_mode[i]:Set(0)
    end
end)

menu_elements.custom_presets:RegisterCallback(function()
    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetInt(0)
        menu_elements.yaw_add_l[i]:SetInt(0)
        menu_elements.r_limit[i]:SetInt(60)
        menu_elements.l_limit[i]:SetInt(60)
        menu_elements.inv_jitter[i]:SetBool(false)
        menu_elements.random[i]:SetBool(false)
        menu_elements.freestand_desync[i]:Set(0)
        menu_elements.desync_on_shot[i]:Set(0)
        menu_elements.yaw_modifier[i]:Set(0)
        menu_elements.yaw_modifier_degree[i]:Set(0)
        menu_elements.fake_options[i]:Set(0)
        menu_elements.lby_mode[i]:Set(0)
        menu_elements.yaw_modifier[i]:SetInt(0)
        menu_elements.yaw_modifier_degree[i]:SetInt(0)
    end
end)

local tick = GlobalVars.tickcount
function desync_on_use(argss)
    if legit_aa:GetBool() then
        local yaw_b = refs.yaw_b:Get()
        local yaw_add = (yaw_b == 0 or yaw_b == 5) and 180 or yaw_b == 2 and -90 or yaw_b == 3 and 90 or 0
        local localplayer = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
        local getplayer = localplayer:GetPlayer()
        local buttonss = argss.buttons
        local view_angles = EngineClient:GetViewAngles()
        local use = bit.rshift(bit.lshift(argss.buttons, 26), 31)

        if use ~= 0 and hostage_check(getplayer) and bomb_check(getplayer) and defuse_check(getplayer) then
            tick = not huy and GlobalVars.tickcount or tick
            huy = true
            legit_aa_on = true
          
            AntiAim.OverridePitch(view_angles.pitch)
            AntiAim.OverrideYawOffset(180 + yaw_add)
            AntiAim.OverrideInverter(not refs.invert:GetBool())
        else
            huy = false
            legit_aa_on = false
        end
        if tick + 4 <= GlobalVars.tickcount and hostage_check(getplayer) and bomb_check(getplayer) and
            defuse_check(getplayer) then
            argss.buttons = bit.band(argss.buttons, bit.bnot(32))
        end
    end
end

edge_yaw = Menu.Switch("> Anti Aim", "Other", "[~] Edge Yaw", false)

local function VectorLerp(vecSource, vecDestination, flPercentage)
    return vecSource + (vecDestination - vecSource) * flPercentage
end

local function NormalizeYaw(flYaw)
    while flYaw > 180 do flYaw = flYaw - 360 end
    while flYaw < -180 do flYaw = flYaw + 360 end
    return flYaw
end
local function VectorLerp(vecSource, vecDestination, flPercentage)
    return vecSource + (vecDestination - vecSource) * flPercentage
end

local vecTraceStart = Vector.new()
local edge_on = false

function edge(UserCmd)
    if not edge_yaw:GetBool() then
        return
    end

    local iLocalPlayerEntIndex = EngineClient:GetLocalPlayer()
    if not iLocalPlayerEntIndex then
        return
    end
    edge_on = false
    local pLocalPlayerEntity = EntityList.GetClientEntity(iLocalPlayerEntIndex)
    local pLocalPlayer = pLocalPlayerEntity:GetPlayer()

    local flVelocityZ = pLocalPlayer:GetProp('m_vecVelocity[2]')
    local bInJump = bit.band(UserCmd.buttons, 2) == 2
    if flVelocityZ ~= 0 or bInJump then
        return
    end

    if ClientState.m_choked_commands == 0 then vecTraceStart = pLocalPlayer:GetEyePosition() end

    local aTraceEnd = {}

    local angViewAngles = EngineClient:GetViewAngles()
    for flYaw = 18, 360, 18 do
        flYaw = NormalizeYaw(flYaw)

        local angEdge = QAngle.new(0, flYaw, 0)

        local vecTraceEnd = vecTraceStart + Cheat.AngleToForward(angEdge) * 0x60

        local traceInfo = EngineTrace.TraceRay(vecTraceStart, vecTraceEnd, pLocalPlayerEntity, 0x200400B)

        local flFraction = traceInfo.fraction
        local pEntity = traceInfo.hit_entity

        if pEntity and pEntity:GetClassName() == 'CWorld' and flFraction < 0.3 then
            aTraceEnd[#aTraceEnd+1] = {
                vecTraceEnd = traceInfo.endpos,
                flYaw = flYaw
            }
        end
    end

    table.sort(aTraceEnd, function(a, b)
        return a.flYaw < b.flYaw
    end)

    local angEdge

    if #aTraceEnd >= 2 then
        local vecTraceCenter = VectorLerp(aTraceEnd[1].vecTraceEnd, aTraceEnd[#aTraceEnd].vecTraceEnd, 0.5)

        angEdge = Cheat.VectorToAngle(vecTraceStart - vecTraceCenter)
    end
    
    if angEdge then
        local flYaw = angViewAngles.yaw
        local flEdgeYaw = angEdge.yaw

        local flDiff = NormalizeYaw(flEdgeYaw - flYaw)

        if math.abs(flDiff) < 90 then
            flDiff = 0
            flYaw = NormalizeYaw(flEdgeYaw + 180)
        end

        -- Static yaw
        local flNewYaw = -flYaw

        -- Apply edge yaw
        flNewYaw = NormalizeYaw(flNewYaw + flEdgeYaw + 180)

        flNewYaw = NormalizeYaw(flNewYaw + flDiff)
        edge_on = true
        AntiAim.OverrideYawOffset(flNewYaw)

    end
end

local vecTraceStart = Vector.new()
local edge_on = false

keybinds_123 = Menu.Switch("> Visuals", "Main", "[-] Enable UI Indicators", false)
select_ui_windows = Menu.MultiCombo("> Visuals", "Main", "Select UI", {"Keybinds", "Watermark"}, 0)
local custom_name_switch = Menu.Switch("> Visuals", "Main", "Custom Name" , false)
local custom_name_text = Menu.TextBox("> Visuals", "Main", "" , 64 , Cheat.GetCheatUserName())
local cheat_name = Menu.Combo("> Visuals", "Main" , "Cheat name" ,  {"Melonity" , "Neverlose"} , 0)
ui_themes =            Menu.Combo("> Visuals", "Main", "Theme", {"Gradient line", "Static line", "Fade line", "Animated"}, 0)
ui_line_color =        Menu.ColorEdit("> Visuals", "Main", "Line color", Color.new(100 / 255, 100 / 255, 255 / 255, 255 / 255))
bind_state_ui = Menu.Combo("> Visuals", "Main", "Bind State", {"Default", "Toggled", "Toggled v2"}, 0)
blur_background = Menu.Switch("> Visuals", "Main", "Blur Background", false)
tickbase_enable = Menu.Switch("> Visuals", "Main", "Tickbase Indicator" , false)
tickbase_indicator_color = Menu.ColorEdit("> Visuals", "Main", "Tickbase Indicator Color", Color.RGBA(100, 100, 255, 255))

local screen_size_keybinds = EngineClient:GetScreenSize()
local font_keybinds = Render.InitFont("Verdana", 12)
local floor_keybinds = math.floor
local font_size_keybinds = 12

local function text_color_keybinds(alpha)
    return Color.new(0.9, 0.9, 0.9, 0.95 * alpha)
end

local function color123(r, g, b, a) return Color.new(r / 255, g / 255, b / 255, a / 255) end
local function in_box(mouse, x, y, x2, y2) return (mouse.x > x) and (mouse.y > y) and (mouse.x < x2) and (mouse.y < y2) end
local function clamp(val, min, max) if val > max then return max end if min > val then return min end return val end

local function move(x, y, w, h, slider_x, slider_y)
    local mouse = cheat.GetMousePos()
    if (cheat.IsKeyDown(0x1) and cheat.IsMenuVisible() and in_box(mouse, x, y, x + w, y + h)) then
        slider_x:SetInt(mouse.x - w / 2)
        slider_y:SetInt(mouse.y - 10)
    end
end

local ui_keybinds_x =        Menu.SliderInt("> Visuals", "Main", "keybinds x", 5, 0, screen_size_keybinds.x)
local ui_keybinds_y =        Menu.SliderInt("> Visuals", "Main", "keybinds y", math.floor(screen_size_keybinds.y / 2), 0, screen_size_keybinds.y)

ui_keybinds_x:SetVisible(false)
ui_keybinds_y:SetVisible(false)

local get_theme = {
    [0] = function(x, y, w, col)
        Render.GradientBoxFilled(Vector2.new(x + w, y), Vector2.new(x + w / 2, y - 2), color123(255, 234, 0, col:a()), color123(255, 0, 238, col:a()), color123(255, 234, 0, col:a()), color123(255, 0, 238, col:a()))
        Render.GradientBoxFilled(Vector2.new(x, y), Vector2.new(x + w / 2, y - 2), color123(0, 200, 255, col:a()), color123(255, 0, 238, col:a()), color123(0, 200, 255, col:a()), color123(255, 0, 238, col:a()))
    end,

    [1] = function(x, y, w, col)
        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y - 2), col)
    end,

    [2] = function(x, y, w, col, col2)
        Render.GradientBoxFilled(Vector2.new(x + w, y), Vector2.new(x + w / 2, y - 2), color123(col:r(), col:g(), col:b(), col2), col, color123(col:r(), col:g(), col:b(), col2), col)
        Render.GradientBoxFilled(Vector2.new(x, y), Vector2.new(x + w / 2, y - 2), color123(col:r(), col:g(), col:b(), col2), col, color123(col:r(), col:g(), col:b(), col2), col)
    end
}

local function render_adaptive_box(type, x, y, name, alpha)
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(1) then
    local name_size = Render.CalcTextSize(name, font_size_keybinds, font_keybinds)
    local line = ui_line_color:GetColor()

    if type == "keybinds" then
        get_theme[ui_themes:GetInt()](x, y, 150, Color.new(line:r(), line:g(), line:b(), 255 * alpha), 10 * alpha)
        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + 150, y + 17), color123(20, 20, 20, 150 * alpha))
        Render.Text(name, Vector2.new(x + 150 / 2 - name_size.x / 2, y + 2), text_color_keybinds(alpha), font_size_keybinds, font_keybinds)
    end
end
end

local defines = {screen_size = EngineClient:GetScreenSize()}

local function lerp(start,end_pos,time,do_extraanim)
    if not do_extraanim then
        if math.ceil(start) == end_pos then return end_pos end
    end
    time = GlobalVars.frametime * (time * 175)
    if time < 0 then
      time = 0.01
    elseif time > 1 then
      time = 1
    end
    local delta = end_pos - start
    delta = delta * time
    delta = delta + start
    return delta
end
ffi.cdef[[
    typedef void* HWND;
    typedef const char* LPCSTR;
    short GetAsyncKeyState(int vKey);
    HWND GetForegroundWindow();
    HWND FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName);
]]
local foreground_hwnd = ffi.new("HWND")
local found_hwnd = ffi.new("HWND")
local function is_key_down(key_code)
    foreground_hwnd = ffi.C.GetForegroundWindow()
    found_hwnd = ffi.C.FindWindowA("Valve001", nil)
    if foreground_hwnd ~= nil and (found_hwnd == foreground_hwnd) then
        return ffi.C.GetAsyncKeyState(key_code) ~= 0
    end
    return false
end

local function color(r,g,b,a)
    if not a then a = 255 end
    if not b then b = 0 end
    return Color.new(r/255,g/255,b/255,a/255)
end
local x_sl = Menu.SliderInt("> Visuals", "keybinds", "x", 400, 1, defines.screen_size.x)
local y_sl = Menu.SliderInt("> Visuals", "keybinds", "y", 200, 1, defines.screen_size.y)
x_sl:SetVisible(false)
y_sl:SetVisible(false)
local draggables = {
    create_draggable = function(start_position_x, start_position_y, starting_size_x, starting_size_y, name, callback_fn)
    return {
        position_x = start_position_x,
        position_y = start_position_y,
        size_x = starting_size_x,
        size_y = starting_size_y,
        started_dragging = false,
        initial_drag_pos = Vector2.new(0, 0),
        drag_pos = Vector2.new(0, 0),
        callback_function = callback_fn,
        update = function(self)
        if Cheat.IsMenuVisible() then
                  local mouse_position = Cheat.GetMousePos()
                  local is_in_bounds = (mouse_position.x >= self.position_x and mouse_position.y >= self.position_y and mouse_position.x <= self.position_x + self.size_x and mouse_position.y <= self.position_y + self.size_y)
                  if (is_in_bounds or self.started_dragging) and is_key_down(1) and (defines.mouse_target == 0 or defines.mouse_target == name) then
                    defines.mouse_target = name
                      if not self.started_dragging then
                            
                          self.started_dragging = true
                          self.initial_drag_pos = Vector2.new(mouse_position.x - self.position_x, mouse_position.y - self.position_y)
                      else
                          self.position_x = mouse_position.x - self.initial_drag_pos.x
                          self.position_y = mouse_position.y - self.initial_drag_pos.y
                      end
                  elseif not is_key_down(1) then
                    defines.mouse_target = 0
                      self.started_dragging = false
                      self.initial_drag_pos = self.drag_pos
                  end
          end
        self.callback_function(self)
        end
    }
    end
}
local windows_text_size = 11
local menu_windows_element = Menu.FindVar("Miscellaneous", "Main", "Other", "Windows")
local fontik1 = Render.InitFont("Verdana", 11 , {'r'} )
local binds = {
    
}
local function get_active_binds()
    local cheatbinds = Cheat.GetBinds()
    local active = {}
    local is_any_active = false
    for i = 1, #cheatbinds do
        local bind = cheatbinds[i]

        local name = bind:GetName()
        if binds[name] == nil then
            binds[name] = {
                name = name,
                value = bind:GetValue(),
                alpha = 0
            }
            goto continue
        end
        if binds[name].value ~= bind:GetValue() then
            binds[name].value = bind:GetValue()
        end
        local is_active = bind:IsActive()
        binds[name].alpha = lerp(binds[name].alpha, is_active and 255 or 0, 0.095)
        if binds[name].alpha > 1 then
            local to_push_name = binds[name].name
            local to_push_value = binds[name].value
            if #to_push_name + #to_push_value > 28 then
                if #to_push_name>=#to_push_value then
                    to_push_name = string.sub(to_push_name, 1 , 14) .. "..."
                else
                    to_push_value = string.sub(to_push_value, 1 , 14) .. "..."
                end
            end
            table.insert(active, 1, {
                name = to_push_name,
                state = to_push_value,
                alpha = binds[name].alpha
            })
        end
        if is_active then
            is_any_active = true
        end
        ::continue::
    end
    return {active, is_any_active}
end

local function get_colors_aue()
    local selected = ui_themes:GetInt()
    if selected == 0 then return {color(0, 255, 255, 255), color(255, 0, 255, 255), color(255, 255, 0, 255)} end
    if selected == 1 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {col, col, col}
    end
    if selected == 2 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {Color.new(col.r, col.g, col.b, 0), col, Color.new(col.r, col.g, col.b, 0)}
    end
    if selected==3 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {col, col, col}
    end
end
local time = Panorama.LoadString([[
    return {
        get: () => {
            var now     = new Date();

            var hour    = now.getHours();
            var minute  = now.getMinutes();
            var second  = now.getSeconds();

            if(hour.toString().length == 1) {
                 hour = '0'+hour;
            }
            if(minute.toString().length == 1) {
                 minute = '0'+minute;
            }
            if(second.toString().length == 1) {
                 second = '0'+second;
            }   
            var dateTime = hour+':'+minute+':'+second;   

            return dateTime;
        },
        get_as_table: () => {
            var now     = new Date();

            var hour    = now.getHours();
            var minute  = now.getMinutes();
            var second  = now.getSeconds();

            if(hour.toString().length == 1) {
                 hour = '0'+hour;
            }
            if(minute.toString().length == 1) {
                 minute = '0'+minute;
            }
            if(second.toString().length == 1) {
                 second = '0'+second;
            }   
            var dateTime = hour+':'+minute+':'+second;   

            return {wHour: hour, wMinute: minute, wSecond: second};
        }
    }
]])()
local data = {alpha = 0, lerp = 0, width = 0}
local offset = Vector2.new(0,0)
local w = Vector2.new(0,0)
local keybinds_draggable = draggables.create_draggable(x_sl:GetInt(), y_sl:GetInt(), 0, 0, 2, function(self)
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(1) then
    menu_windows_element:SetBool(1, false)

    local size = Vector2.new(data.width, 17)
    self.size_x = size.x
    self.size_y = size.y
    local call = get_active_binds()
    local active_binds = call[1]
    if not active_binds or (call[2] == false and not Cheat.IsMenuVisible()) then
        data.lerp = 0
    else
        data.lerp = 255
    end
    local start = Vector2.new(self.position_x, self.position_y)
    
    local animated = ui_themes:GetInt()==3
    
    if not animated then
        offset = Vector2.new(size.x / 2, 2)
    else
        offset = Vector2.new(size.x / 2, 2)
    end

    local colors = get_colors_aue()
    colors = {Color.new(colors[1].r, colors[1].g, colors[1].b, (data.alpha / 255) * colors[1].a ), Color.new(colors[2].r, colors[2].g, colors[2].b, (data.alpha / 255) * colors[2].a ),
    Color.new(colors[3].r, colors[3].g, colors[3].b,  (data.alpha / 255) * colors[3].a )}
    local max_width = 0
    local y_offset = 0
    for i = 1, #active_binds do
        local bind = active_binds[i]
        if bind_state_ui:Get()==0 then
        if bind.state == "on" then
            bind.state = "[on]"
        else
            bind.state = "["..bind.state.."]"
        end
    end
    if bind_state_ui:Get()==1 then
        if bind.state == "on" then
            bind.state = "[toggled]"
        else
            bind.state = "[toggled]"
        end
    end
    if bind_state_ui:Get()==2 then
        if bind.state == "on" then
            bind.state = "[toggled]"
        else
            bind.state = "["..bind.state.."]"
        end
    end
        local text_size = Render.CalcTextSize(bind.state, windows_text_size, fontik1)
        local text_size_bind_name = Render.CalcTextSize(bind.name, windows_text_size, fontik1)
        local off = start.y + (y_offset * 18) + 20 -- helpers:r()ound(18 * bind:a()lpha/255)
        Render.Text(bind.name, Vector2.new(start.x, off), Color.new(1.0, 1.0, 1.0, bind.alpha / 255), windows_text_size, fontik1, false)
        Render.Text(bind.state, Vector2.new(start.x + (size.x - text_size.x), off), Color.new(1.0, 1.0, 1.0, bind.alpha / 255), windows_text_size, fontik1, false)
        local bind_width = text_size_bind_name.x + text_size.x + 10
        if bind_width > 120 then
            if bind_width > max_width then
                max_width = bind_width
            end
        end
        y_offset = y_offset + bind.alpha/255
    end


    data.width = lerp(data.width, max_width, 0.095)
    data.width = math.max(120, data.width)

    local dt_color = colors[1]
    local dt_color2 = Color.new(dt_color.r , dt_color.g , dt_color.b , math.sin(math.rad(GlobalVars.tickcount % 360) *2) * (data.alpha/255) )

    if blur_background:Get() then
        Render.Blur(start + size, start, Color.new(1,1,1,  animated and   data.alpha/255 or data.alpha/255 ))
    else
    Render.BoxFilled(start + size, start, Color.new(17/255,17/255,17/255,  animated and   data.alpha*0.3/255 or data.alpha * ui_line_color:GetColor().a/255 ))
    end


    if not animated then
        w.y = offset.y
        w.x =  offset.x
        Render.GradientBoxFilled(start, start + w, colors[1], colors[2], colors[1], colors[2])
        Render.GradientBoxFilled(start + offset, start + offset + Vector2.new(w.x, -offset.y), colors[2], colors[3], colors[2], colors[3])
    else
        w.y = offset.y
        w.x =   lerp(w.x,offset.x* (data.alpha/255) , 0.075)
        Render.GradientBoxFilled(start + Vector2.new(offset.x - w.x , 0), start + Vector2.new(offset.x , 1) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(offset.x , 0), start + Vector2.new(offset.x + w.x , 1) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start+ Vector2.new(-1,17), start + Vector2.new(w.x+1 , 18) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start + Vector2.new(offset.x*2-w.x , 0)+ Vector2.new(-1,17), start + Vector2.new(offset.x*2 , 18) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(0,17-17 * data.alpha/255), start + Vector2.new(-1 , 17) , dt_color2 , dt_color2 , dt_color , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(offset.x*2 - 1 ,17 - 17 * data.alpha/255 ), start + Vector2.new(0 , 17 ) + Vector2.new(offset.x*2 ,0 ), dt_color2 , dt_color2 , dt_color , dt_color )
    end

    Render.Text("keybinds", Vector2.new(start.x + size.x / 2 - Render.CalcTextSize("keybinds", windows_text_size, fontik1).x / 2, start.y + 3), Color.new(1.0, 1.0, 1.0, data.alpha/255), windows_text_size, fontik1, false)
    data.alpha = lerp(data.alpha, data.lerp, 0.095)
end
end)


local watermark = function()
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(2) then
    menu_windows_element:SetBool(3, false)
    local name = custom_name_switch:Get() and custom_name_text:Get() or Cheat.GetCheatUserName()
    local time = time:get()
    local cheat_name = cheat_name:Get() == 0 and "Melonity" or "Neverlose.cc"
    local ping = "0"
    local GetNetChannelInfo = EngineClient.GetNetChannelInfo()
    if GetNetChannelInfo then
        ping = math.floor(GetNetChannelInfo:GetLatency(0) * 1000)
    end
    local fps = math.floor(1/GlobalVars.frametime)
    local colors = get_colors_aue()
    colors = {Color.new(colors[1].r, colors[1].g, colors[1].b,  colors[1].a ), Color.new(colors[2].r, colors[2].g, colors[2].b, colors[2].a),
    Color.new(colors[3].r, colors[3].g, colors[3].b,  colors[3].a)}
    local text = cheat_name .. " | "..name.." | ping: "..ping.." ms | tick: "..(1/GlobalVars.interval_per_tick).." | "..time

    local ts = Render.CalcTextSize(text, 11, fontik1)
    local ss = EngineClient.GetScreenSize()
    local start_pos = Vector2.new(ss.x - 8 , 8)
    ts.x = ts.x + 6

    local offset = Vector2.new(-ts.x/2 ,2)

    local animated = ui_themes:GetInt() == 3


    if blur_background:Get() then
        Render.Blur(start_pos, start_pos - Vector2.new(ts.x , -17))
    else
        Render.BoxFilled(start_pos , start_pos - Vector2.new(ts.x , -17) , Color.new(0.07 , 0.07 , 0.07 , animated and 0.2 or ui_line_color:GetColor().a  ))
    end
    local dt_color = colors[1]
    local dt_color2 = Color.new(dt_color.r , dt_color.g , dt_color.b , math.sin(math.rad(GlobalVars.tickcount % 360)*2) )
    
    if not animated then
        Render.GradientBoxFilled(start_pos, start_pos + offset, colors[1], colors[2], colors[1], colors[2])
        Render.GradientBoxFilled(start_pos + offset, start_pos + offset + Vector2.new(offset.x, -offset.y), colors[2], colors[3], colors[2], colors[3])
    else
        Render.GradientBoxFilled(start_pos, start_pos + Vector2.new(offset.x , 1) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x , 0), start_pos + Vector2.new(2*offset.x , 1) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start_pos+ Vector2.new(0,17), start_pos + Vector2.new(offset.x , 18) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x , 0)+ Vector2.new(0,17), start_pos + Vector2.new(2*offset.x , 18) , dt_color2 , dt_color , dt_color2 , dt_color )

        Render.GradientBoxFilled(start_pos, start_pos + Vector2.new(-1 , 17) , dt_color2 , dt_color2 , dt_color , dt_color )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x*2 ,0 ), start_pos + Vector2.new(1 , 17) + Vector2.new(offset.x*2 ,0 ), dt_color2 , dt_color2 , dt_color , dt_color )

    end
    
    Render.Text(text , start_pos + offset*2 - Vector2.new(-3 , 1) , Color.new(1,1,1,1) , 11 , fontik1 , false , false)

end
end

enable_min_damage_indicator = Menu.Switch("> Visuals", "Other", "[-] Enable Min.Damage Indicator", false)
local min_damage_indicator_pos = Menu.Combo("> Visuals", "Other", "Indicator Position", {"Right Up", "Left Up", "Centre Up"}, 0, "")

local dmg_indicator_font = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)

local damage_screen = EngineClient.GetScreenSize()
local vecPositions = {
    [0] = Vector2.new(damage_screen.x/2 + 10, damage_screen.y/2 - 30),
    [1] = Vector2.new(damage_screen.x/2 - 15, damage_screen.y/2 - 30),
    [2] = Vector2.new(damage_screen.x/2 - 2, damage_screen.y/2 - 30)
}

local function damage_indicator_dmg()
    local player1234 = EntityList.GetLocalPlayer();   
    if not player1234 then return end   
    local lifeState1234 = player1234:GetProp("m_lifeState");
    if not lifeState1234 then
    if enable_min_damage_indicator:Get() then
    Render.Text(tostring(Menu.FindVar("Aimbot", "Ragebot", "Accuracy", "Minimum Damage"):GetInt()) , vecPositions[min_damage_indicator_pos:GetInt()], Color.new(1.0, 1.0, 1.0, 1.0), 10, dmg_indicator_font, true)
end
end
end

enable_logs = Menu.Switch("> Misc", "Main", "[-] Enable Logs", false)
type2_of_logs = Menu.Combo("> Misc", "Main", "Select type of logs", {"Console", "Under Crosshair", "Notify"}, 0)
type3_of_logs = Menu.MultiCombo("> Misc", "Main", "Select Under Logs", {"Hit", "Miss", "Dormant Aimbot", "Chat"}, 0)
type_of_logs = Menu.MultiCombo("> Misc", "Main", "Select logs", {"Hit", "Miss", "Anti-Brute", "Purchases", "Chat"}, 0)

local menu_windows_element_logs = Menu.FindVar("Miscellaneous", "Main", "Other", "Event Log")

ffi.cdef[[
    typedef unsigned char BYTE;
    typedef void *PVOID;
    typedef PVOID HMODULE;
    typedef const char *LPCSTR;
    typedef int *FARPROC;
    
    HMODULE GetModuleHandleA(
        LPCSTR lpModuleName
    );
    
    FARPROC GetProcAddress(
        HMODULE hModule,
        LPCSTR  lpProcName
    );
    
    typedef struct{
        BYTE r, g, b, a;
    } Color;
    
    typedef void(__cdecl *ColorMsgFn)(Color&, const char*);
]]

local engine_client = Utils.CreateInterface("vstdlib.dll", "VEngineCvar007") or error("(")
local engine_client_class = ffi.cast(ffi.typeof("void***"), engine_client) or error("(")
local console_print_color_cast = ffi.cast("void(__cdecl*)(void*, void*, const char*)", engine_client_class[0][25]) or error("(")
local ConsolePrint = function(label, r, g, b, a)


    local color_struct = ffi.new("Color")

    color_struct.r = r
    color_struct.g = g
    color_struct.b = b
    color_struct.a = 255

    return console_print_color_cast(engine_client_class , color_struct, tostring(label))
end

local log = {
}
local console = Render.InitFont("lucida console", 10, {"r"})
local hitboxes = {
    [0] = "generic",
    [1] = "head",
    [2] = "chest",
    [3] = "stomach",
    [4] = "left arm",
    [5] = "right arm",
    [6] = "left leg",
    [7] = "right leg",
    [10] = "gear",
}
local reasons = {
    "resolver",
    "spread",
    "occlusion",
    "prediction error",
}

local drawlog = function(prefix, prefix_r, prefix_g, prefix_b, prefix_a, text, print_text)
    log[#log + 1] = {
        text,
        255,
        math.floor(GlobalVars.curtime),
    }
    ConsolePrint(prefix, prefix_r, prefix_g, prefix_b, prefix_a)
    print(print_text)
end
local wpn_list = {
    ["molotov"] = 1,
    ["inferno"] = 1,
    ["knife"] = 1,
    ["hegrenade"] =1,
    ["taser"] = 1,
    ["smokegrenade"] = 1,
    ["decoy"] = 1,
    ["flashbang"] =1,
}

local last_switch_tick = 0
local closest_point_on_ray = function(ray_from, ray_to, desired_point)
    local to = desired_point - ray_from
    local direction = ray_to - ray_from
    local ray_length = direction:Length()

    direction.x = direction.x / ray_length
    direction.y = direction.y / ray_length
    direction.z = direction.z / ray_length

    local direction_along = direction.x * to.x + direction.y * to.y + direction.z * to.z
    if direction_along < 0 then
        return ray_from
    end
    if direction_along > ray_length then
        return ray_to
    end

    return Vector.new(ray_from.x + direction.x * direction_along, ray_from.y + direction.y * direction_along,
        ray_from.z + direction.z * direction_along)
end

local screen_center = EngineClient.GetScreenSize()/2
local font_logs = Render.InitFont("Verdana" , 12)
local logs = {
    data = {},

    add = function(self, should_render , ... )
        if should_render then
            self.data[#self.data+1] = {text = (...) ,  a= 0 ,t = GlobalVars.curtime}
        end
    end,

    render = function(self)
        local adding = 0
        local off = indicators_list:Get()==2 and 30 or 0
        for idx , log_data in ipairs(self.data) do
            if GlobalVars.curtime - log_data.t > 3.5 or (#self.data>10 and idx < #self.data-10)  then
                log_data.a = lerp(log_data.a , 0 , 0.095 , 0.01)
            else
                log_data.a = lerp(log_data.a , 1 , 0.095 , 0.01)
            end

            adding = adding + 13*log_data.a
            if enable_logs:GetBool() and type2_of_logs:Get()==1 then
            if log_data.a >0.01 then
                Render.Text(log_data.text , Vector2.new(screen_center.x , screen_center.y  + 61 + off + math.abs(adding) ) + 1 , Color.new(0,0,0,log_data.a) , 12, font_logs , false , true )
                Render.Text(log_data.text , Vector2.new(screen_center.x ,screen_center.y  + 61+off + math.abs(adding) ) , Color.new(1,1,1,log_data.a) , 12, font_logs , false , true )
            end

            ::c::
        end
    end
    end
}

handlers:subscribe("events" , function(e)

    if e:GetName() == "player_connect_full" or e:GetName() == "cs_game_disconnected" then logs.data = {} log = {} end
end )

handlers:subscribe("draw" , function ()
    logs:render()
end)



handlers:subscribe("events", function(event)
    local localplayer = EntityList.GetLocalPlayer()
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
     if event:GetName() == "item_purchase" then
        if not enable_logs:GetBool() then return end
        if event:GetName() ~= "item_purchase" then
            return
        end
        local buyerid = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        local item = event:GetString("weapon")
        if buyerid ~= localplayer and item ~= "weapon_unknown" and buyerid ~= nil then
            local buyer = buyerid:GetName()
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(4) then
            drawlog("[Melonity] ", 185, 129, 235, 255, string.format("%s bought %s", buyer, item), string.format("%s bought %s\r", buyer, item))
            end
        end
    end
    if event:GetName() == "player_hurt" then
        if not enable_logs:GetBool() then return end
        local target_player = EntityList.GetPlayerForUserID(event:GetInt("userid", 0))
        if not target_player then return end
    
        local attacker_player = EntityList.GetPlayerForUserID(event:GetInt("attacker", 0))
        if not attacker_player then return end
        local wpn = event:GetString("weapon")
        local pName = attacker_player:GetName()
        local pName2 = target_player:GetName()
        local dmg = event:GetInt("dmg_health")
        local hbox = hitboxes[event:GetInt("hitgroup")+1]
        local rem = event:GetInt("health")
        if target_player~=EntityList.GetLocalPlayer() and attacker_player==EntityList.GetLocalPlayer() then
            local prefix = "Hit"   
    
            if wpn=="hegrenade"  then prefix = "Naded" end
            if wpn=="taser" then prefix = "Zeused" end
            if wpn=="inferno" then prefix = "Burned" end
            if wpn=="knife" then prefix = "Knifed" end
            
            if wpn_list[wpn] then
                local str = prefix .." "..pName2.." for "..dmg .. " damage (" ..rem .. " health remaining)"
                local col = Color.new(0.65 , 0.85 , 0.15 , 1)
                local white = Color.new(1,1,1,1)
                if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) then
                drawlog("[Melonity] ", 185, 129, 235, 255, str,str)
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) then
                logs:add(true , str)
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                    logs[#logs+1] = {(prefix .." "..pName2.." for "..dmg .. " damage (" ..rem .. " health remaining)"), GlobalVars.tickcount + 150, 0}
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) and type_of_logs:Get(5) then
                    PrintInChat(" \x08"..prefix.." \x03"..pName2.."\x08 for \x07"..dmg.."\x08 damage (\x10"..rem.."\x08 health remaining)")
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) and type3_of_logs:Get(4) then
                    PrintInChat(" \x08"..prefix.." \x03"..pName2.."\x08 for \x07"..dmg.."\x08 damage (\x10"..rem.."\x08 health remaining)")
                end
        end
        end
    end

    if event:GetName() == "bullet_impact" then
        if not menu_elements.switch:Get() then
            return
        end



        local lp = EntityList.GetLocalPlayer()
        if not lp or not lp:IsAlive() then
            return
        end
        if not event:GetInt("userid") then
            return
        end
        local entity = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        if not entity then
            return
        end

        if entity == lp then
            return
        end
        local player = entity
        if not player then
            return
        end
        if player:IsTeamMate() then
            return
        end

        local bullet_impact = Vector.new(event:GetFloat("x"), event:GetFloat("y"), event:GetFloat("z"))
        local eye_pos = player:GetEyePosition()
        if not eye_pos then
            return
        end
        local local_player = lp
        if not local_player then
            return
        end
        local local_eye_pos = local_player:GetEyePosition()
        if not local_eye_pos then
            return
        end

        local distance_between = closest_point_on_ray(eye_pos, bullet_impact, local_eye_pos):DistTo(local_eye_pos)
        if distance_between < 50 and GlobalVars.tickcount ~= last_switch_tick then
            anti_brute.timer = 3
            anti_brute.working = true
            anti_brute.cur_phase = anti_brute.cur_phase >= anti_brute.num_phases:Get()-1 and 0 or anti_brute.cur_phase + 1
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(3) then
            local swiched_due_antibrute = "Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"
            local swiched_due_antibrute2 = "Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"
            drawlog("[Anti-Bruteforce] ", 226, 39, 24, 255, swiched_due_antibrute2,swiched_due_antibrute)
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                logs[#logs+1] = {("Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"), GlobalVars.tickcount + 150, 0}
            end
            last_switch_tick = GlobalVars.tickcount
        end
    end
    if event:GetName()=="round_start" then anti_brute.timer  = 0 anti_brute.working = false  end

end)


local abrute_pred = function()

    if not anti_brute.working then return end



    if (not anti_brute.working) or #anti_brute.phases==0  then return end
    if not menu_elements.switch:Get() then return end
    
    anti_brute.timer = anti_brute.timer - GlobalVars.interval_per_tick

    if anti_brute.timer < 0 then anti_brute.timer = 0 end
    

    if anti_brute.timer == 0 and (anti_brute.working )  then anti_brute.working= false  end




    --print(globals.abrute_phases , globals.abrute_phase , #ui.aa.phases)

    if anti_brute.phases[anti_brute.cur_phase +1] and anti_brute.working then
        AntiAim.OverrideInverter( anti_brute.phases[anti_brute.cur_phase +1]:Get() < 0)
        AntiAim.OverrideLimit(math.abs( anti_brute.phases[anti_brute.cur_phase +1]:Get()))
    end

end


verdana_logs = Render.InitFont("Verdana", 11, {'r'})
function logs_notify()
    local player = EntityList.GetLocalPlayer();
    if not player then return end
    
    local lifeState = player:GetProp("m_lifeState");
    if not lifeState then
 local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
 if lp == nil then return end
local x = EngineClient.GetScreenSize().x
local y = EngineClient.GetScreenSize().y
    if #logs > 0 then
    if GlobalVars.tickcount >= logs[1][2] then
        if logs[1][3] > 0 then
            logs[1][3] = logs[1][3] - 2
        elseif logs[1][3] <= 0 then
            table.remove(logs, 1)
        end
    end
    if #logs > 5 then
        table.remove(logs, 1)
    end
    for i = 1, #logs do
        ts = Render.CalcTextSize(logs[i][1], 11, verdana_logs)
        if logs[i][3] < 255 then logs[i][3] = logs[i][3] + 1 end
        if not enable_logs:Get() and not type2_of_logs:Get()==2 then return end
        Render.Blur(Vector2.new(math.min(50, logs[i][3]*2)-60 + x/2-ts.x/2, y-256+34*i), Vector2.new(math.min(50, logs[i][3]*2)-40 + x/2+ts.x/2, y-242+34*i+ts.y), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 100)
        Render.BoxFilled(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-256+34*i), Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2+math.min(ts.x, logs[i][3]*7), y-254+34*i), Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)))
        Render.BoxFilled(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2-math.min(ts.x, logs[i][3]*7), y-241+ts.y+34*i), Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2, y-243+ts.y+34*i), Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)))
        Render.Circle(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-243+34*i), 12, 32, Color.RGBA(185, 129, 235, math.min(255, logs[i][3]*5)), 2, 270-math.min(180, logs[i][3]*3), 270)
        Render.Circle(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2, y-243+34*i), 12, 32, Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)), 2.5, 90, 90-math.min(180, logs[i][3]*3))
        Render.Text(logs[i][1], Vector2.new(math.min(50, logs[i][3]*2)-49 + x/2-ts.x/2, y-249+34*i), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text(logs[i][1], Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-250+34*i), Color.RGBA(255,255,255, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text("", Vector2.new(math.min(50, logs[i][3]*2)-49 + x/2-ts.x/2, y-249+34*i), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text("", Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-250+34*i), Color.RGBA(185, 129, 235, math.min(255, logs[i][3]*5)), 11, verdana_logs)
    end
end
end
end


ffi = require("ffi")

ffi.cdef[[
    void* GetProcAddress(void* hModule, const char* lpProcName);
    void* GetModuleHandleA(const char* lpModuleName);
    
    typedef struct {
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    } color_struct_t;

    typedef void (*console_color_print)(const color_struct_t&, const char*, ...);

    typedef void* (__thiscall* get_client_entity_t)(void*, int);
]]

FindElement = ffi.cast("unsigned long(__thiscall*)(void*, const char*)", Utils.PatternScan("client.dll", "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28"))
CHudChat = FindElement(ffi.cast("unsigned long**", ffi.cast("uintptr_t", Utils.PatternScan("client.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08")) + 1)[0], "CHudChat")
FFI_ChatPrint = ffi.cast("void(__cdecl*)(int, int, int, const char*, ...)", ffi.cast("void***", CHudChat)[0][27])


function PrintInChat(text)
    FFI_ChatPrint(CHudChat, 0, 0, string.format("%s ", text))
end


handlers:subscribe("registered_shot", function(reg)
    if not enable_logs:GetBool() then return end
    local person = EntityList.GetClientEntity(reg.target_index)
    local missreason = reasons[reg.reason]
    local dmg = reg.damage
    local wdmg = reg.wanted_damage
    local hbox = hitboxes[reg.hitgroup] or "unknown"
    local whbox = hitboxes[reg.wanted_hitgroup]
    local safety = refs.baim:Get()
    local hc , bt = reg.hitchance , reg.backtrack
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
    cur_shot = cur_shot+1


    local pEnt = EntityList.GetPlayer(reg.target_index)
    
    if not pEnt then return end

    local hp = pEnt:GetProp("m_iHealth") - dmg < 0 and pEnt:GetProp("m_iHealth") or pEnt:GetProp("m_iHealth") - dmg
 
    local pweap = EntityList.GetLocalPlayer():GetActiveWeapon()

    if not pweap then return end
    

    if reg.reason ~=0 then
        if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(2) then
        local text_to_print = "["..cur_shot.."] Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"
        local text_to_print2 = "["..cur_shot.."] Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"
        drawlog("[Melonity] ", 185, 129, 235, 255, text_to_print2,text_to_print)
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(2) then
        logs:add(true , "Missed "..pEnt:GetName().." due to "..missreason )
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(2) and type3_of_logs:Get(4) then
        PrintInChat(" \x08Missed \x03"..pEnt:GetName().."\x08 due to \x07"..missreason.."\x08")
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==2 then
            logs[#logs+1] = {("Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"), GlobalVars.tickcount + 150, 0}
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(2) and type_of_logs:Get(5)  then
            PrintInChat(" \x08[\x06"..cur_shot.."\x08] Missed "..pEnt:GetName().."'s in \x10"..whbox.."\x08 ("..wdmg..")".."("..hc.."%%) due to \x07"..missreason.."\x08 [ history(Δ): \x10"..bt.."\x08 | angle: \x09".. math.floor(reg.spread_degree*100)/100 .."\x08° ]")
        end
    else
        if pweap:GetClassID()~=268 then
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) then
            local text_to_print =  "["..cur_shot.."] Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | hc: "..hc .. "%% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")
            local text_to_print2 =  "["..cur_shot.."] Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | hc: "..hc .. "% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")
            drawlog("[Melonity] ", 185, 129, 235, 255, text_to_print2, text_to_print)
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) then
            logs:add( true, "Hit "..pEnt:GetName().." in the "..hbox.." for " ..dmg .." damage (".. (hp==0 and "killed)" or hp.." remaining)" ) )
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) and type3_of_logs:Get(4) then
            PrintInChat(" \x08Hit "..pEnt:GetName().." in the \x10"..hbox.."\x08 for \x07"..dmg.."\x08 damage (\x07"..(hp==0 and "\x08\x07killed\x08)" or hp.."\x08 remaining)"))
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                logs[#logs+1] = {("Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | | hc: "..hc .. "% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")), GlobalVars.tickcount + 150, 0}
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) and type_of_logs:Get(5) then
                PrintInChat(" \x08[\x06"..cur_shot.."\x08] Hit "..pEnt:GetName() .. " in \x10"..hbox.. (whbox==hbox and "" or " \x08(aimed = \x0C"..whbox.."\x08)").."\x08 for \x07"..dmg.. (wdmg==dmg and "" or "\x08(\x10"..wdmg.."\x08)\x08").."\x08 damage [ history(Δ): \x10"..bt.."\x08 | hc: "..hc .. "%% | safety: "..safety.." | health : \x07"..(hp==0 and "\x08*\x07killed\x08* ]" or hp .. " \x08remaining ]"))
            end
        end
    end
end)
local clearlog = function()
    if #log ~= 0 then
        if EngineClient:IsConnected() == false then
            table.remove(log, #log)
        end
        if #log > 6 then
            table.remove(log, 1)
        end
        for i = 1, #log do
            if log[i] == nil then
                return
            end
            if log[i][3] + 4 > math.floor(GlobalVars.curtime) then
                return
            end
            log[i][2] = log[i][2]- math.floor(GlobalVars.frametime * 300)
    
            if log[i][2] < 0 then
                table.remove(log, i)
            end
        end
    end
end
local drawlog = function()
    clearlog()
    if not enable_logs:GetBool() then return end
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
    for i = 1, #log do
        Render.Text(""..log[i][1].."", Vector2.new(7 + 1, 5 + i * 12 + 1 - 12), Color.RGBA(0, 0, 0, log[i][2]), 10, console)
        Render.Text(""..log[i][1].."", Vector2.new(7, 5 + i * 12 - 12), Color.RGBA(255, 255, 255, log[i][2]), 10, console)
    end
end

quick_peek = Menu.Switch("> Misc", "Main", "[-] Quick Peek", false)

function setmovement(xz,yz,cmd)
    local local_player = EntityList.GetLocalPlayer()
    local_player = local_player:GetPlayer()
    local current_pos = local_player:GetProp("m_vecOrigin")
    local yaw = EngineClient:GetViewAngles().yaw
    local vector_forward = {
        x = current_pos.x - xz,
        y = current_pos.y - yz,
    }   
    local velocity = {
        x = -(vector_forward.x * math.cos(yaw / 180 * math.pi) + vector_forward.y * math.sin(yaw / 180 * math.pi)),
        y = vector_forward.y * math.cos(yaw / 180 * math.pi) - vector_forward.x * math.sin(yaw / 180 * math.pi),
    }
    cmd.forwardmove = velocity.x * 15
    cmd.sidemove = velocity.y * 15
end

function quickpeek_lua(cmd)
  
    local localplayer = EntityList.GetLocalPlayer()
    local forw = bit.band(cmd.buttons, 8) == 8
    local back = bit.band(cmd.buttons, 16) == 16
    local righ = bit.band(cmd.buttons, 512) == 512
    local left = bit.band(cmd.buttons, 1024) == 1024
  
    local apeek = Menu.FindVar("Miscellaneous", "Main", "Movement", "Auto Peek"):Get()
    local originalpos = localplayer:GetProp("m_vecOrigin")
    local OnGround = bit.band(localplayer:GetProp("m_hGroundEntity"), 1);
  
    if OnGround == 1 then
        air = true
    else
        air = false
    end
    if apeek == false then
        curpos = localplayer:GetProp("m_vecOrigin");
    end
    if quick_peek:Get() == true then
        if apeek == true then
            if forw == false and back == false and left == false and righ == false and curpos.x ~= originalpos.x and curpos.y ~= originalpos.y and air == false then
                setmovement(curpos.x,curpos.y, cmd);
            end
        end
    end
end

local function get_local_player()
    if not EngineClient:IsConnected() then return end
    local local_client = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
    local local_player = local_client:GetPlayer()
 
    return local_player
  end

local Infinity_X_DT = Menu.SliderInt("> Visuals", "Visuals", "X_DT", 350, 350, 5120)
local Infinity_Y_DT = Menu.SliderInt("> Visuals", "Visuals", "Y_DT", 350, 350, 5120)

Infinity_X_DT:SetVisible(false)
Infinity_Y_DT:SetVisible(false)

local dt_type = "Default"
local TICKBASE = refs.dt:GetBool() and 14 or 7

local FONT_VERDANA_12 = Render.InitFont("Arial", 11)
local FONT_BULLET = Render.InitFont("nl\\Melonity Solutions\\fonts\\bullet.ttf", 24)
local windows_text_size123 = 11

local non_dt_weapons =
{
    "CKnife",
    "CHEGrenade",
    "CMolotovGrenade",
    "CIncendiaryGrenade",
    "CFlashbang",
    "CDecoyGrenade",
    "CSmokeGrenade",
    "CWeaponTaser",
    "CC4"
}

local one_bullet_weapons = {
  "CWeaponSSG08",
  "CWeaponAWP",
  "CWeaponScout",
  "CWeaponAWP",
}

local dt_alpha = 1


local ticks_to_time = function(t) return t*GlobalVars.interval_per_tick  end

function intersect(x, y, w, h)
  local c = Cheat.GetMousePos()

  return c.x >= x and c.x <= x + w and c.y >= y and c.y <= y + h
end

local dragging = false

local dt_pos_x, dt_pos_y = Infinity_X_DT:GetInt(), Infinity_Y_DT:GetInt()
local dt_drag_pos_y, dt_drag_pos_x = 0, 0
local tickbase_w = 0
local tickbase_h = 0
local fire_alpha = 0
local bullet_alpha = 0
local function render_dt_indicator()
if not tickbase_enable:Get() or not keybinds_123:Get() then return end
  local local_player = get_local_player()
  TICKBASE = refs.dt:GetBool() and 14 or 7
  if not EngineClient:IsConnected() or local_player:GetProp("m_iHealth") <= 0 then
    return
  end

  if tickbase_enable:Get() and keybinds_123:Get() then
    local charge = Exploits.GetCharge()
    local charged_ticks = math.abs(math.floor((charge * TICKBASE) + 0.5))

    local screen_size = EngineClient:GetScreenSize()
    local padding, margin = 4.0, 18.0
    local dt_accent = tickbase_indicator_color:GetColor()

    local text = "DT [v1.0 release] | tickbase: " .. charged_ticks
    local text_size = Render.CalcTextSize(text, 11, FONT_VERDANA_12)

    local weapon = local_player:GetActiveWeapon()

    if not weapon then return end

    local weapon_idx = weapon:GetProp("m_iItemDefinitionIndex")
    local weapon_name = weapon:GetClassName()
    local icon_size = Render.CalcWeaponIconSize(weapon_idx, 16)

    local mouse_pos = Cheat.GetMousePos()
    local left_click = Cheat.IsKeyDown(0x01)

    if Cheat.IsMenuVisible() then
      if dragging and not left_click then
        dragging = false
      end

      if dragging and left_click then
        dt_pos_x = mouse_pos.x - dt_drag_pos_x
        dt_pos_y = mouse_pos.y - dt_drag_pos_y
      end

      if intersect(dt_pos_x, dt_pos_y, text_size.x - margin,  (margin - padding + text_size.y + padding * 2)) and left_click then
        dragging = true
        dt_drag_pos_x = mouse_pos.x - dt_pos_x
        dt_drag_pos_y = mouse_pos.y - dt_pos_y
      end
    end

    Infinity_X_DT:SetInt(dt_pos_x)
    Infinity_Y_DT:SetInt(dt_pos_y)

    local lp = EntityList.GetLocalPlayer()
        

    local can_fire  =  GlobalVars.curtime - weapon:GetProp("m_flNextPrimaryAttack") > -0.05

    

    local trying_to_charge = refs.dt:GetBool() or refs.hs:GetBool()

    if not trying_to_charge  then
      dt_alpha = dt_alpha - 3 * GlobalVars.frametime
      dt_alpha = clamp(dt_alpha, 0, 1)
    else
      dt_alpha = dt_alpha + 3 * GlobalVars.frametime
      dt_alpha = clamp(dt_alpha, 0, 1)
    end
    

    if not can_fire then
        fire_alpha = fire_alpha - 3*GlobalVars.frametime
        fire_alpha = clamp(fire_alpha, 0, 1)
    else

        fire_alpha = fire_alpha + 3*GlobalVars.frametime
        fire_alpha = clamp(fire_alpha, 0, 1)
    end
    

    local dt_color = Color.new(dt_accent.r, dt_accent.g, dt_accent.b, (1.0 * dt_alpha))

    local bullets = ""

    local bool_wpn = true
    local bool_one_bullet = false


    for i = 1, #non_dt_weapons do
      if weapon_name == non_dt_weapons[i] then
        bool_wpn = false
      end
    end
    for i = 1, #one_bullet_weapons do
      if weapon_name == one_bullet_weapons[i] then
        bool_one_bullet = true
      end
    end

    if charge > 0.95 then
      bullets = "AA"
    elseif charge < 0.95 then
      bullets = ""
    end

    if bool_wpn == false then
      bullets = ""
    end

    if bool_one_bullet == true then
      bullets = "A"
    end


    local tickbase_color = Color.new(tickbase_indicator_color:GetColor().r, tickbase_indicator_color:GetColor().g, tickbase_indicator_color:GetColor().b, dt_alpha)
    dt_color = (refs.hs:GetBool() and not refs.dt:Get() ) and Color.new(0.2 ,1, 0.2 , dt_alpha) or dt_color
    local dt_color2 = Color.new(tickbase_color.r , tickbase_color.g , tickbase_color.b , math.sin(math.rad(GlobalVars.tickcount % 360)*2) )
    local wsss = (text_size.x + padding * 2)/2
    tickbase_w = helpers.lerp(tickbase_w , (text_size.x + padding * 2)*charge , 0.095 )
    tickbase_h = helpers.lerp(tickbase_h , (margin+3)*charge , 0.095 )
    


    Render.GradientBoxFilled(Vector2.new(dt_pos_x, dt_pos_y+margin+2), Vector2.new(dt_pos_x-1 , dt_pos_y-tickbase_h+margin+2 ), tickbase_color , tickbase_color , dt_color2 , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+wsss*2, dt_pos_y+margin+2), Vector2.new(dt_pos_x+1+wsss*2 , dt_pos_y-tickbase_h+margin+2 ), tickbase_color , tickbase_color , dt_color2 , dt_color2)
    Render.BoxFilled(Vector2.new(dt_pos_x, dt_pos_y), Vector2.new(dt_pos_x + text_size.x + padding * 2, dt_pos_y + text_size.y + padding * 2), Color.new(0, 0, 0, 0.2 * dt_alpha))
    Render.GradientBoxFilled(Vector2.new(dt_pos_x, dt_pos_y+margin+2), Vector2.new(dt_pos_x + tickbase_w/2 , dt_pos_y +1+margin), tickbase_color , dt_color2 , tickbase_color , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+text_size.x + padding * 2-tickbase_w/2, dt_pos_y+margin+2), Vector2.new(dt_pos_x + text_size.x + padding * 2 , dt_pos_y +1+margin), dt_color2 , tickbase_color , dt_color2 , tickbase_color)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+wsss, dt_pos_y), Vector2.new(dt_pos_x+wsss-tickbase_w/2 , dt_pos_y - 1), tickbase_color , dt_color2 , tickbase_color , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+ wsss, dt_pos_y), Vector2.new(dt_pos_x+wsss +tickbase_w/2 , dt_pos_y - 1), tickbase_color , dt_color2 , tickbase_color , dt_color2)

    Render.WeaponIcon(weapon_idx, Vector2.new(dt_pos_x, dt_pos_y + 24), Color.new(1.0, 1.0, 1.0, (1.0 * dt_alpha)), 16)
    Render.Text(text, Vector2.new(dt_pos_x + padding, dt_pos_y + padding), Color.new(0.95, 0.95, 0.95, (1.0 * dt_alpha)), windows_text_size123, FONT_VERDANA_12, false)
    if bool_wpn and fire_alpha>0  then
        Render.Text("A", Vector2.new(dt_pos_x + padding + icon_size.x * 1.1, dt_pos_y + 19), Color.new(1.0, 1.0, 1.0, fire_alpha * dt_alpha) , 24, FONT_BULLET, false)
    end
    if not bool_one_bullet and charge>0.55 and bool_wpn and not refs.hs:GetBool() and refs.dt:Get()  then
        Render.Text("A", Vector2.new(dt_pos_x + padding + icon_size.x * 1.1 + Render.CalcTextSize("A", 24,FONT_BULLET).x, dt_pos_y + 19), Color.new(1.0, 1.0, 1.0, dt_alpha*fire_alpha), 24, FONT_BULLET, false)
    end
  end
end

ttonkill = Menu.Switch("> Misc", "Other", "[-] Killsay", false)
languageonkill = Menu.Combo("> Misc", "Other", "Select Language", {"Russian", "English", "Poland", "Romanian"}, 0)

local phrases = {
    "лучшая луа на маркете - https://shoppy.gg/@melonity",
    "куда улетел тапочек Melonity лучшая луа",
    "устал улетать с первой пули? Освежись https://shoppy.gg/@melonity",
    "я - обладатель Melonity, понюхай бебру",
    "я освежился новеньким апдейтом в Melonity - тебе пиздец",
    "отдохни, я Melonity юзер",
    "MELONITY АКТИВИРОВАН Д-Д-Д-ДДДОМИНАЦИЯЯЯЯЯЯЯ",
    "Melonity > ALL",
    "1 пидорасина ебаная спи",
    "l2p bot",
    "iq ? HAHAHA",
    "BY SANCHEZJ (◣_◢)",
    "sleep",
    "обоссан",
    "GLhf.exe Activated",
    "ᛈᗗᛈᗴῷ Кᗗᛕ δ৮ᛈᛠᚦᚖאᚖᚨนҋ",
    "ᛈᗗᛈᗗለᗗ ᛠ৮ ᛈᚖᛒᛈᗴᛗ",
    "ты понимаешь, что клитор твоей матери эта зона чрезвычайно опасная ??",
    "сру в тя в классе",
    "У тебя бешенство начинается?",
    "Звучит, как иди на хуй",
    "Это выгодно мне/тебе/нам",
    "ой иди на хуй !!!!",
    "похуй я Же говорю я Бобрик из Гетто!",
    "как же я с тебя ору",
    "НЕ делай одолжений, просто делай мне минет!",
    "хуем тибя щас уебу)0",
    "сасеш норм)0",
    "чота ты сосешь мне)0",
    "чота мать тваю выкинул)0",
    "гариш слетая)0",
    "ЕБАТЬ ТЫ НИЩИЙ, СОСИ)0))",
    "УБИТО СОСЁШЬ МНЕ, КУКОЛД)0))",
    "нихуя я тя красиво бомбанул",
    "может уже купишь луашку Melonity? Я устал тебя ебашить((",
    "легко сочнярик",
    "уебище учись играть",
    "изи мусорила ебанная",
    "я твоей матери горло ёршиком промывал что бы заглатывала лучше ебаная свинья",
    "ебаный сын подъезда как ты пикаешь",
    "сын ебаной жирной жабы",
    "освежись новеньким апдейтом shoppy.gg/@melonity"
    
}

local english = {
    "1 hs dog",
    "stop talking buy unhittable lua - shoppy.gg/@melonity",
    '˜”°•.˜”°• 1 by shoppy.gg/@melonity •°”˜.•°”˜',
    "sit down",
    "nice iq dog",
    "HAHAH IQ?",
    "killed by bao",
    "killed by clockedj",
    "1tap uff yaa$$$",
    "hs churka",
    "killed by jurka pidoras",
    "1v1? 2v2? 5v5? add me jurka#1234",
    "make blowjob for me",
    "iqless???",
    "iq?",
    "tap tap uff",
    "XANE $$$",
    "i fuck your mum dog hahah",
    "kiss my ass owo",
    "tap tap femboy",
    "femboy you got HS"
}

local poland = {
    "Ssij knage rozjebańcu",
    "Łatwe jak wyrwanie twojej matki",
    "Hedzik smieciu",
    "Mam wyłączony monitor i nadal cie rozpierdalam Xd?",
    "Wypierdalaj skurwysynku",
    "Szmato rozjebal bym ci głowe",
    "Pierdol sie lamusie",
    "O ty kurwo bez jąder",
    "Zabawne jest to ze twoja matka opierdala mi gałe a ja cie rozpierdalam w tym samym momencie",
    "Kolego wracaj na uwujka",
    "Szmato rozjebal bym ci głowe"


}

local romanian = {
    'stai jos dog',
    'futus morti matti dog buy superior lua shoppy.gg/@melonity',
    'sugi pula',
    'Ai cumva cheat-ul ala de la Llama?',
    '˜”°•.˜”°• 1 by shoppy.gg/@melonity •°”˜.•°”˜',
    'efortless',
    'foaie verde castravete ti-am dat 1 prin perete',
    'cand pun ochiu in luneta o vad pe ma-ta pe mocheta',
    'Juan ',
    'foaie verde si-o spatula ti-am dat cap cu ma-ta-n pula',
    'shoppy.gg/@melonity ez taps $$$',
    'mama coaie am dat click manual zici ca sunt alien cosminel',
    '1 by esoterik bro',
    '1 by pleata lui darth',
    'foaie verde be the heda ti-ai luat tap de la wanheda',
    'fie viata cat de grea iti dau tap ce pula mea',
    'foaie verde butelie intra glontu in chelie',
    'hacker de sentimente sparg capuri si apartamente',
    'skeet in buzunare sa-i dau tap lui fleeekkk',
    'Priveste partea buna, macar ai dat 100 damage la peretele din spatele meu !',
    'ESC --> Help & Options --> How to Play',
    '1 1 1 VeRy NeRvOs hEaDsHoT 1 1 1',
    'Pt fetele gravide recomand skeet cu vitamine.',
    '1 tie 1 lui ma-ta',
    'Asa a dat si ma-ta ochii peste cum ai dat tu cu capul',
    'futu-ti mortii ma-tii sa-ti fut de taran',
    'Tragem pula in mamele voastre!!!',
    'Te-ai speriat? Eu da!',
    'ai capul ala zici ca e made in china',
    'da-te ca-mi bag pula',
    'ai gresit 1way-ul',
    'alo baiatu, te-ai pierdut ? iti bag waze-u ?',
    'Ai corpul ala zici ca e halba de bere.',
    'ai corpul ala zici ca e lumanare de botez.',
    'VeRy NeRvoS BaIm',
    'shoppy.gg/@melonity peek',
    'stai jos caine',
    'Tu si Oana Roman ce mai stati cu burta pe afara.',
    'apas f pt tine <3',
    'scz eram cu legitbotu on',
    'rostogoli-mi-as pula-n ma-ta cum se rostogoleste crocodilu-n apa',
    'coaie ce corp ai zici ca esti desenat cu stanga',
    'uffya BaIm GoD $$ shoppy.gg/@melonity',
    'foaie verde de cucuta hai la tata sa te futa',
    'aleluia ai luat muia .!.',
    'Get Good. Get shoppy.gg/@melonity',
    'nice desync, esti cu eternity ?',
    'lol aveam resolver-ul off.',
    'Cel mai nervos baim din viata mea',
    'asta ajunge la war montage ms ms',
    'BaIm bAiM BaIm',
    'ceapa verde foaie iute uite baimu cum se duce',
    'Foaie verde praf de ciori iti iei baim pana mori',
    'Foaie verde si-o lamaie iti dau baim si iei muie',
    'foaie verde acadea ia cu baim in pula mea',
    'sunt haiduc cunoscut, iti dau pula la pascut',
    'sunt tac-tu, hai sa-ti dau lape',
    'ba..nu stiu cum sa-ti spun, dar...isi mai da ma-ta filme ca-i pompier de cand i-am pus pula peste umar?',
    'sa-ti pun pula pe piept ',
    'hai back to canal boschetare',
    'hai la gratar sa-ti frig o muie',
    "smecherii fut",
    "fraierii isi iau cap"
}

local function get_phrase()
    return phrases[Utils.RandomInt(1, #phrases)]:gsub('\"', '')
end

local function get_phrase2()
    return english[Utils.RandomInt(1, #english)]:gsub('\"', '')
end

local function get_phrase3()
    return poland[Utils.RandomInt(1, #poland)]:gsub('\"', '')
end

local function get_phrase4()
    return romanian[Utils.RandomInt(1, #romanian)]:gsub('\"', '')
end

handlers:subscribe("events", function(event)
    if not ttonkill:Get() then return end
    if event:GetName() ~= "player_death" then return end

    local me = EntityList.GetLocalPlayer()
    local victim = EntityList.GetPlayerForUserID(event:GetInt("userid"))
    local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker"))

    if victim == attacker or attacker ~= me then return end

    if languageonkill:GetInt()==0 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase() .. '"')
    end
    if languageonkill:GetInt()==1 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase2() .. '"')
    end
    if languageonkill:GetInt()==2 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase3() .. '"')
    end
    if languageonkill:GetInt()==3 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase4() .. '"')
    end
end)

local dmg_marker = Menu.Switch("> Visuals", "Misc" , "[-] Damage Marker" , false)
local dmg_marker_color = Menu.ColorEdit("> Visuals", "Misc", "Damage Marker color", Color.RGBA(185, 129, 235, 255))
local dmg_marker_windows = Menu.FindVar("Visuals", "World", "Misc", "Damage Indicator")

local scope_line = {}

scope_line.var = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope")
scope_line.screen = EngineClient:GetScreenSize()
scope_line.ref = scope_line.var:Get()

scope_line.menu = {}



scope_line.menu.enable = Menu.Switch("> Visuals", "Misc", "[-] Enable Custom Scope", false)
viewmodel_in_scope = Menu.Switch("> Visuals", "Misc", "Viewmodel In Scope", false)
function viewmodel_in_scope2()
    local cheats = CVar.FindVar("sv_cheats")
    local scope = CVar.FindVar("fov_cs_debug")
    if viewmodel_in_scope:Get() and scope_line.menu.enable:Get() then
        cheats:SetInt(1)
        scope:SetInt(90)
    else
        scope:SetInt(0)
    end
end
scope_line.menu.anim_speed = Menu.SliderInt("> Visuals", "Misc", "Animation Speed", 15, 1, 30)
scope_line.menu.offset = Menu.SliderInt("> Visuals", "Misc", "Offset", 10, 0, 500)
scope_line.menu.length = Menu.SliderInt("> Visuals", "Misc", "Length", 28, 0, 1000)
scope_line.menu.col_1 = Menu.ColorEdit("> Visuals", "Misc", "Color", Color.RGBA(255, 255, 255))
scope_line.menu.col_2 = Menu.ColorEdit("> Visuals", "Misc", "Color 2", Color.RGBA(255, 255, 255, 0))

scope_line.menu.col_2:SetVisible(false)

scope_line.anim_num = 0

scope_line.lerp = function(a, b, t)
    return a + (b - a) * t
end

scope_line.on_draw = function()
    if not scope_line.menu.enable:GetBool() then scope_line.var:SetInt(1) return end
    scope_line.var:SetInt(2)

    local_player = EntityList.GetLocalPlayer()
    scope_line.anim_speed = scope_line.menu.anim_speed:Get()

    if not local_player or not local_player:IsAlive() or not local_player:GetProp("m_bIsScoped") then
        scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 0, scope_line.anim_speed * GlobalVars.frametime)
    else
        scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 1, scope_line.anim_speed * GlobalVars.frametime)
    end

    scope_line.offset = scope_line.menu.offset:Get() * scope_line.anim_num
    scope_line.length = scope_line.menu.length:Get() * scope_line.anim_num
    scope_line.col_1 = scope_line.menu.col_1:Get()
    scope_line.col_2 = scope_line.menu.col_2:Get()
    scope_line.width = 1

    scope_line.col_1.a = scope_line.col_1.a * scope_line.anim_num
    scope_line.col_2.a = scope_line.col_2.a * scope_line.anim_num
    
    scope_line.start_x = scope_line.screen.x / 2
    scope_line.start_y = scope_line.screen.y / 2
    

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x - scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x - scope_line.offset - scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x + scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x + scope_line.offset + scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y + scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y + scope_line.offset + scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y - scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y - scope_line.offset - scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)
end


function C_BasePlayer:CanHit()
    local Localplayer = EntityList.GetLocalPlayer()
    local TraceInfo = Cheat.FireBullet(self, self:GetEyePosition(), Localplayer:GetEyePosition())

    if (TraceInfo.damage > 0 and ((TraceInfo.trace.hit_entity and TraceInfo.trace.hit_entity:GetPlayer() == Localplayer) or false)) then
        return true
    end

    return false
end

function C_BasePlayer:GetFlag(shift)
    return bit.band(self:GetProp("m_fFlags"), bit.lshift(1, shift)) ~= 0
end

function GetEnemies()
    local Enemies = {}

    for _, Player in pairs(EntityList.GetPlayers()) do
        if (not Player:IsTeamMate() and Player:IsAlive()) then
            table.insert(Enemies, Player:GetPlayer())
        end
    end

    return Enemies
end

function teleport_in_air_dt()
    if (menu_elements.teleport_in_air:Get() and menu_elements.teleport_weapons:Get() ~= 0 and refs.dt:Get()) then
        local Allow_Work = false
        local Need_Teleport = false

        local Localplayer = EntityList.GetLocalPlayer()
        local Weapon = Localplayer:GetActiveWeapon()
        local WeaponID = Weapon:GetWeaponID()

        local IsScout = WeaponID == 40
        local IsAWP = WeaponID == 9
        local IsPistols = Weapon:IsPistol()
        local IsZeus = WeaponID == 31
        local IsKnife = Weapon:IsKnife()
        local IsNades = Weapon:IsGrenade()

        for i, Weapons in pairs({
            IsScout,
            IsAWP,
            IsPistols,
            IsZeus,
            IsKnife,
            IsNades,
            not (IsScout or IsAWP or IsPistols or IsZeus or IsKnife or IsNades)
        }) do
            if (menu_elements.teleport_weapons:Get(i) and Weapons) then
                Allow_Work = true
            end
        end

        if (Allow_Work) then
            for _, Enemy in pairs(GetEnemies()) do
                if (not Enemy:IsDormant() and Enemy:CanHit()) then
                    Need_Teleport = true
                end
            end
        end

        if (Need_Teleport and not Localplayer:GetFlag(0)) then
            Exploits.ForceTeleport()
        end
    end
end


local DoAntiDefensive = function()
    if menu_elements.anti_defensive:Get() == true then
        EngineClient.ExecuteClientCmd("spectate")
        CVar.FindVar("cl_lagcompensation"):SetInt(0)
    else
        EngineClient.ExecuteClientCmd("spectate")
        CVar.FindVar("cl_lagcompensation"):SetInt(1)
    end
end
menu_elements.anti_defensive:RegisterCallback(DoAntiDefensive)

local get_condition = function ()
    local lp = EntityList.GetLocalPlayer()
    if lp:GetProp("m_flDuckAmount") > 0.89 and not refs.fd:Get()  then return "CROUCHING"
    elseif lp:GetProp("m_vecVelocity"):Length() < 2 then return "STANDING"
    elseif refs.sw:Get() then return "SLOW-WALKING"
    elseif bit.band(lp:GetProp("m_fFlags"), 1) == 0 then return "AIR"
    else return "MOVING" end
end

local font_debug = Render.InitFont("Tahoma" , 12 ,{'b' })

ffi.cdef [[
    int VirtualProtect(void* lpAddress, unsigned long dwSize, unsigned long flNewProtect, unsigned long* lpflOldProtect);
    void* VirtualAlloc(void* lpAddress, unsigned long dwSize, unsigned long  flAllocationType, unsigned long flProtect);
    int VirtualFree(void* lpAddress, unsigned long dwSize, unsigned long dwFreeType);

    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
    typedef bool ( __thiscall* setupbones_t)( void*, void*, int, int, float );
    typedef struct
    {
        float x;
        float y;
        float z;
    } Vector_t;

    typedef struct
  {
      char    pad0[0x60]; // 0x00
      void* pEntity; // 0x60
      void* pActiveWeapon; // 0x64
      void* pLastActiveWeapon; // 0x68
      float        flLastUpdateTime; // 0x6C
      int            iLastUpdateFrame; // 0x70
      float        flLastUpdateIncrement; // 0x74
      float        flEyeYaw; // 0x78
      float        flEyePitch; // 0x7C
      float        flGoalFeetYaw; // 0x80
      float        flLastFeetYaw; // 0x84
      float        flMoveYaw; // 0x88
      float        flLastMoveYaw; // 0x8C // changes when moving/jumping/hitting ground
      float        flLeanAmount; // 0x90
      char    pad1[0x4]; // 0x94
      float        flFeetCycle; // 0x98 0 to 1
      float        flMoveWeight; // 0x9C 0 to 1
      float        flMoveWeightSmoothed; // 0xA0
      float        flDuckAmount; // 0xA4
      float        flHitGroundCycle; // 0xA8
      float        flRecrouchWeight; // 0xAC
      Vector_t        vecOrigin; // 0xB0
      Vector_t        vecLastOrigin;// 0xBC
      Vector_t        vecVelocity; // 0xC8
      Vector_t        vecVelocityNormalized; // 0xD4
      Vector_t        vecVelocityNormalizedNonZero; // 0xE0
      float        flVelocityLenght2D; // 0xEC
      float        flJumpFallVelocity; // 0xF0
      float        flSpeedNormalized; // 0xF4 // clamped velocity from 0 to 1
      float        flRunningSpeed; // 0xF8
      float        flDuckingSpeed; // 0xFC
      float        flDurationMoving; // 0x100
      float        flDurationStill; // 0x104
      bool        bOnGround; // 0x108
      bool        bHitGroundAnimation; // 0x109
      char    pad2[0x2]; // 0x10A
      float        flNextLowerBodyYawUpdateTime; // 0x10C
      float        flDurationInAir; // 0x110
      float        flLeftGroundHeight; // 0x114
      float        flHitGroundWeight; // 0x118 // from 0 to 1, is 1 when standing
      float        flWalkToRunTransition; // 0x11C // from 0 to 1, doesnt change when walking or crouching, only running
      char    pad3[0x4]; // 0x120
      float        flAffectedFraction; // 0x124 // affected while jumping and running, or when just jumping, 0 to 1
      char    pad4[0x208]; // 0x128
      float        flMinBodyYaw; // 0x330
      float        flMaxBodyYaw; // 0x334
      float        flMinPitch; //0x338
      float        flMaxPitch; // 0x33C
      int            iAnimsetVersion; // 0x340
  } CCSGOPlayerAnimationState_534535_t;

  struct animlayer_s {
    float   m_anim_time;
    float   m_fade_out_time;
    int     m_flags;
    int     m_activty; 
    int     m_priority;
    int     m_order;     
    int     m_sequence;
    float   m_prev_cycle;
    float   m_weight;
    float   m_weight_delta_rate;
    float   m_playback_rate;
    float   m_cycle;
    int     m_owner;
    int     m_bits;
};
]]

local hook = {hooks = {}}

local ENTITY_LIST_POINTER = ffi.cast("void***", Utils.CreateInterface("client.dll", "VClientEntityList003")) or error("Failed to find VClientEntityList003!")
local GET_CLIENT_ENTITY_FN = ffi.cast("uintptr_t (__thiscall*)(void*, int)", ENTITY_LIST_POINTER[0][3])

local ffi_helpers = {
    get_entity_address = function(entity_index)
        local addr = GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER, entity_index)
        return addr
    end
}

function hook.new(cast, callback, hook_addr, size, trampoline, org_bytes_tramp)
    local size = size or 5
    local trampoline = trampoline or false
    local new_hook, mt = {}, {}
    local detour_addr = tonumber(ffi.cast('intptr_t', ffi.cast('void*', ffi.cast(cast, callback))))
    local void_addr = ffi.cast('void*', hook_addr)
    local old_prot = ffi.new('unsigned long[1]')
    local org_bytes = ffi.new('uint8_t[?]', size)
    ffi.copy(org_bytes, void_addr, size)
    if trampoline then
        local alloc_addr = ffi.gc(ffi.C.VirtualAlloc(nil, size + 5, 0x1000, 0x40), function(addr) ffi.C.VirtualFree(addr, 0, 0x8000) end)
        local trampoline_bytes = ffi.new('uint8_t[?]', size + 5, 0x90)
        if org_bytes_tramp then
            local bytes = {}
            for byte in org_bytes_tramp:gmatch('(%x%x)') do
                table.insert(bytes, tonumber(byte, 16))
            end
            trampoline_bytes = ffi.new('uint8_t[?]', size + 5, bytes)
        else
            ffi.copy(trampoline_bytes, org_bytes, size)
        end
        trampoline_bytes[size] = 0xE9
        ffi.cast('uint32_t*', trampoline_bytes + size + 1)[0] = hook_addr - tonumber(ffi.cast('intptr_t', ffi.cast('void*', ffi.cast(cast, alloc_addr)))) - size
        ffi.copy(alloc_addr, trampoline_bytes, size + 5)
        new_hook.call = ffi.cast(cast, alloc_addr)
        mt = {__call = function(self, ...)
            return self.call(...)
        end}
    else
        new_hook.call = ffi.cast(cast, hook_addr)
        mt = {__call = function(self, ...)
            self.stop()
            local res = self.call(...)
            self.start()
            return res
        end}
    end
    local hook_bytes = ffi.new('uint8_t[?]', size, 0x90)
    hook_bytes[0] = 0xE9
    ffi.cast('uint32_t*', hook_bytes + 1)[0] = detour_addr - hook_addr - 5
    new_hook.status = false
    local function set_status(bool)
        new_hook.status = bool
        ffi.C.VirtualProtect(void_addr, size, 0x40, old_prot)
        ffi.copy(void_addr, bool and hook_bytes or org_bytes, size)
        ffi.C.VirtualProtect(void_addr, size, old_prot[0], old_prot)
    end
    new_hook.stop = function() set_status(false) end
    new_hook.start = function() set_status(true) end
    new_hook.start()

    table.insert(hook.hooks, new_hook)
    return setmetatable(new_hook, mt)
end
--HOOKS
local updatecsa_address = Utils.PatternScan("client.dll", "8B F1 80 BE ? ? ? ? ? 74 36", -5)
function starthooks()
    updateCSA_fn = hook.new('void(__fastcall*)(void*, void*)', updateCSA_hk, ffi.cast("uintptr_t", updatecsa_address))
end
--FUNNY 113 42 262!!! 223 192 15 7  10 11

local time_on_land = 1000

function updateCSA_hk(thisptr, edx)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if not localplayer then return updateCSA_fn(thisptr, edx) end
    local lp_ptr = ffi_helpers.get_entity_address(EngineClient.GetLocalPlayer()) 
    local ref_slide = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Leg Movement")

    if not enable_animation_breaker:Get() then    updateCSA_fn(thisptr, edx) return end
    if animation_breaker:GetBool(2) then
        if not enable_animation_breaker:Get() then return end
        ref_slide:SetInt(1)
        ffi.cast("float*" , lp_ptr+10104)[0] = Utils.RandomInt(0,1)
        end

    if  not ( animation_breaker:GetBool(1)  or animation_breaker:GetBool(3)) or not enable_animation_breaker:Get()  then    updateCSA_fn(thisptr, edx) return end

    if animation_breaker:GetBool(1) then
        ffi.cast("float*" , lp_ptr+10104)[6] = 1
    end
    if animation_breaker:GetBool(3) then
        if bit.band(localplayer:GetProp("m_fFlags") , 1 ) == 0 then
            time_on_land = 0
        end

        time_on_land = time_on_land + 0.05

        if time_on_land < 25 and time_on_land > 1 then
            ffi.cast("float*" , lp_ptr+10104)[12] = 0.5
        end
    end


    updateCSA_fn(thisptr, edx)

    if animation_breaker:GetBool(1) then
        ffi.cast("float*" , lp_ptr+10104)[6] = 1
    end

    if animation_breaker:GetBool(3) then
        if bit.band(localplayer:GetProp("m_fFlags") , 1 ) == 0 then
            time_on_land = 0
        end

        time_on_land = time_on_land + 0.05

        if time_on_land < 25 and time_on_land > 1 then
            ffi.cast("float*" , lp_ptr+10104)[12] = 0.5
        end
    end


end


handlers:subscribe("events" , function(e)

    if e:GetName()=="player_death" then
         time_on_land = 1000
    end

    if e:GetName()=="round_start" then
        time_on_land = 1000
    end

end)


handlers:subscribe("destroy" , function ()
    for i, hook in ipairs(hook.hooks) do
        if hook.status then
            hook.stop()
        end
    end
end)

d_switch = Menu.Switch("> Rage", "Main",  "[+] Dormant Aimbot", false, "Makes Aimbot shoots at dormant targets.")
d_min_damage = Menu.SliderInt("> Rage", "Main",  "Minimum Damage", 1, 1, 100)


local calc_angle = function(src, dst)
    local vecdelta = Vector.new(dst.x - src.x, dst.y - src.y, dst.z - src.z)
    local angles = QAngle.new(math.atan2(-vecdelta.z, vecdelta:Length2D()) * 180.0 / math.pi, (math.atan2(vecdelta.y, vecdelta.x) * 180.0 / math.pi), 0.0)
    return angles
end

local function dormant_aimbot()



    local scan_data = {
        point = nil,
        damage = d_min_damage:Get(),
        hit_ent = nil,
        name = "",
        tick = 0,
    }

    local get_ent_ptr = function(ent)
        if not ent then return nil end
        return GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER , ent:EntIndex())
    end
    
    local accepted_weapons = {[261]=1, [242]=1, [233]=1, [267]=1}


    handlers:subscribe("createmove" , function(cmd)
        if not d_switch:Get() then return end
        scan_data = {
            point = nil,
            damage = d_min_damage:Get(),
            hit_ent = nil,
            name = "",
            tick = 0,
        }
        local lp = EntityList.GetLocalPlayer()
        local shoot_pos = EntityList.GetLocalPlayer():GetEyePosition()
        for _ , player in pairs(EntityList.GetPlayers()) do
            if not player or player:IsTeamMate() or not player:IsAlive() or not player:IsDormant() or player:GetNetworkState() ==-1 or player:GetNetworkState()==4 then goto skip end
          
          
            local pos = player:GetProp("m_vecOrigin")
            local ang = math.rad(calc_angle(shoot_pos , pos).yaw)
            local check_visible = EngineTrace.TraceRay(shoot_pos , pos + Vector.new(0,0,40) , lp , 0xFFFFFFFF)
            if check_visible.fraction ==1 then
            --    print_dbg("vis")
                goto skip end
            for k = 30, 45, 5 do -- get points from bbmins , bbmaxs
                for j = -4, 4, 4 do
                    local point = pos + Vector.new(  j*math.sin(ang) ,  -j*math.cos(ang),  k)
                    local fire_data = Cheat.FireBullet(EntityList.GetLocalPlayer() , shoot_pos , point)
                  
                    if fire_data.damage >=  scan_data.damage and not fire_data.trace.hit_entity  then
                        scan_data.point = point
                        scan_data.damage = fire_data.damage
                        scan_data.hit_ent = player
                        scan_data.tick = GlobalVars.tickcount
                        scan_data.name = player:GetName()
                        return
                    end
                end
            end
            ::skip::   
        end


        

    end )


    handlers:subscribe("pre_prediction" , function(cmd)
        
        if not d_switch:Get() then return end
      
        if not scan_data.point or not scan_data.hit_ent or not scan_data.hit_ent:IsDormant() or not scan_data.name or scan_data.tick == 0 then
            return end
        local weap = EntityList.GetLocalPlayer():GetActiveWeapon()

        if not weap or weap:IsKnife() then return end

        local lp = EntityList.GetLocalPlayer()
        
        local pacan_time = ticks_to_time(lp:GetProp("m_nTickBase"))

        if pacan_time - lp:GetProp("m_flNextAttack") < 0.05 or pacan_time - weap:GetProp("m_flNextPrimaryAttack") < 0.05 then
            return end

        if weap:GetInaccuracy(weap) > 0.09 then
            return end

        if accepted_weapons[weap:GetClassID()] and not lp:GetProp("m_bIsScoped") then    --autoscope
            cmd.buttons = bit.bor(cmd.buttons , 2048)
        end

        local shoot_pos = EntityList.GetLocalPlayer():GetEyePosition()




        
        cmd.viewangles = calc_angle(shoot_pos , scan_data.point)
        cmd.buttons = bit.bor(cmd.buttons , 1)
        cmd.tick_count = cmd.tick_count - 1
        


        local white = Color.new(1,1,1,1)
        local col = Color.new(0,0.6 , 1 , 1)
        
        if enable_logs:Get() and type2_of_logs:Get()==1 and type3_of_logs:Get(3) then
            logs:add(true , "Attempted shot by dormant aimbot [target: " .. scan_data.name.." , dmg: "..math.floor(scan_data.damage) .." ]")
        end
    
    end )

    function debug_panel()
        if not enable_debug_panel:Get() then return end
        if not EntityList.GetLocalPlayer() or not EntityList.GetLocalPlayer():IsAlive() then return end
    
    
        local real_rotation = AntiAim.GetCurrentRealRotation();
        local desync_rotation = AntiAim.GetFakeRotation();
        local  desync_delta = clamp(math.floor(math.abs(real_rotation - desync_rotation)) , 0 , 58)
        
        
        if list_debug_panel:Get()==1 then
        local info_text = ""..lua_name..""..version..""
        local aa_text = ">; Anti Aim Information: side - "..(AntiAim.GetInverterState() and "right" or "left").." - ".. desync_delta.."°"
        local pinfo_text= ">; Player Condition - ".. (get_condition() or "unk")
        local abrute_text = ">; Anti Bruteforce information -  ".. (menu_elements.switch:Get() and (anti_brute.working and "working - " or "idle - ").."phase ("..(anti_brute.cur_phase+1)..")" .. (anti_brute.working and " - ("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)" or "")   or "disabled")
    
    
        
        local Color_fake = Color.new ( (1-1)*0.8 + 0.2 , (0.2 + 1*0.8)*0.8 , 0.3  , 1 )
    
        local pos = Vector2.new(EngineClient.GetScreenSize().x /2 , EngineClient.GetScreenSize().y - 200 )
        local ts1 = Render.CalcTextSize(info_text , 12 , font_debug)
        Render.Text(info_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(info_text , pos-ts1/2 , Color.new(0.9 , 0.9 , 0.9 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(aa_text , 12 , font_debug)
        Render.Text(aa_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(aa_text , pos -ts1/2, Color_fake , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(pinfo_text , 12 , font_debug)
        Render.Text(pinfo_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(pinfo_text , pos -ts1/2, Color.new(0.8 , 0.8 , 1 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(abrute_text , 12 , font_debug)
        Render.Text(abrute_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(abrute_text , pos -ts1/2, Color.new(0.9 , 0.6 , 0.6 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
    
    end
end
    
pixel_debug = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)
local OldChoke, toDraw0, toDraw1, toDraw2, toDraw3, toDraw4, on_plant_time, fill, text, planting_site, planting, autopeek_origin = 0, 0, 0, 0, 0, 0, 0, 0, "", "", false, nil

function debug_panel2()
    if not enable_debug_panel:Get() then return end
    if list_debug_panel:Get()==0 then

    local ax = 0
    local chocking = ClientState.m_choked_commands
    if chocking < OldChoke then
        toDraw0 = toDraw1
        toDraw1 = toDraw2
        toDraw2 = toDraw3
        toDraw3 = toDraw4
        toDraw4 = OldChoke
    end
    OldChoke = chocking
   local x = EngineClient.GetScreenSize().x
   local y = EngineClient.GetScreenSize().y
   local player = EntityList.GetLocalPlayer();
   if not player then return end
    
   local lifeState = player:GetProp("m_lifeState");
   if not lifeState then
local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
if lp == nil then return end

  local flags = player:GetProp("m_fFlags")

   local aa_state1234d = "STANDING"
   if is_moving then
    aa_state1234d = "MOVING"
   end
  
   if (flags == 256) then
    aa_state1234d = "AIR"
   end

   if player:GetProp("m_flDuckAmount") > 0.9 then
    aa_state1234d = "CROUCHING"   
   end

   if refs.sw:GetBool() then
    aa_state1234d = "SLOW-WALKING"
   end

   if externded_desync_switch:Get() then
    aa_state1234d = "ROLL AA"
   end

   local TICKBASE_DEBUG = refs.dt:GetBool() and 14 or 7
   local charge_debug = Exploits.GetCharge()
   local charged_ticks_debug = math.abs(math.floor((charge_debug * TICKBASE_DEBUG) + 0.5))

   local abrute_text123 = "+ Anti Bruteforce information: ".. (menu_elements.switch:Get() and (anti_brute.working and "working - " or "idle - ").."phase ("..(anti_brute.cur_phase+1)..")" .. (anti_brute.working and " - ("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)" or "")   or "disabled")
   local tick_debug = "+ Current Ticks: "..charged_ticks_debug.." | Allowed Ticks: 14"

    arrows = AntiAim.GetInverterState() and "<" or ">"
    Render.Text(""..lua_name..""..version.." | "..Cheat.GetCheatUserName(), Vector2.new(x/20, y/2.4+30), Color.RGBA(255,255,255,255), 10, pixel_debug, true)
    Render.Text("+ INVERTER: "..arrows.." | STATE: "..aa_state1234d, Vector2.new(x/20, y/2.4+42), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text("+ FAKELAG COUNTER: "..string.format("%i-%i-%i-%i-%i",toDraw4,toDraw3,toDraw2,toDraw1,toDraw0), Vector2.new(x/20, y/2.4+54), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text(abrute_text123, Vector2.new(x/20, y/2.4+66), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text(tick_debug, Vector2.new(x/20, y/2.4+78), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    
end
end
end


end

local json = Panorama.LoadString([[
    return {
        stringify: JSON.stringify,
        parse: JSON.parse
    };
]])()
local base64 = {
    codes =  {'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='},
    encode = function (self, str, type_c)
        local b = self.codes[type_c or 1]
        return ((str:gsub('.', function(x)
            local r,b='',x:byte()
            for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
            return r;
        end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
            if (#x < 6) then return '' end
            local c=0
            for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
            return b:sub(c+1,c+1)
        end)..({ '', '==', '=' })[#str%3+1])
    end,
    decode = function (self, data, type_c)
        local b = self.codes[type_c or 1]

        data = string.gsub(data, '[^'..b..'=]', '')
        return (data:gsub('.', function(x)
            if (x == '=') then return '' end
            local r,f='',(b:find(x)-1)
            for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
            return r;
        end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
            if (#x ~= 8) then return '' end
            local c=0
            for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
                return string.char(c)
        end))
    end
}


ffi.cdef [[
    typedef int(__thiscall* get_clipboard_text_count)(void*);
    typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
    typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);
]]

local VGUI_System = ffi.cast("void***", Utils.CreateInterface("vgui2.dll", "VGUI_System010"))
local get_clipboard_text_count = ffi.cast("get_clipboard_text_count", VGUI_System[0][7])
local set_clipboard_text = ffi.cast("set_clipboard_text", VGUI_System[0][9])
local get_clipboard_text = ffi.cast("get_clipboard_text", VGUI_System[0][11])
local configs = {
    export = function (from, color_exceptions)
        local config = {}
        for tabname , tab in pairs( from ) do
            for name, cheatvar in pairs(tab) do
                local result = {}
                if type(cheatvar) == "table" then
                    local temp = {}
                    for i=1 ,#cheatvar do temp[i] = cheatvar[i]:Get() end
                    result = {array = temp }
                else
                    if cheatvar:Get()==nil  then goto huy2 end

                    result = {value = cheatvar:Get()}
                end
                if (result.array ~= nil) then
                    goto huy
                end

                if color_exceptions[name] then
                    local color = cheatvar:GetColor()
                    result["color"] = {r = color.r, g = color.g, b = color.b, a = color.a}
                end

                if type(result.value) == "userdata" then
                    result["color"] = {r = result.value.r, g = result.value.g, b = result.value.b, a = result.value.a}
                end
                ::huy::
                if not config[tabname] then config[tabname] = {} end

                config[tabname][name] = result

                ::huy2::
            end
        end
        local exported_to_armenia = "Melonity" .. json.stringify(config)
        set_clipboard_text(VGUI_System,"Melonity".. base64:encode(exported_to_armenia ) ,#("Melonity".. base64:encode(exported_to_armenia )) )
        Cheat.AddNotify("Melonity Solutions", "Config was succesfully exported!")
    end,
    import = function (array, color_exceptions , siska , aa)
        local clipboard_text_length = get_clipboard_text_count(VGUI_System)
        local clipboard_data = ""
        
        if siska~=nil then
            clipboard_data = siska
            goto poshel_naxyu
        end


 
        if clipboard_text_length > 0 then
            buffer = ffi.new("char[?]", clipboard_text_length)
            size = clipboard_text_length * ffi.sizeof("char[?]", clipboard_text_length)
        
            get_clipboard_text(VGUI_System,0, buffer, size )
        
            clipboard_data = ffi.string( buffer, clipboard_text_length-1 )
        end

        
        ::poshel_naxyu::
       if not clipboard_data then return end
       if not string.find( clipboard_data , "Melonity") then
        Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
        return
       end
        local notified = false
       local config = json.parse((base64:decode( clipboard_data:gsub("Melonity" , "") )):gsub("Melonity", "") )

        if not config then
            Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
            return
        end

        for tabname , tab in pairs(config) do
            if not tab or not tabname then
                Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
                return
            end

            for name, cheatvar in pairs(tab) do

                if not name or not cheatvar or not array[tabname] or not array[tabname][name] then
                    if not notified then     
                        Cheat.AddNotify("Melonity Solutions", "An error occured with config or config might be outdated!")
                        notified = true
                    end
                    goto mama
                end


                if cheatvar.color then
                    array[tabname][name]:SetColor(Color.new(tonumber(cheatvar.color.r), tonumber(cheatvar.color.g), tonumber(cheatvar.color.b), tonumber(cheatvar.color.a)))

                end
                if cheatvar.array then
                    for i=1, #array[tabname][name] do
                        if array[tabname][name][i] and cheatvar.array[i] then
                            array[tabname][name][i]:Set(cheatvar.array[i])
                        end
                    end
                end
                if not cheatvar.array and not (cheatvar.color and not color_exceptions[name]) then
                    if  array[tabname][name] and cheatvar.value then
                        
                        array[tabname][name]:Set(cheatvar.value)
                    end
                end
                 ::mama::
            end
        end
        if not notified and not aa then
            Cheat.AddNotify("Melonity Solutions", "Config was succesfully loaded!")
        end
        anti_brute:adjust_abrute()
     end,

}


 export:RegisterCallback( function()

    configs.export(ui_array , {})
 end)

 import:RegisterCallback( function()

    configs.import(ui_array , {} , nil , false)

end)

hitsound = Menu.Switch("> Misc", "Main", "[-] Enable Hitsound" , false)
hitsound_list = Menu.Combo("> Misc", "Main", "Select Hitsound", {"Skeet", "Alternative"}, 0)
hitsound_vol = Menu.SliderInt("> Misc", "Main" , "Hitsound Volume" , 75 , 0 , 100)

local pi_divided = math.pi / 180
local new_vec2, new_vec, new_angle, vec_length, callback, inverter = Vector2.new, Vector.new, QAngle.new, Vector.new(0, 0, 0).Length, Cheat.RegisterCallback, AntiAim.GetInverterState
local sin, cos = math.sin, math.cos

local angle_vec = function(angles)
    local forward, right = new_vec(), new_vec()

    local pitch, yaw, roll = angles.pitch * pi_divided, angles.yaw * pi_divided, angles.roll * pi_divided
    local cp = cos(pitch)
    local sp = sin(pitch)

    local cy = cos(yaw)
    local sy = sin(yaw)

    local cr = cos(roll)
    local sr = sin(roll)

    forward.x = cp * cy
    forward.y = cp * sy
    forward.z = -sp

    right.x = -1 * sr * sp * cy + -1 * cr * -sy
    right.y = -1 * sr * sp * sy + -1 * cr * cy
    right.z = -1 * sr * cp

    return forward, right
end

local actual_mov = new_vec2(0, 0)
local mov_fix = function(user_cmd)
    local frL, riL = angle_vec(new_angle(0, user_cmd.viewangles.yaw, 0))
    local frC, riC = angle_vec(user_cmd.viewangles)

    frL.z = 0
    riL.z = 0
    frC.z = 0
    riC.z = 0

    frL = frL / vec_length(frL)
    riL = riL / vec_length(riL)
    frC = frC / vec_length(frC)
    riC = riC / vec_length(riC)

    local worldCoords = frL * actual_mov.x + riL * actual_mov.y;

    user_cmd.sidemove = (frC.x * worldCoords.y - frC.y * worldCoords.x) / (riC.y * frC.x - riC.x * frC.y)
    user_cmd.forwardmove = (riC.y * worldCoords.x - riC.x * worldCoords.y) / (riC.y * frC.x - riC.x * frC.y)
end

snapelines = Menu.Switch("> Visuals", "Other", "[-] Snapelines", false)
snapelines_render = Menu.Combo("> Visuals", "Other" , "Line Position" , {"Crosshair" , "Hitbox Center"} , 0)
local snapelines_color = Menu.ColorEdit("> Visuals", "Other", "Line color", Color.RGBA(185, 129, 235, 255))

function is_alive1234()
    local player = EntityList.GetLocalPlayer()
    if not player then return end
    local lifeState = player:GetProp("m_lifeState")
    
    return not lifeState
    end

TP = Menu.FindVar("Visuals", "View", "Thirdperson", "Enable Thirdperson")
function snape_lines()
    if not is_alive1234() then return end
    if not snapelines:Get() then return end
    local screen_size = EngineClient.GetScreenSize()
       local lines_color = snapelines_color:GetColor()
       local players = EntityList.GetPlayers()
       local local_player = EntityList.GetLocalPlayer()
      
       for _, player_ptr in ipairs(players) do
          if player_ptr == local_index or player_ptr:IsTeamMate() then goto skip end
          local position = Render.WorldToScreen(player_ptr:GetEyePosition())
          local pos2 = Render.WorldToScreen(EntityList.GetLocalPlayer():GetHitboxCenter(5))
          local vec = Cheat.AngleToForward(EngineClient.GetViewAngles())

          pos2 = TP:Get() and pos2 or Render.WorldToScreen(EntityList.GetLocalPlayer():GetRenderOrigin())
          local lifeState = player_ptr:GetProp("m_lifeState"); if lifeState then goto skip end
          if player_ptr:IsDormant() then goto skip end
          if snapelines_render:GetInt()==0 then
          Render.Line(position, Vector2.new(screen_size.x / 2, screen_size.y / 2), lines_color)
          end
          if snapelines_render:GetInt()==1 then
        Render.Line(position, pos2, lines_color)
          end
         ::skip::
       end
   end

   menu_watermark = Menu.Switch("> Visuals", "Other", "[-] Menu Watermark", true)

   local function in_menu() local pos, size, color, height, text, textcolor = Render.GetMenuPos(), Render.GetMenuSize(), Color.new(79 / 255, 161 / 255, 255 / 255, 255), 100, 'Melonity',Color.new(79 / 255, 161 / 255, 255 / 255, 255);
    if not menu_watermark:Get() then return end
    if Cheat.IsMenuVisible() == true then
        Render.Blur(Vector2.new(pos.x,pos.y-height+50),Vector2.new(pos.x+size.x,pos.y-5),Color.RGBA(255,255,255,255),5)
        Render.BoxFilled(Vector2.new(pos.x,pos.y-height+50),Vector2.new(pos.x+size.x,pos.y-5),Color.RGBA(0,0,0,125),5)
        Render.Text(text,Vector2.new(pos.x+size.x/2,pos.y+22-height/2),Color.RGBA(255,255,255,255),30,true,true)
    end
end



function handle_vis()
    if not Cheat.IsMenuVisible() then return end

    list_debug_panel:SetVisible(should_hide and enable_debug_panel:Get())
    viewmodel_in_scope:SetVisible(should_hide and scope_line.menu.enable:Get())
    menu_watermark:SetVisible(should_hide)
    enable_clantag:SetVisible(should_hide)
    hitchance_conditions:SetVisible(should_hide)
    hitchance_in_air:SetVisible(should_hide and hitchance_conditions:Get(1))
    noscope_hitchance:SetVisible(should_hide and hitchance_conditions:Get(2))
    languageonkill:SetVisible(should_hide and ttonkill:Get())
    snapelines_render:SetVisible(should_hide and snapelines:Get())
    enable_antibackstab:SetVisible(should_hide)
    hitsound:SetVisible(should_hide)
    hitsound_vol:SetVisible(hitsound:Get())
    hitsound_list:SetVisible(should_hide and hitsound:Get())
    menu_elements.custom_aa:SetVisible(should_hide)
    menu_elements.custom_type:SetVisible(should_hide and menu_elements.custom_aa:GetBool())
    menu_elements.custom_presets:SetVisible(should_hide and menu_elements.custom_type:Get()==1 and menu_elements.custom_aa:GetBool())
    menu_elements.custom_cond:SetVisible(should_hide and menu_elements.custom_type:Get()~=1 and menu_elements.custom_aa:GetBool())
    menu_elements.anti_defensive:SetVisible(should_hide)
    menu_elements.teleport_in_air:SetVisible(should_hide)
    menu_elements.teleport_weapons:SetVisible(should_hide and menu_elements.teleport_in_air:GetBool())
    scope_line.menu.enable:SetVisible(should_hide)
scope_line.menu.offset:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.length:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.anim_speed:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.col_1:SetVisible(should_hide and scope_line.menu.enable:GetBool())
enable_logs:SetVisible(should_hide)
quick_peek:SetVisible(should_hide)
legit_aa:SetVisible(should_hide )
enable_animation_breaker:SetVisible(should_hide)
animation_breaker:SetVisible(should_hide  and enable_animation_breaker:GetBool())
edge_yaw:SetVisible(should_hide)
export:SetVisible(should_hide)
import:SetVisible(should_hide)
enable_indicators:SetVisible(should_hide)
indicators_list:SetVisible(should_hide and enable_indicators:GetBool())
enable_debug_panel:SetVisible(should_hide)
arrows_type:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()~=1)
indic2_color:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()==2)
color123456:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()~=0 and indicators_list:Get()==1)
arrows_color:SetVisible(should_hide and enable_indicators:GetBool() and arrows_type:Get()~=0 and indicators_list:Get()~=1)
arrows_inverted_color:SetVisible(should_hide and enable_indicators:GetBool() and arrows_type:Get()~=0 and arrows_type:Get()==2 and indicators_list:Get()~=1)
keybinds_123:SetVisible(should_hide)
ui_themes:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:GetInt()~=0)
ui_line_color:SetVisible(should_hide and keybinds_123:GetBool() and ui_themes:GetInt()~=0 and select_ui_windows:GetInt()~=0)
custom_name_switch:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(2))
custom_name_text:SetVisible(should_hide and keybinds_123:GetBool() and custom_name_switch:Get() and select_ui_windows:Get(2) )
bind_state_ui:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(1))
cheat_name:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(2))
enable_min_damage_indicator:SetVisible(should_hide )
min_damage_indicator_pos:SetVisible(should_hide and enable_min_damage_indicator:GetBool())
menu_elements.BodyDT:SetVisible(should_hide)
load_def:SetVisible(should_hide)
type_of_logs:SetVisible(should_hide and enable_logs:GetBool() and type2_of_logs:Get()==0)
type3_of_logs:SetVisible(should_hide and enable_logs:GetBool() and type2_of_logs:Get()==1)
type2_of_logs:SetVisible(should_hide and enable_logs:GetBool())
select_ui_windows:SetVisible(should_hide and keybinds_123:GetBool())
switch_flick:SetVisible(should_hide )
sliderint_flick:SetVisible(should_hide  and switch_flick:Get())
ttonkill:SetVisible(should_hide)
tickbase_indicator_color:SetVisible(should_hide  and tickbase_enable:Get() and keybinds_123:Get())
tickbase_enable:SetVisible(should_hide  and keybinds_123:Get())
welcome_back:SetVisible(should_hide)
info_lua:SetVisible(should_hide)
update_log:SetVisible(should_hide)
update_lua:SetVisible(should_hide)
discord_button:SetVisible(should_hide)
get_font:SetVisible(should_hide)
blur_background:SetVisible(should_hide and keybinds_123:Get() and select_ui_windows:GetInt()~=0)
snapelines:SetVisible(should_hide )
snapelines_color:SetVisible(should_hide  and snapelines:Get())


    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_add_l[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.r_limit[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.l_limit[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.inv_jitter[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.random[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.freestand_desync[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.desync_on_shot[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_modifier[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_modifier_degree[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1 and menu_elements.yaw_modifier[i]:Get()~=0)
        menu_elements.fake_options[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.lby_mode[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
    end

    menu_elements.switch:SetVisible(should_hide)
    anti_brute:adjust_abrute()
    externded_desync_switch:SetVisible(should_hide)
    dmg_marker:SetVisible(should_hide)
    dmg_marker_color:SetVisible(should_hide and dmg_marker:GetBool())
    d_switch:SetVisible(should_hide)
    d_min_damage:SetVisible(d_switch:Get())

end

local shot_data = {}

local hitsound = function()
    local IEngineSoundClient = ffi.cast("void***" , Utils.CreateInterface("engine.dll", "IEngineSoundClient003")) or error("Failed to find IEngineSoundClient003!")
    local play_sound_fn = ffi.cast("void(__thiscall*)(void*, const char*, float, int, int, float)",IEngineSoundClient[0][12])
    local play_sound = function (name , pitch , bitch)
        return play_sound_fn( IEngineSoundClient, name , pitch , bitch ,0,0)
    end
    
    handlers:subscribe("events", function(event)
        if not hitsound:Get() then return end
        if event:GetName()=="player_hurt" then
            if refs.hitsound:Get()==true then refs.hitsound:Set(false) end

            local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker", 0))
            local me = EntityList.GetLocalPlayer()
            local userid = event:GetInt("userid", 1)

            local player = EntityList.GetPlayerForUserID(userid)
            if me and attacker == me and player~= me and hitsound_list:Get()==0 then
               play_sound("buttons\\arena_switch_press_02.wav",  hitsound_vol:Get()/100 ,100)
            end
            if me and attacker == me and player~= me and hitsound_list:Get()==1 then
                play_sound("buttons\\hitsound.wav",  hitsound_vol:Get()/100 ,100)
            end

        end
    end)

    handlers:subscribe("destroy" , function()
        
        refs.hitsound:Set(true)
    
    end)

end

local function paint()
    if not dmg_marker:Get() then return end
    dmg_marker_windows:SetBool(false)
    local dmg_color_picker = dmg_marker_color:GetColor()
    for i=1, #shot_data do
        local shot = shot_data[i]
        if shot.draw then
            if shot.z >= shot.target then
                shot.alpha = shot.alpha - 1
            end
            if shot.alpha <= 0 then
                shot.draw = false
            end
            local wts = Render.WorldToScreen(Vector.new(shot.x, shot.y, shot.z))
            local sx, sy = wts.x, wts.y
            if sx ~= nil then
                Render.Text("-"..tostring(shot.damage), Vector2.new(sx, sy), Color.new(dmg_color_picker.r,dmg_color_picker.g,dmg_color_picker.b,shot.alpha/255), 12, font_logs, false)
            end
            shot.z = shot.z + 0.50
        end
    end
end

local function player_hurt(e)
    if not dmg_marker:Get() then return end
    dmg_marker_windows:SetBool(false)
    local attacker_entindex = EntityList.GetPlayerForUserID(e:GetInt("attacker"))
    local victim_entindex   =  EntityList.GetPlayerForUserID(e:GetInt("userid"))
    if attacker_entindex ~= EntityList.GetLocalPlayer() then
        return
    end

    local lol = victim_entindex:GetProp("m_vecOrigin")
    local x, y, z       = lol.x, lol.y, lol.z
    local duck_amount   = victim_entindex:GetProp("m_flDuckAmount")
    z = z + (46 + (1 - duck_amount) * 18)
    shot_data[#shot_data + 1] = {
        x       = x,
        y       = y,
        z       = z,
        target  = z + 25,
        damage  = e:GetInt('dmg_health'),
        alpha   = 255,
        draw    = true
    }
end

function round_start()
    shot_data = {}
end

handlers:subscribe('draw', paint)
handlers:subscribe('events', function(e)
    if e:GetName() == 'player_hurt' then player_hurt(e) end
    if e:GetName() == 'round_start' then round_start(e) end
end)

local was_in_backstab = false
mrefs = {
    yaw_add = Menu.FindVar( "Aimbot", "Anti Aim", "Main", "Yaw Add" ),
    yaw_base = Menu.FindVar( "Aimbot", "Anti Aim", "Main", "Yaw Base" ),
}

function anti_backstab(e)
    local players = EntityList.GetPlayers()
    local localplayer = EntityList.GetLocalPlayer()

    if not localplayer then return end

    local is_exists = false

    for i = 1, #players do
        local player = players[ i ]

        if player:IsTeamMate( ) or player:IsAlive( ) == false then
            goto skip
        end

        local enemy_weapon = player:GetActiveWeapon( )

        if not enemy_weapon then
            goto skip
        end

        if enemy_weapon:IsKnife( ) == false then
            goto skip
        end

        local origin = localplayer:GetProp( "m_vecOrigin" )
        local enemy_origin = player:GetProp( "m_vecOrigin" )

        if origin:DistTo( enemy_origin ) <= 200 then
            is_exists = true

            break
        end

        ::skip::
    end

    if is_exists == false then
        if was_in_backstab == true then
            mrefs.yaw_add:Set( 0 )
            was_in_backstab = false
        end

        return
    end

    if enable_antibackstab:Get() then
    mrefs.yaw_base:Set( 4 )
    mrefs.yaw_add:Set( 180 )
    was_in_backstab = true
    end
end


hitchance_conditions = Menu.MultiCombo("> Rage", "Other", "[-] Hitchance Conds", {"In Air", "Noscope"}, 0)
hitchance_in_air = Menu.SliderInt("> Rage", "Other", "Hitchance In Air", 0, 0, 100)
noscope_hitchance = Menu.SliderInt("> Rage", "Other", "Noscope Hitchance", 0,  0, 100)

function hitchance_conditions123()
    local ent = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if not ent then
        return
    end
    local player = ent:GetPlayer()
    if not player or not player:IsAlive() then
        return
    end
    if not EngineClient.IsConnected() then
        return
    end
    local local_player = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
    is_alive = local_player:GetProp("DT_BasePlayer", "m_iHealth") > 0
    if not is_alive then return end
    local active_weapon = local_player:GetActiveWeapon()
    if active_weapon == nil then return end
    local weapon_id = active_weapon:GetWeaponID()
    local players = EntityList.GetPlayers()
    local player = EntityList.GetLocalPlayer()
    local onGround = bit.band(local_player:GetProp("DT_BasePlayer", "m_fFlags"), bit.lshift(1,0)) ~= 0;
    local scoped = player:GetProp("m_bIsScoped");

    for _, player in ipairs(players) do
        if not player:IsTeamMate() then
            local user_index = player:EntIndex()
            if weapon_id == 40 and not onGround and hitchance_conditions:Get(1) then
                RageBot.OverrideHitchance(user_index, hitchance_in_air:GetInt())
            end

            if weapon_id == 11 or weapon_id == 38 and not scoped and hitchance_conditions:Get(2) then
                RageBot.OverrideHitchance(user_index, noscope_hitchance:GetInt())
            end
        end
    end
end

enable_clantag = Menu.Switch("> Misc", "Other", "[-] Melonity Clantag", false)

set_clan_tag_fn = ffi.cast("int(__fastcall*)(const char*, const char*)", Utils.PatternScan("engine.dll", "53 56 57 8B DA 8B F9 FF 15"))
set_clan_tag = function(tag)
    set_clan_tag_fn(tag, tag)
end

function build_tag(tag)
    local arr = {}

    for i = 1, #tag do
        arr[#arr+1] = tag:sub(1, i)
    end

    return arr
end

clantag = build_tag(" melonity ")

first1 = false

function tag()
    if not enable_clantag:Get() then
        if first1 then
            set_clan_tag("")
            first1 = false
        end
        return
    end

    first1 = true
    local curtime = math.floor(GlobalVars.curtime * 2)

    if old_time ~= curtime then
        set_clan_tag(clantag[curtime % #clantag + 1])
        old_time = curtime
    end
end

function disable_clantag()

    if first1 then
        set_clan_tag("")
        first1 = false
    end
end


function destroy()
    disable_clantag()
end

function prediction(args)   
   aa_main(args)
   teleport_in_air_dt()
   quickpeek_lua(args)
   abrute_pred()
   flick_on_prediction()
   anti_backstab(args)

end

function pre_pred(args)
    desync_on_use(args)
    edge(args)
    hitchance_conditions123()
end

function draw()
    debug_panel2()
    handle_vis()
    logs_notify()
    viewmodel_in_scope2()
    debug_panel()
    scope_line.on_draw()
   -- legbreaker()
   prediction_arrows()
    keybinds_draggable:update()
    drawlog()
    indicators_melonity2()
    melonity_main_indic()
    watermark()
    arrows_indicator()
    teamskeet_arrows()
    damage_indicator_dmg()
    render_dt_indicator()
    snape_lines()
    tag()
    in_menu()
end

function createmove(args)
    preferbaim()
end

handlers:subscribe("createmove", createmove)
handlers:subscribe("destroy", destroy)

handlers:subscribe("destroy", scope_line.on_destroy)

handlers:subscribe("pre_prediction", pre_pred)
handlers:subscribe("prediction", prediction)
handlers:subscribe("draw", draw)
hitsound()
dormant_aimbot()

starthooks()
 
Эксперт
Статус
Оффлайн
Регистрация
14 Ноя 2020
Сообщения
1,796
Реакции[?]
586
Поинты[?]
2K
Hellfish#9343

Код:
local info = [[

    ███╗░░░███╗███████╗██╗░░░░░░█████╗░███╗░░██╗██╗████████╗██╗░░░██╗
    ████╗░████║██╔════╝██║░░░░░██╔══██╗████╗░██║██║╚══██╔══╝╚██╗░██╔╝
    ██╔████╔██║█████╗░░██║░░░░░██║░░██║██╔██╗██║██║░░░██║░░░░╚████╔╝░
    ██║╚██╔╝██║██╔══╝░░██║░░░░░██║░░██║██║╚████║██║░░░██║░░░░░╚██╔╝░░
    ██║░╚═╝░██║███████╗███████╗╚█████╔╝██║░╚███║██║░░░██║░░░░░░██║░░░
    ╚═╝░░░░░╚═╝╚══════╝╚══════╝░╚════╝░╚═╝░░╚══╝╚═╝░░░╚═╝░░░░░░╚═╝░░░
   
    ░██████╗░█████╗░██╗░░░░░██╗░░░██╗████████╗██╗░█████╗░███╗░░██╗░██████╗
    ██╔════╝██╔══██╗██║░░░░░██║░░░██║╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
    ╚█████╗░██║░░██║██║░░░░░██║░░░██║░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
    ░╚═══██╗██║░░██║██║░░░░░██║░░░██║░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
    ██████╔╝╚█████╔╝███████╗╚██████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
    ╚═════╝░░╚════╝░╚══════╝░╚═════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░


Our Website - https://melonity.solutions
Our Shoppy - https://shoppy.gg/@melonity
Our Discord - https://discord.gg/UAuh9Y9gMG
Best Private Servers - https://ghosty.company
Best League - https://discord.gg/ghosty]]
local build = "Beta"
local version = "0.1.3"
local lua_name = "Melonity Beta - "
local update = [[- Added "Chat Logs" with color.

[+] - Functions that need a binding

[-] - Functions that don't need a binding

[~] - Of your choice ]]
EngineClient.ExecuteClientCmd("clear")
print(info)

local cur_shot = 0
local logs = {}
local username = Cheat.GetCheatUserName()
local should_hide = true

welcome_back = Menu.Text("--> Global", "Info", "Welcome Back, " ..username.."")
info_lua = Menu.Text("--> Global", "Info", "Current build: " .. build .."")
update_log = Menu.Text("--> Global", "Info", "Update Log: ")
update_lua = Menu.Text("--> Global", "Info", update)



local helpers = {
    set_visibility = function(array, visibility, iskluchenie)
        for i, element in pairs(array) do
            if iskluchenie and i == iskluchenie then
                goto continue
            end
            element:SetVisible(visibility)
            ::continue::
        end
    end,
    round = function(x)
        return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
    end,
    lerp = function(start, end_pos, time)
        time = GlobalVars.frametime * (time * 175)
        if time < 0 then
            time = 0.01
        elseif time > 1 then
            time = 1
        end
        local delta = end_pos - start
        delta = delta * time
        delta = delta + start
        return delta
    end,
    HSVToRGB = function(h, s, v)
        local r, g, b

        local i = math.floor(h * 6);
        local f = h * 6 - i;
        local p = v * (1 - s);
        local q = v * (1 - f * s);
        local t = v * (1 - (1 - f) * s);

        i = i % 6

        if i == 0 then
            r, g, b = v, t, p
        elseif i == 1 then
            r, g, b = q, v, p
        elseif i == 2 then
            r, g, b = p, v, t
        elseif i == 3 then
            r, g, b = p, q, v
        elseif i == 4 then
            r, g, b = t, p, v
        elseif i == 5 then
            r, g, b = v, p, q
        end

        return Color.new(r, g, b, 1)
    end,
    get_entity_address = function(entity_index)
        local addr = GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER, entity_index)
        return addr
    end,
    is_entity_alive = function(entity)
        if not entity then
            return false
        end
        local hp = entity:GetProp("m_iHealth")
        if not hp then
            return false
        end
        return entity:GetProp("m_iHealth") > 0
    end
}

local ui_array = {

}

local ofuncs = {
    {"Switch" , Menu.Switch},
    {"Combo" , Menu.Combo},
    {"ColorEdit" , Menu.ColorEdit},
    {"MultiCombo" , Menu.MultiCombo},
    {"SliderInt" , Menu.SliderInt},
    {"TextBox" , Menu.TextBox},
}

for i=1 , #ofuncs do
    Menu[ofuncs[i][1]] = function(tab, name,...) --mega iq fix for messy code
        local res = ofuncs[i][2](tab,name,...)
        if not ui_array[tab] then ui_array[tab] = {} end
        ui_array[tab][name] =  res
        return res
    end
end

local discord_button = Menu.Button("--> Global","Info", "Discord Server", "Join to our Discord Server", function()
    local panorama_handle = Panorama.Open(); local discord = panorama_handle.SteamOverlayAPI.OpenExternalBrowserURL("https://discord.gg/UAuh9Y9gMG")
end)

local ffi = require("ffi")

ffi.cdef[[
    bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes);
    void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);

    bool DeleteUrlCacheEntryA(const char* lpszUrlName);
]]
local urlmon = ffi.load 'UrlMon'
local wininet = ffi.load 'WinInet'

local function Download(from, to)
    wininet.DeleteUrlCacheEntryA(from)
    urlmon.URLDownloadToFileA(nil, from, to, 0,0)
end

local function CreateDir(path)
    ffi.C.CreateDirectoryA(path, NULL)
end

local get_font = Menu.Button("--> Global", "Info", "Download Files", "Download Files", function()
    CreateDir("nl\\Melonity Solutions\\")
    CreateDir("nl\\Melonity Solutions\\fonts")
    Download('https://api.melonity.solutions/bullet.ttf', 'nl\\Melonity Solutions\\fonts\\bullet.ttf')
    Download('https://api.melonity.solutions/smallest_pixel-7.ttf', 'nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf')
    Download('https://api.melonity.solutions/Acta_Symbols_W95_Arrows.ttf', 'nl\\Melonity Solutions\\fonts\\Acta_Symbols_W95_Arrows.ttf')
    CreateDir("csgo\\sound\\buttons\\")
    Download('https://api.melonity.solutions/skeet.wav', 'csgo\\sound\\buttons\\hitsound.wav')
    Cheat.AddNotify("Melonity Solutions" , "Files have been successfully installed. Reload the script.")
    end)


local function color(r,g,b,a)
    if not a then a = 255 end
    if not b then b = 0 end
    return Color.new(r/255,g/255,b/255,a/255)
end

local refs = {
    dt = Menu.FindVar("Aimbot", "Ragebot", "Exploits", "Double Tap"),
    yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    hs = Menu.FindVar("Aimbot", "Ragebot", "Exploits", "Hide Shots"),
    fd = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Fake Duck"),
    sw = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Slow Walk"),
    left_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Left Limit"),
    lbymode = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "LBY Mode"),
    right_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Right Limit"),
    fakeopt = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Fake Options"),
    invert = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Inverter"),
    baim = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"),
    safe = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Safe Points"),
    free_dsy = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Freestanding Desync"),
    shot_dsy = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Desync On Shot"),
    yaw_b = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    yaw_add = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Add"),
    desync = Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Enable Fake Angle"),
    yaw_mod = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Modifier"),
    yaw_mod_deg = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Modifier Degree"),
    peek = Menu.FindVar("Miscellaneous", "Main", "Movement", "Auto Peek"),
    stop = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Conditions"),
    fl_limit = Menu.FindVar("Aimbot", "Anti Aim", "Fake Lag", "Limit"),
    hitsound = Menu.FindVar("Visuals" , "World" , "Hit" , "Hit Sound"),
    wind = Menu.FindVar("Miscellaneous", "Main", "Other", "Windows"),
    logs = Menu.FindVar("Miscellaneous", "Main", "Other", "Event Log"),
    antiaimmodes = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base"),
    autopeekforlua = Menu.FindVar("Miscellaneous","Main","Movement","Auto Peek"),
    sp = Menu.FindVar("Aimbot","Ragebot","Misc","Safe Points"),
    damage_override_count = Menu.FindVar("Aimbot","Ragebot","Accuracy","Minimum Damage"),
    hc = Menu.FindVar("Aimbot", "Ragebot","Accuracy" ,"Hit Chance"),
}

local importants = {
    hitboxes = {"generic", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "?"},
}

local menu_elements = {
    teleport_in_air = Menu.Switch("> Rage", "Main", "[-] Teleport In Air", false),
    teleport_weapons = Menu.MultiCombo("> Rage", "Main", "Select Weapons", {"Scout", "AWP", "Pistols", "Zeus", "Knife", "Nades", "Other"}, 0),
    anti_defensive = Menu.Switch("> Rage", "Main", "[-] Enable Anti-Defensive", false, "Automatic Anti-Defensive"),
    custom_aa = Menu.Switch("> Anti Aim", "Main", "[-] Enable Custom AA", false, "You can configure Anti Aim how you want"),
    BodyDT = Menu.Switch("> Rage", "Other", "[-] Prefer body on DT", false, "Force Body on DT"),
    custom_type = Menu.Combo("> Anti Aim", "Main" , "AA Type" , {"Custom" , "Preset"} , 1),
    custom_presets = Menu.Combo("> Anti Aim", "Main", "Preset" , {"None" , "Alternative" , "Ideal Yaw" , "Hybrid", "LordwaVe", "KitKat"} , 0),
    custom_cond = Menu.Combo("> Anti Aim", "Custom Anti Aim" , "Configure for" , {"Stand" , "Slow Walk" , "Move" , "Air", "Crouch"} , 0),
    yaw_add_r = {},
    yaw_add_l = {},
    r_limit = {},
    l_limit = {},
    inv_jitter = {},
    random = {},
    freestand_desync = {},
    desync_on_shot = {},
    yaw_modifier = {},
    yaw_modifier_degree = {},
    fake_options = {},
    lby_mode = {},
    switch = Menu.Switch("> Anti-Bruteforce", "Main" , "[-] Enable Anti-Bruteforce" , false),
}

for i=1 , 5 do
    local text = i==1 and "[S] " or i==2 and "[SW] " or i==3 and "[M] " or i==4 and "[A] " or "[C] "
    menu_elements.yaw_add_r[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , ""..text.."Yaw Add Right" , 0 , -180 , 180)
    menu_elements.yaw_add_l[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , ""..text.."Yaw Add Left" , 0 , -180 , 180)
    menu_elements.yaw_modifier[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Yaw Modifier", {"Disabled", "Center", "Offset", "Random", "Spin"}, 0, "")
    menu_elements.yaw_modifier_degree[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Modifier Degree" , 0 , -180 , 180)
    menu_elements.r_limit[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Right Limit" , 60 , 0 , 60)
    menu_elements.l_limit[i] = Menu.SliderInt("> Anti Aim", "Custom Anti Aim" , text.."Left Limit" , 60 , 0 , 60)
    menu_elements.inv_jitter[i] = Menu.Switch("> Anti Aim", "Custom Anti Aim" , text.."Invert Jitter" , false)
    menu_elements.random[i] = Menu.Switch("> Anti Aim", "Custom Anti Aim" , text.."Randomize" , false)
    menu_elements.freestand_desync[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Freestand Desync", {"Off", "Peek Fake", "Peek Real"}, 0, "")
    menu_elements.desync_on_shot[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."Desync On Shot", {"Disabled", "Opposite", "Freestanding", "Switch"}, 0, "")
    menu_elements.fake_options[i] = Menu.MultiCombo("> Anti Aim", "Custom Anti Aim" , text.."Fake Options", {"Avoid Overlap", "Jitter", "Randomize Jitter", "Anti Bruteforce"}, 0)
    menu_elements.lby_mode[i] = Menu.Combo("> Anti Aim", "Custom Anti Aim" , text.."LBY Mode", {"Disabled", "Opposite", "Sway"}, 0, "")
end
local aa_links = {
    Menu.FindVar( "Aimbot", "Anti Aim", "Fake Angle", "Freestanding Desync" ),
    Menu.FindVar( "Aimbot", "Anti Aim", "Fake Angle", "Desync On Shot" ),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Modifier"),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Modifier Degree"),
    Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Add"),
    Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "Fake Options"),
    Menu.FindVar("Aimbot", "Anti Aim", "Fake Angle", "LBY Mode"),
}

local handlers = {
    callbacks = {},
    subscribe = function(self, callback, funct)
        local isExists = false
        for i = 1, #self.callbacks do
            if self.callbacks[i].callback == callback then
                isExists = true
                break
            end
        end
        if not isExists then
            table.insert(self.callbacks, {callback = callback, functions = {}})
            isExists = true
        end
        for i = 1, #self.callbacks do
            if self.callbacks[i].callback == callback then
                table.insert(self.callbacks[i].functions, funct)
                break
            end
        end

        self:update()
    end,
    update = function(self)
        for i = 1, #self.callbacks do
            local function run(...)
                for j = 1, #self.callbacks[i].functions do
                    self.callbacks[i].functions[j](...)
                end
            end
            Cheat.RegisterCallback(self.callbacks[i].callback, run)
        end
    end
}


local function preferbaim()
   
       
    if not menu_elements.BodyDT:GetBool() then return end
    if Exploits:GetCharge() == 1 then
        Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"):SetInt(1)
    else
        Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"):SetInt(0)
    end
   
end

enable_indicators = Menu.Switch("> Visuals", "Main", "[-] Enable Indicators", false)
indicators_list = Menu.Combo("> Visuals", "Main" , "Indicators type" , {"Disabled", "Melonity", "Melonity 2.0"} , 0)

local color123456 = Menu.ColorEdit("> Visuals", "Main", "Main Color", Color.RGBA(185, 129, 235, 255))
local indic2_color = Menu.ColorEdit("> Visuals", "Main" , "Text Color" , Color.RGBA(185, 129, 235, 255))

arrows_type = Menu.Combo("> Visuals", "Main", "Arrows Type", {"Disabled", "Default", "Team Skeet", "Prediction"}, 0)

local font = Render.InitFont("Verdana", 12)

local normalize_yaw = function(yaw)
    while yaw > 180 do yaw = yaw - 360 end
    while yaw < -180 do yaw = yaw + 360 end
    return yaw
end

local import = Menu.Button("--> Global", "Config System", "Import Config", "Import config from clipboard")
local export = Menu.Button("--> Global", "Config System", "Export Config", "Export config to clipboard")
local load_def = Menu.Button("--> Global", "Config System", "Load Default Config", "Load Default config")


load_def:RegisterCallback(function()
    menu_elements.BodyDT:SetBool(true)
    menu_elements.teleport_in_air:SetBool(true)
    menu_elements.teleport_weapons:SetInt(1)
    menu_elements.custom_aa:SetBool(true)
    menu_elements.custom_type:SetInt(1)
    menu_elements.custom_presets:SetInt(4)
    legit_aa:SetBool(true)
    enable_indicators:SetBool(true)
    indicators_list:SetInt(1)
    enable_debug_panel:SetBool(true)
    keybinds_123:SetBool(true)
    select_ui_windows:SetInt(1)
    ui_themes:SetInt(3)
    enable_logs:SetBool(true)
    type2_of_logs:SetInt(1)
    type3_of_logs:SetInt(2 and 3)
    hitsound:SetBool(true)
    hitsound_vol:SetInt(100)
    d_switch:SetBool(true)
    d_min_damage:SetInt(1)
    enable_animation_breaker:SetBool(true)
    animation_breaker:SetInt(2 and 3)
    blur_background:SetBool(true)
    ttonkill:SetBool(true)
   
   
    Cheat.AddNotify("Melonity Solutions" , "Default Config successfully loaded")
    end)

local arrows_color = Menu.ColorEdit("> Visuals", "Main" , "Arrows Color" , Color.RGBA(185, 129, 235, 255))

function arrows_indicator()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==1 then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    local w = 25;
    local bgGap = 4;
    local player = EntityList.GetLocalPlayer();  
    local lifeState = player:GetProp("m_lifeState");
    local screen_size = EngineClient:GetScreenSize()
    local x = screen_size.x / 2;
    local y = screen_size.y / 2;
    local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
    local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
    local screen_size_middle3 = Vector2.new(screen_size.x / 2 + 59, screen_size.y / 2 - 11);
    local screen_size_middle4 = Vector2.new(screen_size.x / 2 - 68, screen_size.y / 2 - 11);
    local real_rotation = AntiAim.GetCurrentRealRotation();
    local desync_rotation = AntiAim.GetFakeRotation();
    local desync_delta = real_rotation - desync_rotation
    local yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base");
    local inverter_state = AntiAim.GetInverterState() == true
    local add_y = 0;
    if not player then return end  
    if not lifeState then
    if inverter_state then
        Render.Text(">", screen_size_middle, Color.new(1,1,1,1), 22, false) -- arrows_color:GetColor()
        Render.Text("<", screen_size_middle2, arrows_color:GetColor(), 22, false) -- Color.new(1,1,1,1)
        if  yawbase:Get() == 2  then
            Render.Text(">", screen_size_middle3, arrows_color:GetColor(), 22, false)
        end    
    else
        Render.Text(">", screen_size_middle,  arrows_color:GetColor(), 22, false)
        Render.Text("<", screen_size_middle2, Color.new(1,1,1,1), 22, false)
        if yawbase:Get() == 3 then
            Render.Text("<", screen_size_middle4, arrows_color:GetColor(), 22, false)
        end
    end
    end
end
end
end

local screen_size = EngineClient:GetScreenSize()
local x = screen_size.x / 2;
local y = screen_size.y / 2;
local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
local font_arrows = Render.InitFont("nl\\Melonity Solutions\\fonts\\Acta_Symbols_W95_Arrows.ttf", 55, {' '} )

function prediction_arrows()
    local player = EntityList.GetLocalPlayer();

    if not player then return end
    local lifeState = player:GetProp("m_lifeState");
    if not lifeState then
    if not enable_indicators:Get() then return end  
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==3 then
    local inverter_state = AntiAim.GetInverterState() == true
    if inverter_state then
        Render.Text("x", screen_size_middle, Color.new(255,255,255,255), 22, font_arrows, false)
        Render.Text("w", screen_size_middle2, arrows_color:GetColor(), 22, font_arrows, false)
    else
       Render.Text("x", screen_size_middle, arrows_color:GetColor(), 22, font_arrows, false)
        Render.Text("w", screen_size_middle2, Color.new(255,255,255,255), 22, font_arrows, false)
    end
end
end
end

end


local arrows_inverted_color = Menu.ColorEdit("> Visuals", "Main" , "Inverted Arrows Color" , Color.RGBA(255, 255, 255, 255))

function teamskeet_arrows()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()~=1 then
    if arrows_type:Get()==2 then
        local w = 25;
        local bgGap = 4;
        local screen_size = EngineClient:GetScreenSize()
        local x = screen_size.x / 2;
        local y = screen_size.y / 2;
        local screen_size_middle = Vector2.new(screen_size.x / 2 + 49, screen_size.y / 2 - 11);
        local screen_size_middle2 = Vector2.new(screen_size.x / 2 - 58, screen_size.y / 2 - 11);
        local screen_size_middle3 = Vector2.new(screen_size.x / 2 + 59, screen_size.y / 2 - 11);
        local screen_size_middle4 = Vector2.new(screen_size.x / 2 - 68, screen_size.y / 2 - 11);
        local real_rotation = AntiAim.GetCurrentRealRotation();
        local desync_rotation = AntiAim.GetFakeRotation();
        local desync_delta = real_rotation - desync_rotation
        local yawbase = Menu.FindVar("Aimbot", "Anti Aim", "Main", "Yaw Base");
        local inverter_state = AntiAim.GetInverterState() == true
        local player = EntityList.GetLocalPlayer();

        if not player then return end
   
        local lifeState = player:GetProp("m_lifeState");
        if not lifeState then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    if inverter_state then
        Render.BoxFilled(Vector2.new(x - 48, y - 10), Vector2.new(x - 46, y + 9), arrows_inverted_color:GetColor())
        Render.BoxFilled(Vector2.new(x + 49, y - 10), Vector2.new(x + 47, y + 9), Color.new(0, 0, 0, 0.3))
    else
        Render.BoxFilled(Vector2.new(x + 49, y - 10), Vector2.new(x + 47, y + 9), arrows_inverted_color:GetColor())
        Render.BoxFilled(Vector2.new(x - 48, y - 10), Vector2.new(x - 46, y + 9), Color.new(0, 0, 0, 0.3))
    end
    if yawbase:Get() == 2 then
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(arrows_color:GetColor(), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    elseif yawbase:Get() == 3 then          
        Render.PolyFilled(arrows_color:GetColor(), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    else
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x - 50, y - 10), Vector2.new(x - 50, y + 9), Vector2.new(x - 66, y))
        Render.PolyFilled(Color.new(0, 0, 0, 0.3), Vector2.new(x + 52, y - 10), Vector2.new(x + 52, y + 9), Vector2.new(x + 66, y))
    end
end
end
end
end

local is_dmg_override = false
local pixel = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)

function desync_delta()
    local desync_rotation = AntiAim.GetFakeRotation()
    local real_rotation = AntiAim.GetCurrentRealRotation()
    local delta_to_draw = math.min(math.abs(real_rotation - desync_rotation) / 2, 60)
    return string.format("%.1f", delta_to_draw)
end

local fake = desync_delta()
local currentTime = GlobalVars.curtime

local font = Render.InitFont("Verdana", 12)

enable_debug_panel = Menu.Switch("> Visuals", "Main" , "[-] Enable debug panel" , false)
list_debug_panel = Menu.Combo("> Visuals", "Main", "Select Debug Panel", {"Default", "Old"}, 0)

local last_spamd = GlobalVars.tickcount;
local islegitaa = 0;

local function calcDist(target1, target2)
    local lx = target1.x;
    local ly = target1.y;
    local lz = target1.z;
    local tx = target2.x;
    local ty = target2.y;
    local tz = target2.z;
    local dx = lx - tx;
    local dy = ly - ty;
    local dz = lz - tz;
    return math.sqrt(dx * dx + dy * dy + dz * dz);
end

local huy = false
local legit_aa_on = false
local dist = 0
function hostage_check(getplayer)
    local ents = EntityList.GetEntitiesByClassID(97)
    local lp_pos = getplayer:GetRenderOrigin()
    for i = 1, #ents do
        if ents[i] ~= nil then
            local ent = ents[i]
            local origin = ent:GetRenderOrigin()
            local dist = lp_pos:DistTo(origin)
            if dist < 64 then
                return false
            end
        end

    end
    return true
end

function bomb_check(me)
    local weap = me:GetActiveWeapon()
    if weap ~= nil then
        if weap:GetClassId() == 34 then
            return false
        else
            return true
        end
    else
        return false
    end
end

function defuse_check(getplayer)
    local ents = EntityList.GetEntitiesByClassID(129)
    local lp_pos = getplayer:GetRenderOrigin()
    for i = 1, #ents do
        if ents[i] ~= nil then
            local ent = ents[i]
            local origin = ent:GetRenderOrigin()
            local dist = lp_pos:DistTo(origin)
            if dist < 100 then
                return false
            end
        end

    end
    return true
end

local anti_brute = {
    working = false,
    num_phases = Menu.SliderInt("> Anti-Bruteforce", "Anti-Bruteforce" , "" , 2 , 2 , 10),
    cur_phase = 0,
    timer = 0,
    phases = {},


    adjust_abrute = function(self)
        local n = self.num_phases:Get()
        local b = menu_elements.switch:Get()
        self.add_phase:SetVisible(b)
        self.remove_phase:SetVisible(b)
        for i=1 , 10 do
            self.phases[i]:SetVisible(i-1<n and b)
        end
    end
}

for i=1 , 10 do
    anti_brute.phases[i] = Menu.SliderInt("> Anti-Bruteforce", "Anti-Bruteforce" , "Phase "..i , 60 , -60 , 60)
end

anti_brute.num_phases:SetVisible(false)

anti_brute.add_phase = Menu.Button("> Anti-Bruteforce", "Anti-Bruteforce" , "Add Phase" , "" , function()





    if anti_brute.num_phases:Get() > 9 then
        Cheat.AddNotify("Melonity Solutions" , "Cannot add more phases")
        return
    end


    anti_brute.num_phases:Set( anti_brute.num_phases:Get() +1)
    anti_brute:adjust_abrute()
end)

anti_brute.remove_phase = Menu.Button("> Anti-Bruteforce", "Anti-Bruteforce" , "Remove Phase" , "" , function()
    if anti_brute.num_phases:Get() < 3 then
        Cheat.AddNotify("Melonity Solutions" , "Cannot remove more phases")
        return
    end

    anti_brute.num_phases:Set( anti_brute.num_phases:Get() -1)
    anti_brute:adjust_abrute()
end)

menu_elements.switch:RegisterCallback(function() anti_brute:adjust_abrute() end)
anti_brute:adjust_abrute()

local externded_desync_switch = Menu.Switch("> Anti Aim", "Main", "[~] Extended Desync" , false)
handlers:subscribe("prediction" , function(cmd)
    if not externded_desync_switch:Get() then return end

    if  refs.sw:Get() or  EntityList.GetLocalPlayer():GetProp("m_vecVelocity"):Length() <20 then

    local side = AntiAim.GetInverterState() and 1 or -1
    cmd.viewangles.roll = 44 * side
    end
end)

function indicators_melonity2()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()==2 then
    local player = EntityList.GetLocalPlayer();

    if not player then return end

    local lifeState = player:GetProp("m_lifeState");
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    local indic2_color2 = indic2_color:GetColor()
    local x = EngineClient.GetScreenSize().x+8
    local y = EngineClient.GetScreenSize().y

    if AntiAim.GetInverterState() == false then
        invert ="R"
    else
        invert ="L"
    end

    local  is_dmg_override = false
    local binds = Cheat.GetBinds()
    for i=1, #binds do
        local bind = binds[i]
        if bind:IsActive() then
            if bind:GetName()=="Minimum Damage" then
                is_dmg_override = true
            end
        end
    end

    if currentTime + 0.38 < GlobalVars.curtime then
        currentTime = GlobalVars.curtime
        fake = desync_delta()
    end

    local function clamp(val, min, max) if val > max then return max end if min > val then return min end return val end
    local real_rotation = AntiAim.GetCurrentRealRotation();
    local desync_rotation = AntiAim.GetFakeRotation();
    local  desync_delta = clamp(math.floor(math.abs(real_rotation - desync_rotation)) , 0 , 58)

    local ay = 20
    local alpha = math.min(math.floor(math.sin((GlobalVars.realtime%3) * 2) * 190 + 60), 255)

    if not player then return end
    if not lifeState then
    local eternal_ts = Render.CalcTextSize("MELONI ", 10, pixel)
    Render.Text("MELONITY", Vector2.new(x/2, y/2+ay), indic2_color2, 10, pixel, true)
    Render.Text("BETA", Vector2.new(x/2+eternal_ts.x+6, y/2+ay), Color.RGBA(255, 255, 255, alpha), 10, pixel, true)
    ay = ay + 10.5
   
    local text_ =""
    local clr0 = Color.RGBA(0, 0, 0, 0)
    if refs.sw:GetBool() then
        text_ ="LAVELAS MODE: "
        clr0 = Color.RGBA(255, 50, 50, 255)
    else
        text_ ="DYNAMIC: "
        clr0 = Color.RGBA(130, 130, 255, 255)
    end


    local d_ts = Render.CalcTextSize(text_, 10, pixel)
    Render.Text(text_, Vector2.new(x/2, y/2+ay), clr0, 10, pixel, true)
    Render.Text(desync_delta.."°", Vector2.new(x/2+d_ts.x, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
    ay = ay + 10.5
   

    local fake_ts = Render.CalcTextSize("FAKE YAW: ", 10, pixel)
    Render.Text("FAKE YAW:", Vector2.new(x/2, y/2+ay), Color.RGBA(185, 129, 235, 255), 10, pixel, true)
    Render.Text(invert, Vector2.new(x/2+fake_ts.x, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
    ay = ay + 10.5

    local asadsa = math.min(math.floor(math.sin((Exploits.GetCharge()%2) * 1) * 122), 100)
        if refs.dt:GetBool() then
            Render.Text("DT", Vector2.new(x/2, y/2+ay), Exploits.GetCharge() == 1 and Color.RGBA(0, 255, 0, 255) or Color.RGBA(255, 0, 0, 255), 10, pixel, true)
            ay = ay + 10.5
    end


    if is_dmg_override then
        Render.Text("DMG: "..tostring(refs.damage_override_count:Get()), Vector2.new(x/2, y/2+ay), Color.RGBA(255, 255, 255, 255), 10, pixel, true)
        ay = ay + 10.5
    end

    local ax = 0
    if refs.hs:GetBool() then
        Render.Text("HS", Vector2.new(x/2, y/2+ay), Color.RGBA(250, 173, 181, 255), 10, pixel, true)
        ay = ay + 10.5
    end

    Render.Text("BAIM", Vector2.new(x/2, y/2+ay), refs.baim:Get() == 2 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("BAIM ", 10, pixel).x

    Render.Text("SP", Vector2.new(x/2+ax, y/2+ay), refs.sp:Get() == 2 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("SP ", 10, pixel).x

    Render.Text("FS", Vector2.new(x/2+ax, y/2+ay), refs.yaw_b:Get() == 5 and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
    ax = ax + Render.CalcTextSize("FS ", 10, pixel).x

    Render.Text("RL", Vector2.new(x/2+ax, y/2+ay), externded_desync_switch:Get() and Color.RGBA(255, 255, 255, 255) or Color.RGBA(255, 255, 255, 128), 10, pixel, true)
end
end
end

function melonity_main_indic()
    if not enable_indicators:GetBool() then return end
    if indicators_list:Get()==1 then
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if lp == nil then return end
    local invert = AntiAim.GetInverterState() == true
    local x = EngineClient.GetScreenSize().x/2
    local y = EngineClient.GetScreenSize().y/2
    local ay = 23
    local delta = math.abs(normalize_yaw(AntiAim.GetCurrentRealRotation() % 360 - AntiAim.GetFakeRotation() % 360)) / 2
    local clr = Color.new(color123456:GetColor().r, color123456:GetColor().g, color123456:GetColor().b, 0)
    local clr1 = Color.new(color123456:GetColor().r, color123456:GetColor().g, color123456:GetColor().b, 1)
    local Render_Indicator = function(text, ay2, color, size, font)
        ts = Render.CalcTextSize(text, size, font)
        Render.Text(text, Vector2.new(x-ts.x/2+4, y+ay2+1), Color.RGBA(0,0,0,255), size, font)
        Render.Text(text, Vector2.new(x-ts.x/2+3, y+ay2), Color.RGBA(255,255,255,255), size, font)
    end
    if lp:GetPlayer():IsAlive() then
        local z = Render.CalcTextSize(">", 24)
        Render.Text(">", Vector2.new(x + 38, y - z.y/2), invert and Color.RGBA(255,255,255,255) or clr1, 23, true)
        Render.Text("<", Vector2.new(x - z.x - 38, y - z.y/2), invert and clr1 or Color.RGBA(255,255,255,255), 23, true)


        Render_Indicator(math.floor(delta).."°", ay, Color.RGBA(255,255,255,255), 12, font)

        Render.GradientBoxFilled(Vector2.new(x-math.floor(delta), y+36), Vector2.new(x, y+39), clr, clr1, clr, clr1)
        Render.GradientBoxFilled(Vector2.new(x+math.floor(delta), y+36), Vector2.new(x, y+39), clr, clr1, clr, clr1)

        local local_player = EngineClient.GetLocalPlayer()
        local player = EntityList.GetClientEntity(local_player)
        local is_moving = #(EntityList.GetLocalPlayer():GetProp("m_vecVelocity"))>5
        if not player then
            return
        end

        local flags = player:GetProp("m_fFlags")
       
        local aa_state = "STANDING"
        if is_moving then
            aa_state = "MOVING"
        end
       
        if (flags == 256) then
            aa_state = "AIR"
        end

        if player:GetProp("m_flDuckAmount") > 0.9 then
            aa_state = "CROUCHING"  
        end

        if refs.sw:GetBool() then
            aa_state = "SLOW-WALKING"
        end

        if externded_desync_switch:Get() then
            aa_state = "ROLL AA"
        end

        Render_Indicator("Melonity - ".. aa_state .."", ay+22, Color.RGBA(255,255,255,255), 12, font)
    end
end
end


enable_antibackstab = Menu.Switch("> Anti Aim", "Main", "[~] Anti-Backstab", false)


switch_flick = Menu.Switch("> Anti Aim", "Other", "[~] Fake Flick", false)
sliderint_flick = Menu.SliderInt("> Anti Aim", "Other", "Fake Flick Delta", 90, 35, 120, "")

local a = 0.0;
local b = true;
local flick_on_prediction = function()
    if not switch_flick:Get() or not EntityList.GetLocalPlayer() or EntityList.GetLocalPlayer():GetProp('m_vecVelocity'):Length2D() > 5 or bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1) == 0 then return end

    if GlobalVars.realtime - a >= 0.22 + (b and 0.01 or -0.01) then
        AntiAim.OverrideYawOffset(sliderint_flick:Get() * (AntiAim.GetInverterState() and -1 or 1));
        a = GlobalVars.realtime;
        b = not b;
    end
end

enable_animation_breaker = Menu.Switch("> Anti Aim", "Other", "[~] Enable Animation Breaker", false, "Your animations will be broken")
animation_breaker = Menu.MultiCombo("> Anti Aim", "Other", "Select Breaker", {"Static legs in air", "Leg Breaker" , "Pitch 0 on land"}, 0)

legit_aa = Menu.Switch("> Anti Aim", "Main", "[~] Anti-Aim on Use", false, "Working 'E', Bomb Planting and etc")

local function normalize_angle(angle)
    if angle < -180 then angle = angle + 360 end
    if angle > 180 then angle = angle - 360 end
    return angle
end

local checks = {false , false , false , false}
local jit = 1
handlers:subscribe("pre_prediction" , function()
   
    if FakeLag.SentPackets() ~= 0 then
        jit = jit * -1
    end
   

end )

function aa_main(args)
    if not menu_elements.custom_aa:Get() or legit_aa_on or edge_on or anti_brute.working then return end
    local localplayer = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
    local getplayer = localplayer:GetPlayer()
    local localplayer_velocity = Vector.new(localplayer:GetProp( "m_vecVelocity[0]") , localplayer:GetProp("m_vecVelocity[1]")  , localplayer:GetProp( "m_vecVelocity[2]") )
    local localplayer_speed =math.ceil(localplayer_velocity:Length2D())
    local lp = EntityList.GetLocalPlayer()
    local crouch_check = lp:GetProp("m_flDuckAmount") > 0.89 and not refs.fd:Get()
    local stand_check = localplayer_speed<10
    local preset = menu_elements.custom_presets
    local air_check = bit.band(getplayer:GetProp("m_fFlags") , 1 ) == 0
    local sw_check = refs.sw:Get() or refs.sw:Get()
    local move_check = not sw_check and not air_check and not stand_check and not crouch_check
    checks = {stand_check , sw_check , move_check , air_check, crouch_check}
   -- if menu_elements.custom_type:Get()==0 then
    for i=1 , 5 do
        if checks[i] then
            local yaw_add = AntiAim.GetInverterState() and menu_elements.yaw_add_r[i]:Get() or menu_elements.yaw_add_l[i]:Get()
            AntiAim.OverrideLimit(menu_elements.random[i]:Get() and Utils.RandomInt(25, 45) or  refs.invert:Get() and menu_elements.l_limit[i]:Get() or menu_elements.r_limit[i]:Get() )
            if menu_elements.inv_jitter[i]:Get() and not menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(jit == 1 )
            elseif menu_elements.inv_jitter[i]:Get() and  menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(Utils.RandomInt(0, 100)%2==0 )
            elseif  menu_elements.random[i]:Get() then
                AntiAim.OverrideInverter(refs.invert:Get() )
            end
            aa_links[1]:Set( menu_elements.freestand_desync[i]:Get() )
            aa_links[2]:Set( menu_elements.desync_on_shot[i]:Get() )
            aa_links[3]:Set( menu_elements.yaw_modifier[i]:Get() )
            aa_links[4]:Set( menu_elements.yaw_modifier_degree[i]:Get() )
            aa_links[5]:Set( yaw_add )
            aa_links[6]:Set( menu_elements.fake_options[i]:Get() )
            aa_links[7]:Set( menu_elements.lby_mode[i]:Get() )
        end
    end
-- end

    if menu_elements.custom_type:Get()==1 then
        if preset:Get()==0 then
            for i=1 , 5 do
                menu_elements.yaw_add_r[i]:SetInt(0)
                menu_elements.yaw_add_l[i]:SetInt(0)
                menu_elements.r_limit[i]:SetInt(60)
                menu_elements.l_limit[i]:SetInt(60)
                menu_elements.inv_jitter[i]:SetBool(false)
                menu_elements.random[i]:SetBool(false)
                menu_elements.freestand_desync[i]:Set(0)
                menu_elements.desync_on_shot[i]:Set(0)
                menu_elements.yaw_modifier[i]:Set(0)
                menu_elements.yaw_modifier_degree[i]:Set(0)
            end
        end
        if preset:Get()==3 then
            menu_elements.random[1]:SetBool(true)
            menu_elements.yaw_add_r[2]:SetInt(-5)
            menu_elements.yaw_add_l[2]:SetInt(-5)
            menu_elements.r_limit[2]:SetInt(17)
            menu_elements.l_limit[2]:SetInt(17)
            menu_elements.inv_jitter[3]:SetBool(true)
            menu_elements.r_limit[2]:SetInt(45)
            menu_elements.l_limit[2]:SetInt(45)
            menu_elements.r_limit[3]:SetInt(55)
            menu_elements.l_limit[3]:SetInt(55)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(55)
            menu_elements.l_limit[4]:SetInt(55)
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(0)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(0)
            menu_elements.inv_jitter[3]:Set(false)
            menu_elements.inv_jitter[2]:Set(false)
            menu_elements.random[1]:Set(true)
        end

        if preset:Get()==2 then
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(0)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(0)
            menu_elements.inv_jitter[3]:Set(true)
            menu_elements.inv_jitter[2]:Set(true)
            menu_elements.random[1]:Set(true)
            menu_elements.r_limit[2]:SetInt(45)
            menu_elements.l_limit[2]:SetInt(45)
            menu_elements.r_limit[3]:SetInt(55)
            menu_elements.l_limit[3]:SetInt(55)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(55)
            menu_elements.l_limit[4]:SetInt(55)
        end

       
        if preset:Get()==1 then
           
            menu_elements.yaw_add_r[1]:SetInt(11)
            menu_elements.yaw_add_r[2]:SetInt(-16)
            menu_elements.yaw_add_r[3]:SetInt(10)
            menu_elements.yaw_add_r[4]:SetInt(-12)
            menu_elements.yaw_add_l[1]:SetInt(11)
            menu_elements.yaw_add_l[2]:SetInt(-16)
            menu_elements.yaw_add_l[3]:SetInt(10)
            menu_elements.yaw_add_l[4]:SetInt(-7)
            menu_elements.r_limit[2]:SetInt(60)
            menu_elements.inv_jitter[3]:Set(true)
            menu_elements.inv_jitter[4]:Set(true)
            menu_elements.inv_jitter[1]:Set(true)
            menu_elements.inv_jitter[2]:Set(true)
            menu_elements.l_limit[2]:SetInt(60)
            menu_elements.r_limit[3]:SetInt(60)
            menu_elements.l_limit[3]:SetInt(60)
            menu_elements.r_limit[1]:SetInt(45)
            menu_elements.l_limit[1]:SetInt(45)
            menu_elements.r_limit[4]:SetInt(60)
            menu_elements.l_limit[4]:SetInt(60)

        end

        if preset:Get()==4 then
            -- stand
            menu_elements.yaw_add_r[1]:SetInt(22)
            menu_elements.yaw_add_l[1]:SetInt(-15)
            menu_elements.yaw_modifier[1]:SetInt(1)
            menu_elements.yaw_modifier_degree[1]:SetInt(22)
            menu_elements.r_limit[1]:SetInt(60)
            menu_elements.l_limit[1]:SetInt(60)
            menu_elements.fake_options[1]:Set(2)
            menu_elements.lby_mode[1]:Set(1)
            menu_elements.freestand_desync[1]:Set(0)
            menu_elements.desync_on_shot[1]:Set(2)
            -- slowwalk
            menu_elements.yaw_add_r[2]:SetInt(20)
            menu_elements.yaw_add_l[2]:SetInt(-12)
            menu_elements.yaw_modifier[2]:SetInt(1)
            menu_elements.yaw_modifier_degree[2]:SetInt(30)
            menu_elements.r_limit[2]:SetInt(60)
            menu_elements.l_limit[2]:SetInt(60)
            menu_elements.fake_options[2]:Set(2)
            menu_elements.lby_mode[2]:Set(1)
            menu_elements.freestand_desync[2]:Set(0)
            menu_elements.desync_on_shot[2]:Set(2)
            -- move
            menu_elements.yaw_add_r[3]:SetInt(22)
            menu_elements.yaw_add_l[3]:SetInt(-15)
            menu_elements.yaw_modifier[3]:SetInt(1)
            menu_elements.yaw_modifier_degree[3]:SetInt(48)
            menu_elements.r_limit[3]:SetInt(60)
            menu_elements.l_limit[3]:SetInt(60)
            menu_elements.fake_options[3]:Set(2)
            menu_elements.lby_mode[3]:Set(0)
            menu_elements.freestand_desync[3]:Set(0)
            menu_elements.desync_on_shot[3]:Set(2)
            -- air
            menu_elements.yaw_add_r[4]:SetInt(-12)
            menu_elements.yaw_add_l[4]:SetInt(-7)
            menu_elements.yaw_modifier[4]:SetInt(1)
            menu_elements.yaw_modifier_degree[4]:SetInt(48)
            menu_elements.r_limit[4]:SetInt(47)
            menu_elements.l_limit[4]:SetInt(47)
            menu_elements.fake_options[4]:Set(2)
            menu_elements.fake_options[4]:Set(3)
            menu_elements.lby_mode[4]:Set(1)
            menu_elements.freestand_desync[4]:Set(0)
            menu_elements.desync_on_shot[4]:Set(2)
            -- crouch
            menu_elements.yaw_add_r[5]:SetInt(-29)
            menu_elements.yaw_add_l[5]:SetInt(-20)
            menu_elements.yaw_modifier[5]:SetInt(1)
            menu_elements.yaw_modifier_degree[5]:SetInt(22)
            menu_elements.r_limit[5]:SetInt(60)
            menu_elements.l_limit[5]:SetInt(60)
            menu_elements.fake_options[5]:Set(2)
            menu_elements.lby_mode[5]:Set(1)
            menu_elements.freestand_desync[5]:Set(0)
            menu_elements.desync_on_shot[5]:Set(1)
        end

        if preset:Get()==5 then
            -- stand
            menu_elements.yaw_add_r[1]:SetInt(5)
            menu_elements.yaw_add_l[1]:SetInt(-5)
            menu_elements.yaw_modifier[1]:SetInt(0)
            menu_elements.yaw_modifier_degree[1]:SetInt(0)
            menu_elements.r_limit[1]:SetInt(36)
            menu_elements.l_limit[1]:SetInt(41)
            menu_elements.fake_options[1]:Set(0)
            menu_elements.lby_mode[1]:Set(1)
            menu_elements.freestand_desync[1]:Set(1)
            menu_elements.desync_on_shot[1]:Set(2)
            -- slowwalk
            menu_elements.yaw_add_r[2]:SetInt(-5)
            menu_elements.yaw_add_l[2]:SetInt(11)
            menu_elements.yaw_modifier[2]:SetInt(4)
            menu_elements.yaw_modifier_degree[2]:SetInt(22)
            menu_elements.r_limit[2]:SetInt(30)
            menu_elements.l_limit[2]:SetInt(30)
            menu_elements.random[2]:SetBool(true)
            menu_elements.fake_options[2]:Set(2)
            menu_elements.lby_mode[2]:Set(0)
            menu_elements.freestand_desync[2]:Set(0)
            menu_elements.desync_on_shot[2]:Set(0)
            -- move
            menu_elements.yaw_add_r[3]:SetInt(-15)
            menu_elements.yaw_add_l[3]:SetInt(21)
            menu_elements.yaw_modifier[3]:SetInt(1)
            menu_elements.yaw_modifier_degree[3]:SetInt(51)
            menu_elements.r_limit[3]:SetInt(41)
            menu_elements.l_limit[3]:SetInt(45)
            menu_elements.random[3]:SetBool(true)
            menu_elements.fake_options[3]:Set(2)
            menu_elements.lby_mode[3]:Set(1)
            menu_elements.freestand_desync[3]:Set(0)
            menu_elements.desync_on_shot[3]:Set(1)
            -- air
            menu_elements.yaw_add_r[4]:SetInt(-3)
            menu_elements.yaw_add_l[4]:SetInt(3)
            menu_elements.yaw_modifier[4]:SetInt(0)
            menu_elements.yaw_modifier_degree[4]:SetInt(0)
            menu_elements.r_limit[4]:SetInt(37)
            menu_elements.l_limit[4]:SetInt(31)
            menu_elements.fake_options[4]:Set(0)
            menu_elements.lby_mode[4]:Set(1)
            menu_elements.freestand_desync[4]:Set(0)
            menu_elements.desync_on_shot[4]:Set(3)
            -- crouch
            menu_elements.yaw_add_r[5]:SetInt(-7)
            menu_elements.yaw_add_l[5]:SetInt(7)
            menu_elements.yaw_modifier[5]:SetInt(0)
            menu_elements.yaw_modifier_degree[5]:SetInt(0)
            menu_elements.r_limit[5]:SetInt(38)
            menu_elements.l_limit[5]:SetInt(33)
            menu_elements.fake_options[5]:Set(0)
            menu_elements.lby_mode[5]:Set(2)
            menu_elements.freestand_desync[5]:Set(0)
            menu_elements.desync_on_shot[5]:Set(1)

        end

    end

    if externded_desync_switch:Get() then
        menu_elements.yaw_modifier[1]:SetInt(0)
        menu_elements.yaw_modifier_degree[1]:SetInt(0)
        menu_elements.fake_options[1]:Set(0)
        menu_elements.r_limit[1]:SetInt(45)
        menu_elements.l_limit[1]:SetInt(45)
        menu_elements.fake_options[1]:Set(0)
        menu_elements.lby_mode[1]:Set(0)
        menu_elements.freestand_desync[1]:Set(0)
        menu_elements.desync_on_shot[1]:Set(0)
        menu_elements.yaw_modifier[2]:SetInt(0)
        menu_elements.yaw_modifier_degree[2]:SetInt(0)
        menu_elements.fake_options[2]:Set(0)
        menu_elements.r_limit[2]:SetInt(45)
        menu_elements.l_limit[2]:SetInt(45)
        menu_elements.fake_options[2]:Set(0)
        menu_elements.lby_mode[2]:Set(0)
        menu_elements.freestand_desync[2]:Set(0)
        menu_elements.desync_on_shot[2]:Set(0)
        menu_elements.yaw_modifier[3]:SetInt(0)
        menu_elements.yaw_modifier_degree[1]:SetInt(0)
        menu_elements.fake_options[3]:Set(0)
        menu_elements.r_limit[3]:SetInt(45)
        menu_elements.l_limit[3]:SetInt(45)
        menu_elements.fake_options[3]:Set(0)
        menu_elements.lby_mode[3]:Set(0)
        menu_elements.freestand_desync[3]:Set(0)
        menu_elements.desync_on_shot[3]:Set(0)
        menu_elements.yaw_modifier[4]:SetInt(0)
        menu_elements.yaw_modifier_degree[4]:SetInt(0)
        menu_elements.fake_options[4]:Set(0)
        menu_elements.r_limit[4]:SetInt(45)
        menu_elements.l_limit[4]:SetInt(45)
        menu_elements.fake_options[4]:Set(0)
        menu_elements.lby_mode[4]:Set(0)
        menu_elements.freestand_desync[4]:Set(0)
        menu_elements.desync_on_shot[4]:Set(0)
        menu_elements.yaw_modifier[5]:SetInt(0)
        menu_elements.yaw_modifier_degree[5]:SetInt(0)
        menu_elements.fake_options[5]:Set(0)
        menu_elements.r_limit[5]:SetInt(45)
        menu_elements.l_limit[5]:SetInt(45)
        menu_elements.fake_options[5]:Set(0)
        menu_elements.lby_mode[5]:Set(0)
        menu_elements.freestand_desync[5]:Set(0)
        menu_elements.desync_on_shot[5]:Set(0)
    end

end

menu_elements.custom_type:RegisterCallback(function()
    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetInt(0)
        menu_elements.yaw_add_l[i]:SetInt(0)
        menu_elements.r_limit[i]:SetInt(60)
        menu_elements.l_limit[i]:SetInt(60)
        menu_elements.inv_jitter[i]:SetBool(false)
        menu_elements.random[i]:SetBool(false)
        menu_elements.freestand_desync[i]:Set(0)
        menu_elements.desync_on_shot[i]:Set(0)
        menu_elements.yaw_modifier[i]:Set(0)
        menu_elements.yaw_modifier_degree[i]:Set(0)
        menu_elements.fake_options[i]:Set(0)
        menu_elements.lby_mode[i]:Set(0)
    end
end)

menu_elements.custom_presets:RegisterCallback(function()
    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetInt(0)
        menu_elements.yaw_add_l[i]:SetInt(0)
        menu_elements.r_limit[i]:SetInt(60)
        menu_elements.l_limit[i]:SetInt(60)
        menu_elements.inv_jitter[i]:SetBool(false)
        menu_elements.random[i]:SetBool(false)
        menu_elements.freestand_desync[i]:Set(0)
        menu_elements.desync_on_shot[i]:Set(0)
        menu_elements.yaw_modifier[i]:Set(0)
        menu_elements.yaw_modifier_degree[i]:Set(0)
        menu_elements.fake_options[i]:Set(0)
        menu_elements.lby_mode[i]:Set(0)
        menu_elements.yaw_modifier[i]:SetInt(0)
        menu_elements.yaw_modifier_degree[i]:SetInt(0)
    end
end)

local tick = GlobalVars.tickcount
function desync_on_use(argss)
    if legit_aa:GetBool() then
        local yaw_b = refs.yaw_b:Get()
        local yaw_add = (yaw_b == 0 or yaw_b == 5) and 180 or yaw_b == 2 and -90 or yaw_b == 3 and 90 or 0
        local localplayer = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
        local getplayer = localplayer:GetPlayer()
        local buttonss = argss.buttons
        local view_angles = EngineClient:GetViewAngles()
        local use = bit.rshift(bit.lshift(argss.buttons, 26), 31)

        if use ~= 0 and hostage_check(getplayer) and bomb_check(getplayer) and defuse_check(getplayer) then
            tick = not huy and GlobalVars.tickcount or tick
            huy = true
            legit_aa_on = true
         
            AntiAim.OverridePitch(view_angles.pitch)
            AntiAim.OverrideYawOffset(180 + yaw_add)
            AntiAim.OverrideInverter(not refs.invert:GetBool())
        else
            huy = false
            legit_aa_on = false
        end
        if tick + 4 <= GlobalVars.tickcount and hostage_check(getplayer) and bomb_check(getplayer) and
            defuse_check(getplayer) then
            argss.buttons = bit.band(argss.buttons, bit.bnot(32))
        end
    end
end

edge_yaw = Menu.Switch("> Anti Aim", "Other", "[~] Edge Yaw", false)

local function VectorLerp(vecSource, vecDestination, flPercentage)
    return vecSource + (vecDestination - vecSource) * flPercentage
end

local function NormalizeYaw(flYaw)
    while flYaw > 180 do flYaw = flYaw - 360 end
    while flYaw < -180 do flYaw = flYaw + 360 end
    return flYaw
end
local function VectorLerp(vecSource, vecDestination, flPercentage)
    return vecSource + (vecDestination - vecSource) * flPercentage
end

local vecTraceStart = Vector.new()
local edge_on = false

function edge(UserCmd)
    if not edge_yaw:GetBool() then
        return
    end

    local iLocalPlayerEntIndex = EngineClient:GetLocalPlayer()
    if not iLocalPlayerEntIndex then
        return
    end
    edge_on = false
    local pLocalPlayerEntity = EntityList.GetClientEntity(iLocalPlayerEntIndex)
    local pLocalPlayer = pLocalPlayerEntity:GetPlayer()

    local flVelocityZ = pLocalPlayer:GetProp('m_vecVelocity[2]')
    local bInJump = bit.band(UserCmd.buttons, 2) == 2
    if flVelocityZ ~= 0 or bInJump then
        return
    end

    if ClientState.m_choked_commands == 0 then vecTraceStart = pLocalPlayer:GetEyePosition() end

    local aTraceEnd = {}

    local angViewAngles = EngineClient:GetViewAngles()
    for flYaw = 18, 360, 18 do
        flYaw = NormalizeYaw(flYaw)

        local angEdge = QAngle.new(0, flYaw, 0)

        local vecTraceEnd = vecTraceStart + Cheat.AngleToForward(angEdge) * 0x60

        local traceInfo = EngineTrace.TraceRay(vecTraceStart, vecTraceEnd, pLocalPlayerEntity, 0x200400B)

        local flFraction = traceInfo.fraction
        local pEntity = traceInfo.hit_entity

        if pEntity and pEntity:GetClassName() == 'CWorld' and flFraction < 0.3 then
            aTraceEnd[#aTraceEnd+1] = {
                vecTraceEnd = traceInfo.endpos,
                flYaw = flYaw
            }
        end
    end

    table.sort(aTraceEnd, function(a, b)
        return a.flYaw < b.flYaw
    end)

    local angEdge

    if #aTraceEnd >= 2 then
        local vecTraceCenter = VectorLerp(aTraceEnd[1].vecTraceEnd, aTraceEnd[#aTraceEnd].vecTraceEnd, 0.5)

        angEdge = Cheat.VectorToAngle(vecTraceStart - vecTraceCenter)
    end
   
    if angEdge then
        local flYaw = angViewAngles.yaw
        local flEdgeYaw = angEdge.yaw

        local flDiff = NormalizeYaw(flEdgeYaw - flYaw)

        if math.abs(flDiff) < 90 then
            flDiff = 0
            flYaw = NormalizeYaw(flEdgeYaw + 180)
        end

        -- Static yaw
        local flNewYaw = -flYaw

        -- Apply edge yaw
        flNewYaw = NormalizeYaw(flNewYaw + flEdgeYaw + 180)

        flNewYaw = NormalizeYaw(flNewYaw + flDiff)
        edge_on = true
        AntiAim.OverrideYawOffset(flNewYaw)

    end
end

local vecTraceStart = Vector.new()
local edge_on = false

keybinds_123 = Menu.Switch("> Visuals", "Main", "[-] Enable UI Indicators", false)
select_ui_windows = Menu.MultiCombo("> Visuals", "Main", "Select UI", {"Keybinds", "Watermark"}, 0)
local custom_name_switch = Menu.Switch("> Visuals", "Main", "Custom Name" , false)
local custom_name_text = Menu.TextBox("> Visuals", "Main", "" , 64 , Cheat.GetCheatUserName())
local cheat_name = Menu.Combo("> Visuals", "Main" , "Cheat name" ,  {"Melonity" , "Neverlose"} , 0)
ui_themes =            Menu.Combo("> Visuals", "Main", "Theme", {"Gradient line", "Static line", "Fade line", "Animated"}, 0)
ui_line_color =        Menu.ColorEdit("> Visuals", "Main", "Line color", Color.new(100 / 255, 100 / 255, 255 / 255, 255 / 255))
bind_state_ui = Menu.Combo("> Visuals", "Main", "Bind State", {"Default", "Toggled", "Toggled v2"}, 0)
blur_background = Menu.Switch("> Visuals", "Main", "Blur Background", false)
tickbase_enable = Menu.Switch("> Visuals", "Main", "Tickbase Indicator" , false)
tickbase_indicator_color = Menu.ColorEdit("> Visuals", "Main", "Tickbase Indicator Color", Color.RGBA(100, 100, 255, 255))

local screen_size_keybinds = EngineClient:GetScreenSize()
local font_keybinds = Render.InitFont("Verdana", 12)
local floor_keybinds = math.floor
local font_size_keybinds = 12

local function text_color_keybinds(alpha)
    return Color.new(0.9, 0.9, 0.9, 0.95 * alpha)
end

local function color123(r, g, b, a) return Color.new(r / 255, g / 255, b / 255, a / 255) end
local function in_box(mouse, x, y, x2, y2) return (mouse.x > x) and (mouse.y > y) and (mouse.x < x2) and (mouse.y < y2) end
local function clamp(val, min, max) if val > max then return max end if min > val then return min end return val end

local function move(x, y, w, h, slider_x, slider_y)
    local mouse = cheat.GetMousePos()
    if (cheat.IsKeyDown(0x1) and cheat.IsMenuVisible() and in_box(mouse, x, y, x + w, y + h)) then
        slider_x:SetInt(mouse.x - w / 2)
        slider_y:SetInt(mouse.y - 10)
    end
end

local ui_keybinds_x =        Menu.SliderInt("> Visuals", "Main", "keybinds x", 5, 0, screen_size_keybinds.x)
local ui_keybinds_y =        Menu.SliderInt("> Visuals", "Main", "keybinds y", math.floor(screen_size_keybinds.y / 2), 0, screen_size_keybinds.y)

ui_keybinds_x:SetVisible(false)
ui_keybinds_y:SetVisible(false)

local get_theme = {
    [0] = function(x, y, w, col)
        Render.GradientBoxFilled(Vector2.new(x + w, y), Vector2.new(x + w / 2, y - 2), color123(255, 234, 0, col:a()), color123(255, 0, 238, col:a()), color123(255, 234, 0, col:a()), color123(255, 0, 238, col:a()))
        Render.GradientBoxFilled(Vector2.new(x, y), Vector2.new(x + w / 2, y - 2), color123(0, 200, 255, col:a()), color123(255, 0, 238, col:a()), color123(0, 200, 255, col:a()), color123(255, 0, 238, col:a()))
    end,

    [1] = function(x, y, w, col)
        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y - 2), col)
    end,

    [2] = function(x, y, w, col, col2)
        Render.GradientBoxFilled(Vector2.new(x + w, y), Vector2.new(x + w / 2, y - 2), color123(col:r(), col:g(), col:b(), col2), col, color123(col:r(), col:g(), col:b(), col2), col)
        Render.GradientBoxFilled(Vector2.new(x, y), Vector2.new(x + w / 2, y - 2), color123(col:r(), col:g(), col:b(), col2), col, color123(col:r(), col:g(), col:b(), col2), col)
    end
}

local function render_adaptive_box(type, x, y, name, alpha)
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(1) then
    local name_size = Render.CalcTextSize(name, font_size_keybinds, font_keybinds)
    local line = ui_line_color:GetColor()

    if type == "keybinds" then
        get_theme[ui_themes:GetInt()](x, y, 150, Color.new(line:r(), line:g(), line:b(), 255 * alpha), 10 * alpha)
        Render.BoxFilled(Vector2.new(x, y), Vector2.new(x + 150, y + 17), color123(20, 20, 20, 150 * alpha))
        Render.Text(name, Vector2.new(x + 150 / 2 - name_size.x / 2, y + 2), text_color_keybinds(alpha), font_size_keybinds, font_keybinds)
    end
end
end

local defines = {screen_size = EngineClient:GetScreenSize()}

local function lerp(start,end_pos,time,do_extraanim)
    if not do_extraanim then
        if math.ceil(start) == end_pos then return end_pos end
    end
    time = GlobalVars.frametime * (time * 175)
    if time < 0 then
      time = 0.01
    elseif time > 1 then
      time = 1
    end
    local delta = end_pos - start
    delta = delta * time
    delta = delta + start
    return delta
end
ffi.cdef[[
    typedef void* HWND;
    typedef const char* LPCSTR;
    short GetAsyncKeyState(int vKey);
    HWND GetForegroundWindow();
    HWND FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName);
]]
local foreground_hwnd = ffi.new("HWND")
local found_hwnd = ffi.new("HWND")
local function is_key_down(key_code)
    foreground_hwnd = ffi.C.GetForegroundWindow()
    found_hwnd = ffi.C.FindWindowA("Valve001", nil)
    if foreground_hwnd ~= nil and (found_hwnd == foreground_hwnd) then
        return ffi.C.GetAsyncKeyState(key_code) ~= 0
    end
    return false
end

local function color(r,g,b,a)
    if not a then a = 255 end
    if not b then b = 0 end
    return Color.new(r/255,g/255,b/255,a/255)
end
local x_sl = Menu.SliderInt("> Visuals", "keybinds", "x", 400, 1, defines.screen_size.x)
local y_sl = Menu.SliderInt("> Visuals", "keybinds", "y", 200, 1, defines.screen_size.y)
x_sl:SetVisible(false)
y_sl:SetVisible(false)
local draggables = {
    create_draggable = function(start_position_x, start_position_y, starting_size_x, starting_size_y, name, callback_fn)
    return {
        position_x = start_position_x,
        position_y = start_position_y,
        size_x = starting_size_x,
        size_y = starting_size_y,
        started_dragging = false,
        initial_drag_pos = Vector2.new(0, 0),
        drag_pos = Vector2.new(0, 0),
        callback_function = callback_fn,
        update = function(self)
        if Cheat.IsMenuVisible() then
                  local mouse_position = Cheat.GetMousePos()
                  local is_in_bounds = (mouse_position.x >= self.position_x and mouse_position.y >= self.position_y and mouse_position.x <= self.position_x + self.size_x and mouse_position.y <= self.position_y + self.size_y)
                  if (is_in_bounds or self.started_dragging) and is_key_down(1) and (defines.mouse_target == 0 or defines.mouse_target == name) then
                    defines.mouse_target = name
                      if not self.started_dragging then
                           
                          self.started_dragging = true
                          self.initial_drag_pos = Vector2.new(mouse_position.x - self.position_x, mouse_position.y - self.position_y)
                      else
                          self.position_x = mouse_position.x - self.initial_drag_pos.x
                          self.position_y = mouse_position.y - self.initial_drag_pos.y
                      end
                  elseif not is_key_down(1) then
                    defines.mouse_target = 0
                      self.started_dragging = false
                      self.initial_drag_pos = self.drag_pos
                  end
          end
        self.callback_function(self)
        end
    }
    end
}
local windows_text_size = 11
local menu_windows_element = Menu.FindVar("Miscellaneous", "Main", "Other", "Windows")
local fontik1 = Render.InitFont("Verdana", 11 , {'r'} )
local binds = {
   
}
local function get_active_binds()
    local cheatbinds = Cheat.GetBinds()
    local active = {}
    local is_any_active = false
    for i = 1, #cheatbinds do
        local bind = cheatbinds[i]

        local name = bind:GetName()
        if binds[name] == nil then
            binds[name] = {
                name = name,
                value = bind:GetValue(),
                alpha = 0
            }
            goto continue
        end
        if binds[name].value ~= bind:GetValue() then
            binds[name].value = bind:GetValue()
        end
        local is_active = bind:IsActive()
        binds[name].alpha = lerp(binds[name].alpha, is_active and 255 or 0, 0.095)
        if binds[name].alpha > 1 then
            local to_push_name = binds[name].name
            local to_push_value = binds[name].value
            if #to_push_name + #to_push_value > 28 then
                if #to_push_name>=#to_push_value then
                    to_push_name = string.sub(to_push_name, 1 , 14) .. "..."
                else
                    to_push_value = string.sub(to_push_value, 1 , 14) .. "..."
                end
            end
            table.insert(active, 1, {
                name = to_push_name,
                state = to_push_value,
                alpha = binds[name].alpha
            })
        end
        if is_active then
            is_any_active = true
        end
        ::continue::
    end
    return {active, is_any_active}
end

local function get_colors_aue()
    local selected = ui_themes:GetInt()
    if selected == 0 then return {color(0, 255, 255, 255), color(255, 0, 255, 255), color(255, 255, 0, 255)} end
    if selected == 1 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {col, col, col}
    end
    if selected == 2 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {Color.new(col.r, col.g, col.b, 0), col, Color.new(col.r, col.g, col.b, 0)}
    end
    if selected==3 then
        local col = Color.new(ui_line_color:GetColor().r , ui_line_color:GetColor().g , ui_line_color:GetColor().b , 1)
        return {col, col, col}
    end
end
local time = Panorama.LoadString([[
    return {
        get: () => {
            var now     = new Date();

            var hour    = now.getHours();
            var minute  = now.getMinutes();
            var second  = now.getSeconds();

            if(hour.toString().length == 1) {
                 hour = '0'+hour;
            }
            if(minute.toString().length == 1) {
                 minute = '0'+minute;
            }
            if(second.toString().length == 1) {
                 second = '0'+second;
            }  
            var dateTime = hour+':'+minute+':'+second;  

            return dateTime;
        },
        get_as_table: () => {
            var now     = new Date();

            var hour    = now.getHours();
            var minute  = now.getMinutes();
            var second  = now.getSeconds();

            if(hour.toString().length == 1) {
                 hour = '0'+hour;
            }
            if(minute.toString().length == 1) {
                 minute = '0'+minute;
            }
            if(second.toString().length == 1) {
                 second = '0'+second;
            }  
            var dateTime = hour+':'+minute+':'+second;  

            return {wHour: hour, wMinute: minute, wSecond: second};
        }
    }
]])()
local data = {alpha = 0, lerp = 0, width = 0}
local offset = Vector2.new(0,0)
local w = Vector2.new(0,0)
local keybinds_draggable = draggables.create_draggable(x_sl:GetInt(), y_sl:GetInt(), 0, 0, 2, function(self)
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(1) then
    menu_windows_element:SetBool(1, false)

    local size = Vector2.new(data.width, 17)
    self.size_x = size.x
    self.size_y = size.y
    local call = get_active_binds()
    local active_binds = call[1]
    if not active_binds or (call[2] == false and not Cheat.IsMenuVisible()) then
        data.lerp = 0
    else
        data.lerp = 255
    end
    local start = Vector2.new(self.position_x, self.position_y)
   
    local animated = ui_themes:GetInt()==3
   
    if not animated then
        offset = Vector2.new(size.x / 2, 2)
    else
        offset = Vector2.new(size.x / 2, 2)
    end

    local colors = get_colors_aue()
    colors = {Color.new(colors[1].r, colors[1].g, colors[1].b, (data.alpha / 255) * colors[1].a ), Color.new(colors[2].r, colors[2].g, colors[2].b, (data.alpha / 255) * colors[2].a ),
    Color.new(colors[3].r, colors[3].g, colors[3].b,  (data.alpha / 255) * colors[3].a )}
    local max_width = 0
    local y_offset = 0
    for i = 1, #active_binds do
        local bind = active_binds[i]
        if bind_state_ui:Get()==0 then
        if bind.state == "on" then
            bind.state = "[on]"
        else
            bind.state = "["..bind.state.."]"
        end
    end
    if bind_state_ui:Get()==1 then
        if bind.state == "on" then
            bind.state = "[toggled]"
        else
            bind.state = "[toggled]"
        end
    end
    if bind_state_ui:Get()==2 then
        if bind.state == "on" then
            bind.state = "[toggled]"
        else
            bind.state = "["..bind.state.."]"
        end
    end
        local text_size = Render.CalcTextSize(bind.state, windows_text_size, fontik1)
        local text_size_bind_name = Render.CalcTextSize(bind.name, windows_text_size, fontik1)
        local off = start.y + (y_offset * 18) + 20 -- helpers:r()ound(18 * bind:a()lpha/255)
        Render.Text(bind.name, Vector2.new(start.x, off), Color.new(1.0, 1.0, 1.0, bind.alpha / 255), windows_text_size, fontik1, false)
        Render.Text(bind.state, Vector2.new(start.x + (size.x - text_size.x), off), Color.new(1.0, 1.0, 1.0, bind.alpha / 255), windows_text_size, fontik1, false)
        local bind_width = text_size_bind_name.x + text_size.x + 10
        if bind_width > 120 then
            if bind_width > max_width then
                max_width = bind_width
            end
        end
        y_offset = y_offset + bind.alpha/255
    end


    data.width = lerp(data.width, max_width, 0.095)
    data.width = math.max(120, data.width)

    local dt_color = colors[1]
    local dt_color2 = Color.new(dt_color.r , dt_color.g , dt_color.b , math.sin(math.rad(GlobalVars.tickcount % 360) *2) * (data.alpha/255) )

    if blur_background:Get() then
        Render.Blur(start + size, start, Color.new(1,1,1,  animated and   data.alpha/255 or data.alpha/255 ))
    else
    Render.BoxFilled(start + size, start, Color.new(17/255,17/255,17/255,  animated and   data.alpha*0.3/255 or data.alpha * ui_line_color:GetColor().a/255 ))
    end


    if not animated then
        w.y = offset.y
        w.x =  offset.x
        Render.GradientBoxFilled(start, start + w, colors[1], colors[2], colors[1], colors[2])
        Render.GradientBoxFilled(start + offset, start + offset + Vector2.new(w.x, -offset.y), colors[2], colors[3], colors[2], colors[3])
    else
        w.y = offset.y
        w.x =   lerp(w.x,offset.x* (data.alpha/255) , 0.075)
        Render.GradientBoxFilled(start + Vector2.new(offset.x - w.x , 0), start + Vector2.new(offset.x , 1) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(offset.x , 0), start + Vector2.new(offset.x + w.x , 1) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start+ Vector2.new(-1,17), start + Vector2.new(w.x+1 , 18) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start + Vector2.new(offset.x*2-w.x , 0)+ Vector2.new(-1,17), start + Vector2.new(offset.x*2 , 18) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(0,17-17 * data.alpha/255), start + Vector2.new(-1 , 17) , dt_color2 , dt_color2 , dt_color , dt_color )
        Render.GradientBoxFilled(start + Vector2.new(offset.x*2 - 1 ,17 - 17 * data.alpha/255 ), start + Vector2.new(0 , 17 ) + Vector2.new(offset.x*2 ,0 ), dt_color2 , dt_color2 , dt_color , dt_color )
    end

    Render.Text("keybinds", Vector2.new(start.x + size.x / 2 - Render.CalcTextSize("keybinds", windows_text_size, fontik1).x / 2, start.y + 3), Color.new(1.0, 1.0, 1.0, data.alpha/255), windows_text_size, fontik1, false)
    data.alpha = lerp(data.alpha, data.lerp, 0.095)
end
end)


local watermark = function()
    if not keybinds_123:GetBool() then return end
    if select_ui_windows:Get(2) then
    menu_windows_element:SetBool(3, false)
    local name = custom_name_switch:Get() and custom_name_text:Get() or Cheat.GetCheatUserName()
    local time = time:get()
    local cheat_name = cheat_name:Get() == 0 and "Melonity" or "Neverlose.cc"
    local ping = "0"
    local GetNetChannelInfo = EngineClient.GetNetChannelInfo()
    if GetNetChannelInfo then
        ping = math.floor(GetNetChannelInfo:GetLatency(0) * 1000)
    end
    local fps = math.floor(1/GlobalVars.frametime)
    local colors = get_colors_aue()
    colors = {Color.new(colors[1].r, colors[1].g, colors[1].b,  colors[1].a ), Color.new(colors[2].r, colors[2].g, colors[2].b, colors[2].a),
    Color.new(colors[3].r, colors[3].g, colors[3].b,  colors[3].a)}
    local text = cheat_name .. " | "..name.." | ping: "..ping.." ms | tick: "..(1/GlobalVars.interval_per_tick).." | "..time

    local ts = Render.CalcTextSize(text, 11, fontik1)
    local ss = EngineClient.GetScreenSize()
    local start_pos = Vector2.new(ss.x - 8 , 8)
    ts.x = ts.x + 6

    local offset = Vector2.new(-ts.x/2 ,2)

    local animated = ui_themes:GetInt() == 3


    if blur_background:Get() then
        Render.Blur(start_pos, start_pos - Vector2.new(ts.x , -17))
    else
        Render.BoxFilled(start_pos , start_pos - Vector2.new(ts.x , -17) , Color.new(0.07 , 0.07 , 0.07 , animated and 0.2 or ui_line_color:GetColor().a  ))
    end
    local dt_color = colors[1]
    local dt_color2 = Color.new(dt_color.r , dt_color.g , dt_color.b , math.sin(math.rad(GlobalVars.tickcount % 360)*2) )
   
    if not animated then
        Render.GradientBoxFilled(start_pos, start_pos + offset, colors[1], colors[2], colors[1], colors[2])
        Render.GradientBoxFilled(start_pos + offset, start_pos + offset + Vector2.new(offset.x, -offset.y), colors[2], colors[3], colors[2], colors[3])
    else
        Render.GradientBoxFilled(start_pos, start_pos + Vector2.new(offset.x , 1) , dt_color2 , dt_color , dt_color2 , dt_color )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x , 0), start_pos + Vector2.new(2*offset.x , 1) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start_pos+ Vector2.new(0,17), start_pos + Vector2.new(offset.x , 18) , dt_color , dt_color2 , dt_color , dt_color2 )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x , 0)+ Vector2.new(0,17), start_pos + Vector2.new(2*offset.x , 18) , dt_color2 , dt_color , dt_color2 , dt_color )

        Render.GradientBoxFilled(start_pos, start_pos + Vector2.new(-1 , 17) , dt_color2 , dt_color2 , dt_color , dt_color )
        Render.GradientBoxFilled(start_pos + Vector2.new(offset.x*2 ,0 ), start_pos + Vector2.new(1 , 17) + Vector2.new(offset.x*2 ,0 ), dt_color2 , dt_color2 , dt_color , dt_color )

    end
   
    Render.Text(text , start_pos + offset*2 - Vector2.new(-3 , 1) , Color.new(1,1,1,1) , 11 , fontik1 , false , false)

end
end

enable_min_damage_indicator = Menu.Switch("> Visuals", "Other", "[-] Enable Min.Damage Indicator", false)
local min_damage_indicator_pos = Menu.Combo("> Visuals", "Other", "Indicator Position", {"Right Up", "Left Up", "Centre Up"}, 0, "")

local dmg_indicator_font = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)

local damage_screen = EngineClient.GetScreenSize()
local vecPositions = {
    [0] = Vector2.new(damage_screen.x/2 + 10, damage_screen.y/2 - 30),
    [1] = Vector2.new(damage_screen.x/2 - 15, damage_screen.y/2 - 30),
    [2] = Vector2.new(damage_screen.x/2 - 2, damage_screen.y/2 - 30)
}

local function damage_indicator_dmg()
    local player1234 = EntityList.GetLocalPlayer();  
    if not player1234 then return end  
    local lifeState1234 = player1234:GetProp("m_lifeState");
    if not lifeState1234 then
    if enable_min_damage_indicator:Get() then
    Render.Text(tostring(Menu.FindVar("Aimbot", "Ragebot", "Accuracy", "Minimum Damage"):GetInt()) , vecPositions[min_damage_indicator_pos:GetInt()], Color.new(1.0, 1.0, 1.0, 1.0), 10, dmg_indicator_font, true)
end
end
end

enable_logs = Menu.Switch("> Misc", "Main", "[-] Enable Logs", false)
type2_of_logs = Menu.Combo("> Misc", "Main", "Select type of logs", {"Console", "Under Crosshair", "Notify"}, 0)
type3_of_logs = Menu.MultiCombo("> Misc", "Main", "Select Under Logs", {"Hit", "Miss", "Dormant Aimbot", "Chat"}, 0)
type_of_logs = Menu.MultiCombo("> Misc", "Main", "Select logs", {"Hit", "Miss", "Anti-Brute", "Purchases", "Chat"}, 0)

local menu_windows_element_logs = Menu.FindVar("Miscellaneous", "Main", "Other", "Event Log")

ffi.cdef[[
    typedef unsigned char BYTE;
    typedef void *PVOID;
    typedef PVOID HMODULE;
    typedef const char *LPCSTR;
    typedef int *FARPROC;
   
    HMODULE GetModuleHandleA(
        LPCSTR lpModuleName
    );
   
    FARPROC GetProcAddress(
        HMODULE hModule,
        LPCSTR  lpProcName
    );
   
    typedef struct{
        BYTE r, g, b, a;
    } Color;
   
    typedef void(__cdecl *ColorMsgFn)(Color&, const char*);
]]

local engine_client = Utils.CreateInterface("vstdlib.dll", "VEngineCvar007") or error("(")
local engine_client_class = ffi.cast(ffi.typeof("void***"), engine_client) or error("(")
local console_print_color_cast = ffi.cast("void(__cdecl*)(void*, void*, const char*)", engine_client_class[0][25]) or error("(")
local ConsolePrint = function(label, r, g, b, a)


    local color_struct = ffi.new("Color")

    color_struct.r = r
    color_struct.g = g
    color_struct.b = b
    color_struct.a = 255

    return console_print_color_cast(engine_client_class , color_struct, tostring(label))
end

local log = {
}
local console = Render.InitFont("lucida console", 10, {"r"})
local hitboxes = {
    [0] = "generic",
    [1] = "head",
    [2] = "chest",
    [3] = "stomach",
    [4] = "left arm",
    [5] = "right arm",
    [6] = "left leg",
    [7] = "right leg",
    [10] = "gear",
}
local reasons = {
    "resolver",
    "spread",
    "occlusion",
    "prediction error",
}

local drawlog = function(prefix, prefix_r, prefix_g, prefix_b, prefix_a, text, print_text)
    log[#log + 1] = {
        text,
        255,
        math.floor(GlobalVars.curtime),
    }
    ConsolePrint(prefix, prefix_r, prefix_g, prefix_b, prefix_a)
    print(print_text)
end
local wpn_list = {
    ["molotov"] = 1,
    ["inferno"] = 1,
    ["knife"] = 1,
    ["hegrenade"] =1,
    ["taser"] = 1,
    ["smokegrenade"] = 1,
    ["decoy"] = 1,
    ["flashbang"] =1,
}

local last_switch_tick = 0
local closest_point_on_ray = function(ray_from, ray_to, desired_point)
    local to = desired_point - ray_from
    local direction = ray_to - ray_from
    local ray_length = direction:Length()

    direction.x = direction.x / ray_length
    direction.y = direction.y / ray_length
    direction.z = direction.z / ray_length

    local direction_along = direction.x * to.x + direction.y * to.y + direction.z * to.z
    if direction_along < 0 then
        return ray_from
    end
    if direction_along > ray_length then
        return ray_to
    end

    return Vector.new(ray_from.x + direction.x * direction_along, ray_from.y + direction.y * direction_along,
        ray_from.z + direction.z * direction_along)
end

local screen_center = EngineClient.GetScreenSize()/2
local font_logs = Render.InitFont("Verdana" , 12)
local logs = {
    data = {},

    add = function(self, should_render , ... )
        if should_render then
            self.data[#self.data+1] = {text = (...) ,  a= 0 ,t = GlobalVars.curtime}
        end
    end,

    render = function(self)
        local adding = 0
        local off = indicators_list:Get()==2 and 30 or 0
        for idx , log_data in ipairs(self.data) do
            if GlobalVars.curtime - log_data.t > 3.5 or (#self.data>10 and idx < #self.data-10)  then
                log_data.a = lerp(log_data.a , 0 , 0.095 , 0.01)
            else
                log_data.a = lerp(log_data.a , 1 , 0.095 , 0.01)
            end

            adding = adding + 13*log_data.a
            if enable_logs:GetBool() and type2_of_logs:Get()==1 then
            if log_data.a >0.01 then
                Render.Text(log_data.text , Vector2.new(screen_center.x , screen_center.y  + 61 + off + math.abs(adding) ) + 1 , Color.new(0,0,0,log_data.a) , 12, font_logs , false , true )
                Render.Text(log_data.text , Vector2.new(screen_center.x ,screen_center.y  + 61+off + math.abs(adding) ) , Color.new(1,1,1,log_data.a) , 12, font_logs , false , true )
            end

            ::c::
        end
    end
    end
}

handlers:subscribe("events" , function(e)

    if e:GetName() == "player_connect_full" or e:GetName() == "cs_game_disconnected" then logs.data = {} log = {} end
end )

handlers:subscribe("draw" , function ()
    logs:render()
end)



handlers:subscribe("events", function(event)
    local localplayer = EntityList.GetLocalPlayer()
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
     if event:GetName() == "item_purchase" then
        if not enable_logs:GetBool() then return end
        if event:GetName() ~= "item_purchase" then
            return
        end
        local buyerid = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        local item = event:GetString("weapon")
        if buyerid ~= localplayer and item ~= "weapon_unknown" and buyerid ~= nil then
            local buyer = buyerid:GetName()
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(4) then
            drawlog("[Melonity] ", 185, 129, 235, 255, string.format("%s bought %s", buyer, item), string.format("%s bought %s\r", buyer, item))
            end
        end
    end
    if event:GetName() == "player_hurt" then
        if not enable_logs:GetBool() then return end
        local target_player = EntityList.GetPlayerForUserID(event:GetInt("userid", 0))
        if not target_player then return end
   
        local attacker_player = EntityList.GetPlayerForUserID(event:GetInt("attacker", 0))
        if not attacker_player then return end
        local wpn = event:GetString("weapon")
        local pName = attacker_player:GetName()
        local pName2 = target_player:GetName()
        local dmg = event:GetInt("dmg_health")
        local hbox = hitboxes[event:GetInt("hitgroup")+1]
        local rem = event:GetInt("health")
        if target_player~=EntityList.GetLocalPlayer() and attacker_player==EntityList.GetLocalPlayer() then
            local prefix = "Hit"  
   
            if wpn=="hegrenade"  then prefix = "Naded" end
            if wpn=="taser" then prefix = "Zeused" end
            if wpn=="inferno" then prefix = "Burned" end
            if wpn=="knife" then prefix = "Knifed" end
           
            if wpn_list[wpn] then
                local str = prefix .." "..pName2.." for "..dmg .. " damage (" ..rem .. " health remaining)"
                local col = Color.new(0.65 , 0.85 , 0.15 , 1)
                local white = Color.new(1,1,1,1)
                if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) then
                drawlog("[Melonity] ", 185, 129, 235, 255, str,str)
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) then
                logs:add(true , str)
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                    logs[#logs+1] = {(prefix .." "..pName2.." for "..dmg .. " damage (" ..rem .. " health remaining)"), GlobalVars.tickcount + 150, 0}
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) and type_of_logs:Get(5) then
                    PrintInChat(" \x08"..prefix.." \x03"..pName2.."\x08 for \x07"..dmg.."\x08 damage (\x10"..rem.."\x08 health remaining)")
                end
                if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) and type3_of_logs:Get(4) then
                    PrintInChat(" \x08"..prefix.." \x03"..pName2.."\x08 for \x07"..dmg.."\x08 damage (\x10"..rem.."\x08 health remaining)")
                end
        end
        end
    end

    if event:GetName() == "bullet_impact" then
        if not menu_elements.switch:Get() then
            return
        end



        local lp = EntityList.GetLocalPlayer()
        if not lp or not lp:IsAlive() then
            return
        end
        if not event:GetInt("userid") then
            return
        end
        local entity = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        if not entity then
            return
        end

        if entity == lp then
            return
        end
        local player = entity
        if not player then
            return
        end
        if player:IsTeamMate() then
            return
        end

        local bullet_impact = Vector.new(event:GetFloat("x"), event:GetFloat("y"), event:GetFloat("z"))
        local eye_pos = player:GetEyePosition()
        if not eye_pos then
            return
        end
        local local_player = lp
        if not local_player then
            return
        end
        local local_eye_pos = local_player:GetEyePosition()
        if not local_eye_pos then
            return
        end

        local distance_between = closest_point_on_ray(eye_pos, bullet_impact, local_eye_pos):DistTo(local_eye_pos)
        if distance_between < 50 and GlobalVars.tickcount ~= last_switch_tick then
            anti_brute.timer = 3
            anti_brute.working = true
            anti_brute.cur_phase = anti_brute.cur_phase >= anti_brute.num_phases:Get()-1 and 0 or anti_brute.cur_phase + 1
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(3) then
            local swiched_due_antibrute = "Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"
            local swiched_due_antibrute2 = "Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"
            drawlog("[Anti-Bruteforce] ", 226, 39, 24, 255, swiched_due_antibrute2,swiched_due_antibrute)
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                logs[#logs+1] = {("Switched side due to anti-bruteforce ("..(anti_brute.cur_phase+1)..")("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)"), GlobalVars.tickcount + 150, 0}
            end
            last_switch_tick = GlobalVars.tickcount
        end
    end
    if event:GetName()=="round_start" then anti_brute.timer  = 0 anti_brute.working = false  end

end)


local abrute_pred = function()

    if not anti_brute.working then return end



    if (not anti_brute.working) or #anti_brute.phases==0  then return end
    if not menu_elements.switch:Get() then return end
   
    anti_brute.timer = anti_brute.timer - GlobalVars.interval_per_tick

    if anti_brute.timer < 0 then anti_brute.timer = 0 end
   

    if anti_brute.timer == 0 and (anti_brute.working )  then anti_brute.working= false  end




    --print(globals.abrute_phases , globals.abrute_phase , #ui.aa.phases)

    if anti_brute.phases[anti_brute.cur_phase +1] and anti_brute.working then
        AntiAim.OverrideInverter( anti_brute.phases[anti_brute.cur_phase +1]:Get() < 0)
        AntiAim.OverrideLimit(math.abs( anti_brute.phases[anti_brute.cur_phase +1]:Get()))
    end

end


verdana_logs = Render.InitFont("Verdana", 11, {'r'})
function logs_notify()
    local player = EntityList.GetLocalPlayer();
    if not player then return end
   
    local lifeState = player:GetProp("m_lifeState");
    if not lifeState then
local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
if lp == nil then return end
local x = EngineClient.GetScreenSize().x
local y = EngineClient.GetScreenSize().y
    if #logs > 0 then
    if GlobalVars.tickcount >= logs[1][2] then
        if logs[1][3] > 0 then
            logs[1][3] = logs[1][3] - 2
        elseif logs[1][3] <= 0 then
            table.remove(logs, 1)
        end
    end
    if #logs > 5 then
        table.remove(logs, 1)
    end
    for i = 1, #logs do
        ts = Render.CalcTextSize(logs[i][1], 11, verdana_logs)
        if logs[i][3] < 255 then logs[i][3] = logs[i][3] + 1 end
        if not enable_logs:Get() and not type2_of_logs:Get()==2 then return end
        Render.Blur(Vector2.new(math.min(50, logs[i][3]*2)-60 + x/2-ts.x/2, y-256+34*i), Vector2.new(math.min(50, logs[i][3]*2)-40 + x/2+ts.x/2, y-242+34*i+ts.y), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 100)
        Render.BoxFilled(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-256+34*i), Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2+math.min(ts.x, logs[i][3]*7), y-254+34*i), Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)))
        Render.BoxFilled(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2-math.min(ts.x, logs[i][3]*7), y-241+ts.y+34*i), Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2, y-243+ts.y+34*i), Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)))
        Render.Circle(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-243+34*i), 12, 32, Color.RGBA(185, 129, 235, math.min(255, logs[i][3]*5)), 2, 270-math.min(180, logs[i][3]*3), 270)
        Render.Circle(Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2+ts.x/2, y-243+34*i), 12, 32, Color.RGBA(185, 129, 235,math.min(255, logs[i][3]*5)), 2.5, 90, 90-math.min(180, logs[i][3]*3))
        Render.Text(logs[i][1], Vector2.new(math.min(50, logs[i][3]*2)-49 + x/2-ts.x/2, y-249+34*i), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text(logs[i][1], Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-250+34*i), Color.RGBA(255,255,255, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text("", Vector2.new(math.min(50, logs[i][3]*2)-49 + x/2-ts.x/2, y-249+34*i), Color.RGBA(0,0,0, math.min(255, logs[i][3]*5)), 11, verdana_logs)
        Render.Text("", Vector2.new(math.min(50, logs[i][3]*2)-50 + x/2-ts.x/2, y-250+34*i), Color.RGBA(185, 129, 235, math.min(255, logs[i][3]*5)), 11, verdana_logs)
    end
end
end
end


ffi = require("ffi")

ffi.cdef[[
    void* GetProcAddress(void* hModule, const char* lpProcName);
    void* GetModuleHandleA(const char* lpModuleName);
   
    typedef struct {
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    } color_struct_t;

    typedef void (*console_color_print)(const color_struct_t&, const char*, ...);

    typedef void* (__thiscall* get_client_entity_t)(void*, int);
]]

FindElement = ffi.cast("unsigned long(__thiscall*)(void*, const char*)", Utils.PatternScan("client.dll", "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28"))
CHudChat = FindElement(ffi.cast("unsigned long**", ffi.cast("uintptr_t", Utils.PatternScan("client.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08")) + 1)[0], "CHudChat")
FFI_ChatPrint = ffi.cast("void(__cdecl*)(int, int, int, const char*, ...)", ffi.cast("void***", CHudChat)[0][27])


function PrintInChat(text)
    FFI_ChatPrint(CHudChat, 0, 0, string.format("%s ", text))
end


handlers:subscribe("registered_shot", function(reg)
    if not enable_logs:GetBool() then return end
    local person = EntityList.GetClientEntity(reg.target_index)
    local missreason = reasons[reg.reason]
    local dmg = reg.damage
    local wdmg = reg.wanted_damage
    local hbox = hitboxes[reg.hitgroup] or "unknown"
    local whbox = hitboxes[reg.wanted_hitgroup]
    local safety = refs.baim:Get()
    local hc , bt = reg.hitchance , reg.backtrack
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
    cur_shot = cur_shot+1


    local pEnt = EntityList.GetPlayer(reg.target_index)
   
    if not pEnt then return end

    local hp = pEnt:GetProp("m_iHealth") - dmg < 0 and pEnt:GetProp("m_iHealth") or pEnt:GetProp("m_iHealth") - dmg

    local pweap = EntityList.GetLocalPlayer():GetActiveWeapon()

    if not pweap then return end
   

    if reg.reason ~=0 then
        if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(2) then
        local text_to_print = "["..cur_shot.."] Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"
        local text_to_print2 = "["..cur_shot.."] Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"
        drawlog("[Melonity] ", 185, 129, 235, 255, text_to_print2,text_to_print)
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(2) then
        logs:add(true , "Missed "..pEnt:GetName().." due to "..missreason )
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(2) and type3_of_logs:Get(4) then
        PrintInChat(" \x08Missed \x03"..pEnt:GetName().."\x08 due to \x07"..missreason.."\x08")
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==2 then
            logs[#logs+1] = {("Missed "..pEnt:GetName().."'s in "..whbox.." ("..wdmg..")".."("..hc.."%) due to "..missreason.." [ history(Δ): "..bt.." | angle: ".. math.floor(reg.spread_degree*100)/100 .."° ]"), GlobalVars.tickcount + 150, 0}
        end
        if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(2) and type_of_logs:Get(5)  then
            PrintInChat(" \x08[\x06"..cur_shot.."\x08] Missed "..pEnt:GetName().."'s in \x10"..whbox.."\x08 ("..wdmg..")".."("..hc.."%%) due to \x07"..missreason.."\x08 [ history(Δ): \x10"..bt.."\x08 | angle: \x09".. math.floor(reg.spread_degree*100)/100 .."\x08° ]")
        end
    else
        if pweap:GetClassID()~=268 then
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) then
            local text_to_print =  "["..cur_shot.."] Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | hc: "..hc .. "%% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")
            local text_to_print2 =  "["..cur_shot.."] Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | hc: "..hc .. "% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")
            drawlog("[Melonity] ", 185, 129, 235, 255, text_to_print2, text_to_print)
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) then
            logs:add( true, "Hit "..pEnt:GetName().." in the "..hbox.." for " ..dmg .." damage (".. (hp==0 and "killed)" or hp.." remaining)" ) )
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==1 and type3_of_logs:Get(1) and type3_of_logs:Get(4) then
            PrintInChat(" \x08Hit "..pEnt:GetName().." in the \x10"..hbox.."\x08 for \x07"..dmg.."\x08 damage (\x07"..(hp==0 and "\x08\x07killed\x08)" or hp.."\x08 remaining)"))
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==2 then
                logs[#logs+1] = {("Hit "..pEnt:GetName() .. " in "..hbox.. (whbox==hbox and "" or " (aimed = "..whbox..")").." for "..dmg.. (wdmg==dmg and "" or "("..wdmg..")").." damage [ history(Δ): "..bt.." | | hc: "..hc .. "% | safety: "..safety.." | health : "..(hp==0 and "*killed* ]" or hp .. " remaining ]")), GlobalVars.tickcount + 150, 0}
            end
            if enable_logs:GetBool() and type2_of_logs:Get()==0 and type_of_logs:Get(1) and type_of_logs:Get(5) then
                PrintInChat(" \x08[\x06"..cur_shot.."\x08] Hit "..pEnt:GetName() .. " in \x10"..hbox.. (whbox==hbox and "" or " \x08(aimed = \x0C"..whbox.."\x08)").."\x08 for \x07"..dmg.. (wdmg==dmg and "" or "\x08(\x10"..wdmg.."\x08)\x08").."\x08 damage [ history(Δ): \x10"..bt.."\x08 | hc: "..hc .. "%% | safety: "..safety.." | health : \x07"..(hp==0 and "\x08*\x07killed\x08* ]" or hp .. " \x08remaining ]"))
            end
        end
    end
end)
local clearlog = function()
    if #log ~= 0 then
        if EngineClient:IsConnected() == false then
            table.remove(log, #log)
        end
        if #log > 6 then
            table.remove(log, 1)
        end
        for i = 1, #log do
            if log[i] == nil then
                return
            end
            if log[i][3] + 4 > math.floor(GlobalVars.curtime) then
                return
            end
            log[i][2] = log[i][2]- math.floor(GlobalVars.frametime * 300)
   
            if log[i][2] < 0 then
                table.remove(log, i)
            end
        end
    end
end
local drawlog = function()
    clearlog()
    if not enable_logs:GetBool() then return end
    menu_windows_element_logs:SetBool(1, false)
    menu_windows_element_logs:SetBool(2, false)
    menu_windows_element_logs:SetBool(3, false)
    menu_windows_element_logs:SetBool(4, false)
    for i = 1, #log do
        Render.Text(""..log[i][1].."", Vector2.new(7 + 1, 5 + i * 12 + 1 - 12), Color.RGBA(0, 0, 0, log[i][2]), 10, console)
        Render.Text(""..log[i][1].."", Vector2.new(7, 5 + i * 12 - 12), Color.RGBA(255, 255, 255, log[i][2]), 10, console)
    end
end

quick_peek = Menu.Switch("> Misc", "Main", "[-] Quick Peek", false)

function setmovement(xz,yz,cmd)
    local local_player = EntityList.GetLocalPlayer()
    local_player = local_player:GetPlayer()
    local current_pos = local_player:GetProp("m_vecOrigin")
    local yaw = EngineClient:GetViewAngles().yaw
    local vector_forward = {
        x = current_pos.x - xz,
        y = current_pos.y - yz,
    }  
    local velocity = {
        x = -(vector_forward.x * math.cos(yaw / 180 * math.pi) + vector_forward.y * math.sin(yaw / 180 * math.pi)),
        y = vector_forward.y * math.cos(yaw / 180 * math.pi) - vector_forward.x * math.sin(yaw / 180 * math.pi),
    }
    cmd.forwardmove = velocity.x * 15
    cmd.sidemove = velocity.y * 15
end

function quickpeek_lua(cmd)
 
    local localplayer = EntityList.GetLocalPlayer()
    local forw = bit.band(cmd.buttons, 8) == 8
    local back = bit.band(cmd.buttons, 16) == 16
    local righ = bit.band(cmd.buttons, 512) == 512
    local left = bit.band(cmd.buttons, 1024) == 1024
 
    local apeek = Menu.FindVar("Miscellaneous", "Main", "Movement", "Auto Peek"):Get()
    local originalpos = localplayer:GetProp("m_vecOrigin")
    local OnGround = bit.band(localplayer:GetProp("m_hGroundEntity"), 1);
 
    if OnGround == 1 then
        air = true
    else
        air = false
    end
    if apeek == false then
        curpos = localplayer:GetProp("m_vecOrigin");
    end
    if quick_peek:Get() == true then
        if apeek == true then
            if forw == false and back == false and left == false and righ == false and curpos.x ~= originalpos.x and curpos.y ~= originalpos.y and air == false then
                setmovement(curpos.x,curpos.y, cmd);
            end
        end
    end
end

local function get_local_player()
    if not EngineClient:IsConnected() then return end
    local local_client = EntityList.GetClientEntity(EngineClient:GetLocalPlayer())
    local local_player = local_client:GetPlayer()

    return local_player
  end

local Infinity_X_DT = Menu.SliderInt("> Visuals", "Visuals", "X_DT", 350, 350, 5120)
local Infinity_Y_DT = Menu.SliderInt("> Visuals", "Visuals", "Y_DT", 350, 350, 5120)

Infinity_X_DT:SetVisible(false)
Infinity_Y_DT:SetVisible(false)

local dt_type = "Default"
local TICKBASE = refs.dt:GetBool() and 14 or 7

local FONT_VERDANA_12 = Render.InitFont("Arial", 11)
local FONT_BULLET = Render.InitFont("nl\\Melonity Solutions\\fonts\\bullet.ttf", 24)
local windows_text_size123 = 11

local non_dt_weapons =
{
    "CKnife",
    "CHEGrenade",
    "CMolotovGrenade",
    "CIncendiaryGrenade",
    "CFlashbang",
    "CDecoyGrenade",
    "CSmokeGrenade",
    "CWeaponTaser",
    "CC4"
}

local one_bullet_weapons = {
  "CWeaponSSG08",
  "CWeaponAWP",
  "CWeaponScout",
  "CWeaponAWP",
}

local dt_alpha = 1


local ticks_to_time = function(t) return t*GlobalVars.interval_per_tick  end

function intersect(x, y, w, h)
  local c = Cheat.GetMousePos()

  return c.x >= x and c.x <= x + w and c.y >= y and c.y <= y + h
end

local dragging = false

local dt_pos_x, dt_pos_y = Infinity_X_DT:GetInt(), Infinity_Y_DT:GetInt()
local dt_drag_pos_y, dt_drag_pos_x = 0, 0
local tickbase_w = 0
local tickbase_h = 0
local fire_alpha = 0
local bullet_alpha = 0
local function render_dt_indicator()
if not tickbase_enable:Get() or not keybinds_123:Get() then return end
  local local_player = get_local_player()
  TICKBASE = refs.dt:GetBool() and 14 or 7
  if not EngineClient:IsConnected() or local_player:GetProp("m_iHealth") <= 0 then
    return
  end

  if tickbase_enable:Get() and keybinds_123:Get() then
    local charge = Exploits.GetCharge()
    local charged_ticks = math.abs(math.floor((charge * TICKBASE) + 0.5))

    local screen_size = EngineClient:GetScreenSize()
    local padding, margin = 4.0, 18.0
    local dt_accent = tickbase_indicator_color:GetColor()

    local text = "DT [v1.0 release] | tickbase: " .. charged_ticks
    local text_size = Render.CalcTextSize(text, 11, FONT_VERDANA_12)

    local weapon = local_player:GetActiveWeapon()

    if not weapon then return end

    local weapon_idx = weapon:GetProp("m_iItemDefinitionIndex")
    local weapon_name = weapon:GetClassName()
    local icon_size = Render.CalcWeaponIconSize(weapon_idx, 16)

    local mouse_pos = Cheat.GetMousePos()
    local left_click = Cheat.IsKeyDown(0x01)

    if Cheat.IsMenuVisible() then
      if dragging and not left_click then
        dragging = false
      end

      if dragging and left_click then
        dt_pos_x = mouse_pos.x - dt_drag_pos_x
        dt_pos_y = mouse_pos.y - dt_drag_pos_y
      end

      if intersect(dt_pos_x, dt_pos_y, text_size.x - margin,  (margin - padding + text_size.y + padding * 2)) and left_click then
        dragging = true
        dt_drag_pos_x = mouse_pos.x - dt_pos_x
        dt_drag_pos_y = mouse_pos.y - dt_pos_y
      end
    end

    Infinity_X_DT:SetInt(dt_pos_x)
    Infinity_Y_DT:SetInt(dt_pos_y)

    local lp = EntityList.GetLocalPlayer()
       

    local can_fire  =  GlobalVars.curtime - weapon:GetProp("m_flNextPrimaryAttack") > -0.05

   

    local trying_to_charge = refs.dt:GetBool() or refs.hs:GetBool()

    if not trying_to_charge  then
      dt_alpha = dt_alpha - 3 * GlobalVars.frametime
      dt_alpha = clamp(dt_alpha, 0, 1)
    else
      dt_alpha = dt_alpha + 3 * GlobalVars.frametime
      dt_alpha = clamp(dt_alpha, 0, 1)
    end
   

    if not can_fire then
        fire_alpha = fire_alpha - 3*GlobalVars.frametime
        fire_alpha = clamp(fire_alpha, 0, 1)
    else

        fire_alpha = fire_alpha + 3*GlobalVars.frametime
        fire_alpha = clamp(fire_alpha, 0, 1)
    end
   

    local dt_color = Color.new(dt_accent.r, dt_accent.g, dt_accent.b, (1.0 * dt_alpha))

    local bullets = ""

    local bool_wpn = true
    local bool_one_bullet = false


    for i = 1, #non_dt_weapons do
      if weapon_name == non_dt_weapons[i] then
        bool_wpn = false
      end
    end
    for i = 1, #one_bullet_weapons do
      if weapon_name == one_bullet_weapons[i] then
        bool_one_bullet = true
      end
    end

    if charge > 0.95 then
      bullets = "AA"
    elseif charge < 0.95 then
      bullets = ""
    end

    if bool_wpn == false then
      bullets = ""
    end

    if bool_one_bullet == true then
      bullets = "A"
    end


    local tickbase_color = Color.new(tickbase_indicator_color:GetColor().r, tickbase_indicator_color:GetColor().g, tickbase_indicator_color:GetColor().b, dt_alpha)
    dt_color = (refs.hs:GetBool() and not refs.dt:Get() ) and Color.new(0.2 ,1, 0.2 , dt_alpha) or dt_color
    local dt_color2 = Color.new(tickbase_color.r , tickbase_color.g , tickbase_color.b , math.sin(math.rad(GlobalVars.tickcount % 360)*2) )
    local wsss = (text_size.x + padding * 2)/2
    tickbase_w = helpers.lerp(tickbase_w , (text_size.x + padding * 2)*charge , 0.095 )
    tickbase_h = helpers.lerp(tickbase_h , (margin+3)*charge , 0.095 )
   


    Render.GradientBoxFilled(Vector2.new(dt_pos_x, dt_pos_y+margin+2), Vector2.new(dt_pos_x-1 , dt_pos_y-tickbase_h+margin+2 ), tickbase_color , tickbase_color , dt_color2 , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+wsss*2, dt_pos_y+margin+2), Vector2.new(dt_pos_x+1+wsss*2 , dt_pos_y-tickbase_h+margin+2 ), tickbase_color , tickbase_color , dt_color2 , dt_color2)
    Render.BoxFilled(Vector2.new(dt_pos_x, dt_pos_y), Vector2.new(dt_pos_x + text_size.x + padding * 2, dt_pos_y + text_size.y + padding * 2), Color.new(0, 0, 0, 0.2 * dt_alpha))
    Render.GradientBoxFilled(Vector2.new(dt_pos_x, dt_pos_y+margin+2), Vector2.new(dt_pos_x + tickbase_w/2 , dt_pos_y +1+margin), tickbase_color , dt_color2 , tickbase_color , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+text_size.x + padding * 2-tickbase_w/2, dt_pos_y+margin+2), Vector2.new(dt_pos_x + text_size.x + padding * 2 , dt_pos_y +1+margin), dt_color2 , tickbase_color , dt_color2 , tickbase_color)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+wsss, dt_pos_y), Vector2.new(dt_pos_x+wsss-tickbase_w/2 , dt_pos_y - 1), tickbase_color , dt_color2 , tickbase_color , dt_color2)
    Render.GradientBoxFilled(Vector2.new(dt_pos_x+ wsss, dt_pos_y), Vector2.new(dt_pos_x+wsss +tickbase_w/2 , dt_pos_y - 1), tickbase_color , dt_color2 , tickbase_color , dt_color2)

    Render.WeaponIcon(weapon_idx, Vector2.new(dt_pos_x, dt_pos_y + 24), Color.new(1.0, 1.0, 1.0, (1.0 * dt_alpha)), 16)
    Render.Text(text, Vector2.new(dt_pos_x + padding, dt_pos_y + padding), Color.new(0.95, 0.95, 0.95, (1.0 * dt_alpha)), windows_text_size123, FONT_VERDANA_12, false)
    if bool_wpn and fire_alpha>0  then
        Render.Text("A", Vector2.new(dt_pos_x + padding + icon_size.x * 1.1, dt_pos_y + 19), Color.new(1.0, 1.0, 1.0, fire_alpha * dt_alpha) , 24, FONT_BULLET, false)
    end
    if not bool_one_bullet and charge>0.55 and bool_wpn and not refs.hs:GetBool() and refs.dt:Get()  then
        Render.Text("A", Vector2.new(dt_pos_x + padding + icon_size.x * 1.1 + Render.CalcTextSize("A", 24,FONT_BULLET).x, dt_pos_y + 19), Color.new(1.0, 1.0, 1.0, dt_alpha*fire_alpha), 24, FONT_BULLET, false)
    end
  end
end

ttonkill = Menu.Switch("> Misc", "Other", "[-] Killsay", false)
languageonkill = Menu.Combo("> Misc", "Other", "Select Language", {"Russian", "English", "Poland", "Romanian"}, 0)

local phrases = {
    "лучшая луа на маркете - https://shoppy.gg/@melonity",
    "куда улетел тапочек Melonity лучшая луа",
    "устал улетать с первой пули? Освежись https://shoppy.gg/@melonity",
    "я - обладатель Melonity, понюхай бебру",
    "я освежился новеньким апдейтом в Melonity - тебе пиздец",
    "отдохни, я Melonity юзер",
    "MELONITY АКТИВИРОВАН Д-Д-Д-ДДДОМИНАЦИЯЯЯЯЯЯЯ",
    "Melonity > ALL",
    "1 пидорасина ебаная спи",
    "l2p bot",
    "iq ? HAHAHA",
    "BY SANCHEZJ (◣_◢)",
    "sleep",
    "обоссан",
    "GLhf.exe Activated",
    "ᛈᗗᛈᗴῷ Кᗗᛕ δ৮ᛈᛠᚦᚖאᚖᚨนҋ",
    "ᛈᗗᛈᗗለᗗ ᛠ৮ ᛈᚖᛒᛈᗴᛗ",
    "ты понимаешь, что клитор твоей матери эта зона чрезвычайно опасная ??",
    "сру в тя в классе",
    "У тебя бешенство начинается?",
    "Звучит, как иди на хуй",
    "Это выгодно мне/тебе/нам",
    "ой иди на хуй !!!!",
    "похуй я Же говорю я Бобрик из Гетто!",
    "как же я с тебя ору",
    "НЕ делай одолжений, просто делай мне минет!",
    "хуем тибя щас уебу)0",
    "сасеш норм)0",
    "чота ты сосешь мне)0",
    "чота мать тваю выкинул)0",
    "гариш слетая)0",
    "ЕБАТЬ ТЫ НИЩИЙ, СОСИ)0))",
    "УБИТО СОСЁШЬ МНЕ, КУКОЛД)0))",
    "нихуя я тя красиво бомбанул",
    "может уже купишь луашку Melonity? Я устал тебя ебашить((",
    "легко сочнярик",
    "уебище учись играть",
    "изи мусорила ебанная",
    "я твоей матери горло ёршиком промывал что бы заглатывала лучше ебаная свинья",
    "ебаный сын подъезда как ты пикаешь",
    "сын ебаной жирной жабы",
    "освежись новеньким апдейтом shoppy.gg/@melonity"
   
}

local english = {
    "1 hs dog",
    "stop talking buy unhittable lua - shoppy.gg/@melonity",
    '˜”°•.˜”°• 1 by shoppy.gg/@melonity •°”˜.•°”˜',
    "sit down",
    "nice iq dog",
    "HAHAH IQ?",
    "killed by bao",
    "killed by clockedj",
    "1tap uff yaa$$$",
    "hs churka",
    "killed by jurka pidoras",
    "1v1? 2v2? 5v5? add me jurka#1234",
    "make blowjob for me",
    "iqless???",
    "iq?",
    "tap tap uff",
    "XANE $$$",
    "i fuck your mum dog hahah",
    "kiss my ass owo",
    "tap tap femboy",
    "femboy you got HS"
}

local poland = {
    "Ssij knage rozjebańcu",
    "Łatwe jak wyrwanie twojej matki",
    "Hedzik smieciu",
    "Mam wyłączony monitor i nadal cie rozpierdalam Xd?",
    "Wypierdalaj skurwysynku",
    "Szmato rozjebal bym ci głowe",
    "Pierdol sie lamusie",
    "O ty kurwo bez jąder",
    "Zabawne jest to ze twoja matka opierdala mi gałe a ja cie rozpierdalam w tym samym momencie",
    "Kolego wracaj na uwujka",
    "Szmato rozjebal bym ci głowe"


}

local romanian = {
    'stai jos dog',
    'futus morti matti dog buy superior lua shoppy.gg/@melonity',
    'sugi pula',
    'Ai cumva cheat-ul ala de la Llama?',
    '˜”°•.˜”°• 1 by shoppy.gg/@melonity •°”˜.•°”˜',
    'efortless',
    'foaie verde castravete ti-am dat 1 prin perete',
    'cand pun ochiu in luneta o vad pe ma-ta pe mocheta',
    'Juan ',
    'foaie verde si-o spatula ti-am dat cap cu ma-ta-n pula',
    'shoppy.gg/@melonity ez taps $$$',
    'mama coaie am dat click manual zici ca sunt alien cosminel',
    '1 by esoterik bro',
    '1 by pleata lui darth',
    'foaie verde be the heda ti-ai luat tap de la wanheda',
    'fie viata cat de grea iti dau tap ce pula mea',
    'foaie verde butelie intra glontu in chelie',
    'hacker de sentimente sparg capuri si apartamente',
    'skeet in buzunare sa-i dau tap lui fleeekkk',
    'Priveste partea buna, macar ai dat 100 damage la peretele din spatele meu !',
    'ESC --> Help & Options --> How to Play',
    '1 1 1 VeRy NeRvOs hEaDsHoT 1 1 1',
    'Pt fetele gravide recomand skeet cu vitamine.',
    '1 tie 1 lui ma-ta',
    'Asa a dat si ma-ta ochii peste cum ai dat tu cu capul',
    'futu-ti mortii ma-tii sa-ti fut de taran',
    'Tragem pula in mamele voastre!!!',
    'Te-ai speriat? Eu da!',
    'ai capul ala zici ca e made in china',
    'da-te ca-mi bag pula',
    'ai gresit 1way-ul',
    'alo baiatu, te-ai pierdut ? iti bag waze-u ?',
    'Ai corpul ala zici ca e halba de bere.',
    'ai corpul ala zici ca e lumanare de botez.',
    'VeRy NeRvoS BaIm',
    'shoppy.gg/@melonity peek',
    'stai jos caine',
    'Tu si Oana Roman ce mai stati cu burta pe afara.',
    'apas f pt tine <3',
    'scz eram cu legitbotu on',
    'rostogoli-mi-as pula-n ma-ta cum se rostogoleste crocodilu-n apa',
    'coaie ce corp ai zici ca esti desenat cu stanga',
    'uffya BaIm GoD $$ shoppy.gg/@melonity',
    'foaie verde de cucuta hai la tata sa te futa',
    'aleluia ai luat muia .!.',
    'Get Good. Get shoppy.gg/@melonity',
    'nice desync, esti cu eternity ?',
    'lol aveam resolver-ul off.',
    'Cel mai nervos baim din viata mea',
    'asta ajunge la war montage ms ms',
    'BaIm bAiM BaIm',
    'ceapa verde foaie iute uite baimu cum se duce',
    'Foaie verde praf de ciori iti iei baim pana mori',
    'Foaie verde si-o lamaie iti dau baim si iei muie',
    'foaie verde acadea ia cu baim in pula mea',
    'sunt haiduc cunoscut, iti dau pula la pascut',
    'sunt tac-tu, hai sa-ti dau lape',
    'ba..nu stiu cum sa-ti spun, dar...isi mai da ma-ta filme ca-i pompier de cand i-am pus pula peste umar?',
    'sa-ti pun pula pe piept ',
    'hai back to canal boschetare',
    'hai la gratar sa-ti frig o muie',
    "smecherii fut",
    "fraierii isi iau cap"
}

local function get_phrase()
    return phrases[Utils.RandomInt(1, #phrases)]:gsub('\"', '')
end

local function get_phrase2()
    return english[Utils.RandomInt(1, #english)]:gsub('\"', '')
end

local function get_phrase3()
    return poland[Utils.RandomInt(1, #poland)]:gsub('\"', '')
end

local function get_phrase4()
    return romanian[Utils.RandomInt(1, #romanian)]:gsub('\"', '')
end

handlers:subscribe("events", function(event)
    if not ttonkill:Get() then return end
    if event:GetName() ~= "player_death" then return end

    local me = EntityList.GetLocalPlayer()
    local victim = EntityList.GetPlayerForUserID(event:GetInt("userid"))
    local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker"))

    if victim == attacker or attacker ~= me then return end

    if languageonkill:GetInt()==0 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase() .. '"')
    end
    if languageonkill:GetInt()==1 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase2() .. '"')
    end
    if languageonkill:GetInt()==2 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase3() .. '"')
    end
    if languageonkill:GetInt()==3 then
    EngineClient.ExecuteClientCmd('say "' .. get_phrase4() .. '"')
    end
end)

local dmg_marker = Menu.Switch("> Visuals", "Misc" , "[-] Damage Marker" , false)
local dmg_marker_color = Menu.ColorEdit("> Visuals", "Misc", "Damage Marker color", Color.RGBA(185, 129, 235, 255))
local dmg_marker_windows = Menu.FindVar("Visuals", "World", "Misc", "Damage Indicator")

local scope_line = {}

scope_line.var = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope")
scope_line.screen = EngineClient:GetScreenSize()
scope_line.ref = scope_line.var:Get()

scope_line.menu = {}



scope_line.menu.enable = Menu.Switch("> Visuals", "Misc", "[-] Enable Custom Scope", false)
viewmodel_in_scope = Menu.Switch("> Visuals", "Misc", "Viewmodel In Scope", false)
function viewmodel_in_scope2()
    local cheats = CVar.FindVar("sv_cheats")
    local scope = CVar.FindVar("fov_cs_debug")
    if viewmodel_in_scope:Get() and scope_line.menu.enable:Get() then
        cheats:SetInt(1)
        scope:SetInt(90)
    else
        scope:SetInt(0)
    end
end
scope_line.menu.anim_speed = Menu.SliderInt("> Visuals", "Misc", "Animation Speed", 15, 1, 30)
scope_line.menu.offset = Menu.SliderInt("> Visuals", "Misc", "Offset", 10, 0, 500)
scope_line.menu.length = Menu.SliderInt("> Visuals", "Misc", "Length", 28, 0, 1000)
scope_line.menu.col_1 = Menu.ColorEdit("> Visuals", "Misc", "Color", Color.RGBA(255, 255, 255))
scope_line.menu.col_2 = Menu.ColorEdit("> Visuals", "Misc", "Color 2", Color.RGBA(255, 255, 255, 0))

scope_line.menu.col_2:SetVisible(false)

scope_line.anim_num = 0

scope_line.lerp = function(a, b, t)
    return a + (b - a) * t
end

scope_line.on_draw = function()
    if not scope_line.menu.enable:GetBool() then scope_line.var:SetInt(1) return end
    scope_line.var:SetInt(2)

    local_player = EntityList.GetLocalPlayer()
    scope_line.anim_speed = scope_line.menu.anim_speed:Get()

    if not local_player or not local_player:IsAlive() or not local_player:GetProp("m_bIsScoped") then
        scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 0, scope_line.anim_speed * GlobalVars.frametime)
    else
        scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 1, scope_line.anim_speed * GlobalVars.frametime)
    end

    scope_line.offset = scope_line.menu.offset:Get() * scope_line.anim_num
    scope_line.length = scope_line.menu.length:Get() * scope_line.anim_num
    scope_line.col_1 = scope_line.menu.col_1:Get()
    scope_line.col_2 = scope_line.menu.col_2:Get()
    scope_line.width = 1

    scope_line.col_1.a = scope_line.col_1.a * scope_line.anim_num
    scope_line.col_2.a = scope_line.col_2.a * scope_line.anim_num
   
    scope_line.start_x = scope_line.screen.x / 2
    scope_line.start_y = scope_line.screen.y / 2
   

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x - scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x - scope_line.offset - scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x + scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x + scope_line.offset + scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y + scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y + scope_line.offset + scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)

    Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y - scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y - scope_line.offset - scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)
end


function C_BasePlayer:CanHit()
    local Localplayer = EntityList.GetLocalPlayer()
    local TraceInfo = Cheat.FireBullet(self, self:GetEyePosition(), Localplayer:GetEyePosition())

    if (TraceInfo.damage > 0 and ((TraceInfo.trace.hit_entity and TraceInfo.trace.hit_entity:GetPlayer() == Localplayer) or false)) then
        return true
    end

    return false
end

function C_BasePlayer:GetFlag(shift)
    return bit.band(self:GetProp("m_fFlags"), bit.lshift(1, shift)) ~= 0
end

function GetEnemies()
    local Enemies = {}

    for _, Player in pairs(EntityList.GetPlayers()) do
        if (not Player:IsTeamMate() and Player:IsAlive()) then
            table.insert(Enemies, Player:GetPlayer())
        end
    end

    return Enemies
end

function teleport_in_air_dt()
    if (menu_elements.teleport_in_air:Get() and menu_elements.teleport_weapons:Get() ~= 0 and refs.dt:Get()) then
        local Allow_Work = false
        local Need_Teleport = false

        local Localplayer = EntityList.GetLocalPlayer()
        local Weapon = Localplayer:GetActiveWeapon()
        local WeaponID = Weapon:GetWeaponID()

        local IsScout = WeaponID == 40
        local IsAWP = WeaponID == 9
        local IsPistols = Weapon:IsPistol()
        local IsZeus = WeaponID == 31
        local IsKnife = Weapon:IsKnife()
        local IsNades = Weapon:IsGrenade()

        for i, Weapons in pairs({
            IsScout,
            IsAWP,
            IsPistols,
            IsZeus,
            IsKnife,
            IsNades,
            not (IsScout or IsAWP or IsPistols or IsZeus or IsKnife or IsNades)
        }) do
            if (menu_elements.teleport_weapons:Get(i) and Weapons) then
                Allow_Work = true
            end
        end

        if (Allow_Work) then
            for _, Enemy in pairs(GetEnemies()) do
                if (not Enemy:IsDormant() and Enemy:CanHit()) then
                    Need_Teleport = true
                end
            end
        end

        if (Need_Teleport and not Localplayer:GetFlag(0)) then
            Exploits.ForceTeleport()
        end
    end
end


local DoAntiDefensive = function()
    if menu_elements.anti_defensive:Get() == true then
        EngineClient.ExecuteClientCmd("spectate")
        CVar.FindVar("cl_lagcompensation"):SetInt(0)
    else
        EngineClient.ExecuteClientCmd("spectate")
        CVar.FindVar("cl_lagcompensation"):SetInt(1)
    end
end
menu_elements.anti_defensive:RegisterCallback(DoAntiDefensive)

local get_condition = function ()
    local lp = EntityList.GetLocalPlayer()
    if lp:GetProp("m_flDuckAmount") > 0.89 and not refs.fd:Get()  then return "CROUCHING"
    elseif lp:GetProp("m_vecVelocity"):Length() < 2 then return "STANDING"
    elseif refs.sw:Get() then return "SLOW-WALKING"
    elseif bit.band(lp:GetProp("m_fFlags"), 1) == 0 then return "AIR"
    else return "MOVING" end
end

local font_debug = Render.InitFont("Tahoma" , 12 ,{'b' })

ffi.cdef [[
    int VirtualProtect(void* lpAddress, unsigned long dwSize, unsigned long flNewProtect, unsigned long* lpflOldProtect);
    void* VirtualAlloc(void* lpAddress, unsigned long dwSize, unsigned long  flAllocationType, unsigned long flProtect);
    int VirtualFree(void* lpAddress, unsigned long dwSize, unsigned long dwFreeType);

    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
    typedef bool ( __thiscall* setupbones_t)( void*, void*, int, int, float );
    typedef struct
    {
        float x;
        float y;
        float z;
    } Vector_t;

    typedef struct
  {
      char    pad0[0x60]; // 0x00
      void* pEntity; // 0x60
      void* pActiveWeapon; // 0x64
      void* pLastActiveWeapon; // 0x68
      float        flLastUpdateTime; // 0x6C
      int            iLastUpdateFrame; // 0x70
      float        flLastUpdateIncrement; // 0x74
      float        flEyeYaw; // 0x78
      float        flEyePitch; // 0x7C
      float        flGoalFeetYaw; // 0x80
      float        flLastFeetYaw; // 0x84
      float        flMoveYaw; // 0x88
      float        flLastMoveYaw; // 0x8C // changes when moving/jumping/hitting ground
      float        flLeanAmount; // 0x90
      char    pad1[0x4]; // 0x94
      float        flFeetCycle; // 0x98 0 to 1
      float        flMoveWeight; // 0x9C 0 to 1
      float        flMoveWeightSmoothed; // 0xA0
      float        flDuckAmount; // 0xA4
      float        flHitGroundCycle; // 0xA8
      float        flRecrouchWeight; // 0xAC
      Vector_t        vecOrigin; // 0xB0
      Vector_t        vecLastOrigin;// 0xBC
      Vector_t        vecVelocity; // 0xC8
      Vector_t        vecVelocityNormalized; // 0xD4
      Vector_t        vecVelocityNormalizedNonZero; // 0xE0
      float        flVelocityLenght2D; // 0xEC
      float        flJumpFallVelocity; // 0xF0
      float        flSpeedNormalized; // 0xF4 // clamped velocity from 0 to 1
      float        flRunningSpeed; // 0xF8
      float        flDuckingSpeed; // 0xFC
      float        flDurationMoving; // 0x100
      float        flDurationStill; // 0x104
      bool        bOnGround; // 0x108
      bool        bHitGroundAnimation; // 0x109
      char    pad2[0x2]; // 0x10A
      float        flNextLowerBodyYawUpdateTime; // 0x10C
      float        flDurationInAir; // 0x110
      float        flLeftGroundHeight; // 0x114
      float        flHitGroundWeight; // 0x118 // from 0 to 1, is 1 when standing
      float        flWalkToRunTransition; // 0x11C // from 0 to 1, doesnt change when walking or crouching, only running
      char    pad3[0x4]; // 0x120
      float        flAffectedFraction; // 0x124 // affected while jumping and running, or when just jumping, 0 to 1
      char    pad4[0x208]; // 0x128
      float        flMinBodyYaw; // 0x330
      float        flMaxBodyYaw; // 0x334
      float        flMinPitch; //0x338
      float        flMaxPitch; // 0x33C
      int            iAnimsetVersion; // 0x340
  } CCSGOPlayerAnimationState_534535_t;

  struct animlayer_s {
    float   m_anim_time;
    float   m_fade_out_time;
    int     m_flags;
    int     m_activty;
    int     m_priority;
    int     m_order;    
    int     m_sequence;
    float   m_prev_cycle;
    float   m_weight;
    float   m_weight_delta_rate;
    float   m_playback_rate;
    float   m_cycle;
    int     m_owner;
    int     m_bits;
};
]]

local hook = {hooks = {}}

local ENTITY_LIST_POINTER = ffi.cast("void***", Utils.CreateInterface("client.dll", "VClientEntityList003")) or error("Failed to find VClientEntityList003!")
local GET_CLIENT_ENTITY_FN = ffi.cast("uintptr_t (__thiscall*)(void*, int)", ENTITY_LIST_POINTER[0][3])

local ffi_helpers = {
    get_entity_address = function(entity_index)
        local addr = GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER, entity_index)
        return addr
    end
}

function hook.new(cast, callback, hook_addr, size, trampoline, org_bytes_tramp)
    local size = size or 5
    local trampoline = trampoline or false
    local new_hook, mt = {}, {}
    local detour_addr = tonumber(ffi.cast('intptr_t', ffi.cast('void*', ffi.cast(cast, callback))))
    local void_addr = ffi.cast('void*', hook_addr)
    local old_prot = ffi.new('unsigned long[1]')
    local org_bytes = ffi.new('uint8_t[?]', size)
    ffi.copy(org_bytes, void_addr, size)
    if trampoline then
        local alloc_addr = ffi.gc(ffi.C.VirtualAlloc(nil, size + 5, 0x1000, 0x40), function(addr) ffi.C.VirtualFree(addr, 0, 0x8000) end)
        local trampoline_bytes = ffi.new('uint8_t[?]', size + 5, 0x90)
        if org_bytes_tramp then
            local bytes = {}
            for byte in org_bytes_tramp:gmatch('(%x%x)') do
                table.insert(bytes, tonumber(byte, 16))
            end
            trampoline_bytes = ffi.new('uint8_t[?]', size + 5, bytes)
        else
            ffi.copy(trampoline_bytes, org_bytes, size)
        end
        trampoline_bytes[size] = 0xE9
        ffi.cast('uint32_t*', trampoline_bytes + size + 1)[0] = hook_addr - tonumber(ffi.cast('intptr_t', ffi.cast('void*', ffi.cast(cast, alloc_addr)))) - size
        ffi.copy(alloc_addr, trampoline_bytes, size + 5)
        new_hook.call = ffi.cast(cast, alloc_addr)
        mt = {__call = function(self, ...)
            return self.call(...)
        end}
    else
        new_hook.call = ffi.cast(cast, hook_addr)
        mt = {__call = function(self, ...)
            self.stop()
            local res = self.call(...)
            self.start()
            return res
        end}
    end
    local hook_bytes = ffi.new('uint8_t[?]', size, 0x90)
    hook_bytes[0] = 0xE9
    ffi.cast('uint32_t*', hook_bytes + 1)[0] = detour_addr - hook_addr - 5
    new_hook.status = false
    local function set_status(bool)
        new_hook.status = bool
        ffi.C.VirtualProtect(void_addr, size, 0x40, old_prot)
        ffi.copy(void_addr, bool and hook_bytes or org_bytes, size)
        ffi.C.VirtualProtect(void_addr, size, old_prot[0], old_prot)
    end
    new_hook.stop = function() set_status(false) end
    new_hook.start = function() set_status(true) end
    new_hook.start()

    table.insert(hook.hooks, new_hook)
    return setmetatable(new_hook, mt)
end
--HOOKS
local updatecsa_address = Utils.PatternScan("client.dll", "8B F1 80 BE ? ? ? ? ? 74 36", -5)
function starthooks()
    updateCSA_fn = hook.new('void(__fastcall*)(void*, void*)', updateCSA_hk, ffi.cast("uintptr_t", updatecsa_address))
end
--FUNNY 113 42 262!!! 223 192 15 7  10 11

local time_on_land = 1000

function updateCSA_hk(thisptr, edx)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if not localplayer then return updateCSA_fn(thisptr, edx) end
    local lp_ptr = ffi_helpers.get_entity_address(EngineClient.GetLocalPlayer())
    local ref_slide = Menu.FindVar("Aimbot", "Anti Aim", "Misc", "Leg Movement")

    if not enable_animation_breaker:Get() then    updateCSA_fn(thisptr, edx) return end
    if animation_breaker:GetBool(2) then
        if not enable_animation_breaker:Get() then return end
        ref_slide:SetInt(1)
        ffi.cast("float*" , lp_ptr+10104)[0] = Utils.RandomInt(0,1)
        end

    if  not ( animation_breaker:GetBool(1)  or animation_breaker:GetBool(3)) or not enable_animation_breaker:Get()  then    updateCSA_fn(thisptr, edx) return end

    if animation_breaker:GetBool(1) then
        ffi.cast("float*" , lp_ptr+10104)[6] = 1
    end
    if animation_breaker:GetBool(3) then
        if bit.band(localplayer:GetProp("m_fFlags") , 1 ) == 0 then
            time_on_land = 0
        end

        time_on_land = time_on_land + 0.05

        if time_on_land < 25 and time_on_land > 1 then
            ffi.cast("float*" , lp_ptr+10104)[12] = 0.5
        end
    end


    updateCSA_fn(thisptr, edx)

    if animation_breaker:GetBool(1) then
        ffi.cast("float*" , lp_ptr+10104)[6] = 1
    end

    if animation_breaker:GetBool(3) then
        if bit.band(localplayer:GetProp("m_fFlags") , 1 ) == 0 then
            time_on_land = 0
        end

        time_on_land = time_on_land + 0.05

        if time_on_land < 25 and time_on_land > 1 then
            ffi.cast("float*" , lp_ptr+10104)[12] = 0.5
        end
    end


end


handlers:subscribe("events" , function(e)

    if e:GetName()=="player_death" then
         time_on_land = 1000
    end

    if e:GetName()=="round_start" then
        time_on_land = 1000
    end

end)


handlers:subscribe("destroy" , function ()
    for i, hook in ipairs(hook.hooks) do
        if hook.status then
            hook.stop()
        end
    end
end)

d_switch = Menu.Switch("> Rage", "Main",  "[+] Dormant Aimbot", false, "Makes Aimbot shoots at dormant targets.")
d_min_damage = Menu.SliderInt("> Rage", "Main",  "Minimum Damage", 1, 1, 100)


local calc_angle = function(src, dst)
    local vecdelta = Vector.new(dst.x - src.x, dst.y - src.y, dst.z - src.z)
    local angles = QAngle.new(math.atan2(-vecdelta.z, vecdelta:Length2D()) * 180.0 / math.pi, (math.atan2(vecdelta.y, vecdelta.x) * 180.0 / math.pi), 0.0)
    return angles
end

local function dormant_aimbot()



    local scan_data = {
        point = nil,
        damage = d_min_damage:Get(),
        hit_ent = nil,
        name = "",
        tick = 0,
    }

    local get_ent_ptr = function(ent)
        if not ent then return nil end
        return GET_CLIENT_ENTITY_FN(ENTITY_LIST_POINTER , ent:EntIndex())
    end
   
    local accepted_weapons = {[261]=1, [242]=1, [233]=1, [267]=1}


    handlers:subscribe("createmove" , function(cmd)
        if not d_switch:Get() then return end
        scan_data = {
            point = nil,
            damage = d_min_damage:Get(),
            hit_ent = nil,
            name = "",
            tick = 0,
        }
        local lp = EntityList.GetLocalPlayer()
        local shoot_pos = EntityList.GetLocalPlayer():GetEyePosition()
        for _ , player in pairs(EntityList.GetPlayers()) do
            if not player or player:IsTeamMate() or not player:IsAlive() or not player:IsDormant() or player:GetNetworkState() ==-1 or player:GetNetworkState()==4 then goto skip end
         
         
            local pos = player:GetProp("m_vecOrigin")
            local ang = math.rad(calc_angle(shoot_pos , pos).yaw)
            local check_visible = EngineTrace.TraceRay(shoot_pos , pos + Vector.new(0,0,40) , lp , 0xFFFFFFFF)
            if check_visible.fraction ==1 then
            --    print_dbg("vis")
                goto skip end
            for k = 30, 45, 5 do -- get points from bbmins , bbmaxs
                for j = -4, 4, 4 do
                    local point = pos + Vector.new(  j*math.sin(ang) ,  -j*math.cos(ang),  k)
                    local fire_data = Cheat.FireBullet(EntityList.GetLocalPlayer() , shoot_pos , point)
                 
                    if fire_data.damage >=  scan_data.damage and not fire_data.trace.hit_entity  then
                        scan_data.point = point
                        scan_data.damage = fire_data.damage
                        scan_data.hit_ent = player
                        scan_data.tick = GlobalVars.tickcount
                        scan_data.name = player:GetName()
                        return
                    end
                end
            end
            ::skip::  
        end


       

    end )


    handlers:subscribe("pre_prediction" , function(cmd)
       
        if not d_switch:Get() then return end
     
        if not scan_data.point or not scan_data.hit_ent or not scan_data.hit_ent:IsDormant() or not scan_data.name or scan_data.tick == 0 then
            return end
        local weap = EntityList.GetLocalPlayer():GetActiveWeapon()

        if not weap or weap:IsKnife() then return end

        local lp = EntityList.GetLocalPlayer()
       
        local pacan_time = ticks_to_time(lp:GetProp("m_nTickBase"))

        if pacan_time - lp:GetProp("m_flNextAttack") < 0.05 or pacan_time - weap:GetProp("m_flNextPrimaryAttack") < 0.05 then
            return end

        if weap:GetInaccuracy(weap) > 0.09 then
            return end

        if accepted_weapons[weap:GetClassID()] and not lp:GetProp("m_bIsScoped") then    --autoscope
            cmd.buttons = bit.bor(cmd.buttons , 2048)
        end

        local shoot_pos = EntityList.GetLocalPlayer():GetEyePosition()




       
        cmd.viewangles = calc_angle(shoot_pos , scan_data.point)
        cmd.buttons = bit.bor(cmd.buttons , 1)
        cmd.tick_count = cmd.tick_count - 1
       


        local white = Color.new(1,1,1,1)
        local col = Color.new(0,0.6 , 1 , 1)
       
        if enable_logs:Get() and type2_of_logs:Get()==1 and type3_of_logs:Get(3) then
            logs:add(true , "Attempted shot by dormant aimbot [target: " .. scan_data.name.." , dmg: "..math.floor(scan_data.damage) .." ]")
        end
   
    end )

    function debug_panel()
        if not enable_debug_panel:Get() then return end
        if not EntityList.GetLocalPlayer() or not EntityList.GetLocalPlayer():IsAlive() then return end
   
   
        local real_rotation = AntiAim.GetCurrentRealRotation();
        local desync_rotation = AntiAim.GetFakeRotation();
        local  desync_delta = clamp(math.floor(math.abs(real_rotation - desync_rotation)) , 0 , 58)
       
       
        if list_debug_panel:Get()==1 then
        local info_text = ""..lua_name..""..version..""
        local aa_text = ">; Anti Aim Information: side - "..(AntiAim.GetInverterState() and "right" or "left").." - ".. desync_delta.."°"
        local pinfo_text= ">; Player Condition - ".. (get_condition() or "unk")
        local abrute_text = ">; Anti Bruteforce information -  ".. (menu_elements.switch:Get() and (anti_brute.working and "working - " or "idle - ").."phase ("..(anti_brute.cur_phase+1)..")" .. (anti_brute.working and " - ("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)" or "")   or "disabled")
   
   
       
        local Color_fake = Color.new ( (1-1)*0.8 + 0.2 , (0.2 + 1*0.8)*0.8 , 0.3  , 1 )
   
        local pos = Vector2.new(EngineClient.GetScreenSize().x /2 , EngineClient.GetScreenSize().y - 200 )
        local ts1 = Render.CalcTextSize(info_text , 12 , font_debug)
        Render.Text(info_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(info_text , pos-ts1/2 , Color.new(0.9 , 0.9 , 0.9 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(aa_text , 12 , font_debug)
        Render.Text(aa_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(aa_text , pos -ts1/2, Color_fake , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(pinfo_text , 12 , font_debug)
        Render.Text(pinfo_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(pinfo_text , pos -ts1/2, Color.new(0.8 , 0.8 , 1 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
        ts1 = Render.CalcTextSize(abrute_text , 12 , font_debug)
        Render.Text(abrute_text , pos+1-ts1/2 , Color.new(0 , 0 , 0 , 1) , 12 , font_debug , false , false)
        Render.Text(abrute_text , pos -ts1/2, Color.new(0.9 , 0.6 , 0.6 , 1) , 12 , font_debug , false , false)
        pos = pos + Vector2.new(0 , 15)
   
    end
end
   
pixel_debug = Render.InitFont("nl\\Melonity Solutions\\fonts\\smallest_pixel-7.ttf", 10)
local OldChoke, toDraw0, toDraw1, toDraw2, toDraw3, toDraw4, on_plant_time, fill, text, planting_site, planting, autopeek_origin = 0, 0, 0, 0, 0, 0, 0, 0, "", "", false, nil

function debug_panel2()
    if not enable_debug_panel:Get() then return end
    if list_debug_panel:Get()==0 then

    local ax = 0
    local chocking = ClientState.m_choked_commands
    if chocking < OldChoke then
        toDraw0 = toDraw1
        toDraw1 = toDraw2
        toDraw2 = toDraw3
        toDraw3 = toDraw4
        toDraw4 = OldChoke
    end
    OldChoke = chocking
   local x = EngineClient.GetScreenSize().x
   local y = EngineClient.GetScreenSize().y
   local player = EntityList.GetLocalPlayer();
   if not player then return end
   
   local lifeState = player:GetProp("m_lifeState");
   if not lifeState then
local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
if lp == nil then return end

  local flags = player:GetProp("m_fFlags")

   local aa_state1234d = "STANDING"
   if is_moving then
    aa_state1234d = "MOVING"
   end
 
   if (flags == 256) then
    aa_state1234d = "AIR"
   end

   if player:GetProp("m_flDuckAmount") > 0.9 then
    aa_state1234d = "CROUCHING"  
   end

   if refs.sw:GetBool() then
    aa_state1234d = "SLOW-WALKING"
   end

   if externded_desync_switch:Get() then
    aa_state1234d = "ROLL AA"
   end

   local TICKBASE_DEBUG = refs.dt:GetBool() and 14 or 7
   local charge_debug = Exploits.GetCharge()
   local charged_ticks_debug = math.abs(math.floor((charge_debug * TICKBASE_DEBUG) + 0.5))

   local abrute_text123 = "+ Anti Bruteforce information: ".. (menu_elements.switch:Get() and (anti_brute.working and "working - " or "idle - ").."phase ("..(anti_brute.cur_phase+1)..")" .. (anti_brute.working and " - ("..anti_brute.phases[anti_brute.cur_phase +1]:Get().."°)" or "")   or "disabled")
   local tick_debug = "+ Current Ticks: "..charged_ticks_debug.." | Allowed Ticks: 14"

    arrows = AntiAim.GetInverterState() and "<" or ">"
    Render.Text(""..lua_name..""..version.." | "..Cheat.GetCheatUserName(), Vector2.new(x/20, y/2.4+30), Color.RGBA(255,255,255,255), 10, pixel_debug, true)
    Render.Text("+ INVERTER: "..arrows.." | STATE: "..aa_state1234d, Vector2.new(x/20, y/2.4+42), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text("+ FAKELAG COUNTER: "..string.format("%i-%i-%i-%i-%i",toDraw4,toDraw3,toDraw2,toDraw1,toDraw0), Vector2.new(x/20, y/2.4+54), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text(abrute_text123, Vector2.new(x/20, y/2.4+66), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
    Render.Text(tick_debug, Vector2.new(x/20, y/2.4+78), Color.RGBA(125, 125, 125, 255), 10, pixel_debug, true)
   
end
end
end


end

local json = Panorama.LoadString([[
    return {
        stringify: JSON.stringify,
        parse: JSON.parse
    };
]])()
local base64 = {
    codes =  {'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='},
    encode = function (self, str, type_c)
        local b = self.codes[type_c or 1]
        return ((str:gsub('.', function(x)
            local r,b='',x:byte()
            for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
            return r;
        end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
            if (#x < 6) then return '' end
            local c=0
            for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
            return b:sub(c+1,c+1)
        end)..({ '', '==', '=' })[#str%3+1])
    end,
    decode = function (self, data, type_c)
        local b = self.codes[type_c or 1]

        data = string.gsub(data, '[^'..b..'=]', '')
        return (data:gsub('.', function(x)
            if (x == '=') then return '' end
            local r,f='',(b:find(x)-1)
            for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
            return r;
        end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
            if (#x ~= 8) then return '' end
            local c=0
            for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
                return string.char(c)
        end))
    end
}


ffi.cdef [[
    typedef int(__thiscall* get_clipboard_text_count)(void*);
    typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
    typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);
]]

local VGUI_System = ffi.cast("void***", Utils.CreateInterface("vgui2.dll", "VGUI_System010"))
local get_clipboard_text_count = ffi.cast("get_clipboard_text_count", VGUI_System[0][7])
local set_clipboard_text = ffi.cast("set_clipboard_text", VGUI_System[0][9])
local get_clipboard_text = ffi.cast("get_clipboard_text", VGUI_System[0][11])
local configs = {
    export = function (from, color_exceptions)
        local config = {}
        for tabname , tab in pairs( from ) do
            for name, cheatvar in pairs(tab) do
                local result = {}
                if type(cheatvar) == "table" then
                    local temp = {}
                    for i=1 ,#cheatvar do temp[i] = cheatvar[i]:Get() end
                    result = {array = temp }
                else
                    if cheatvar:Get()==nil  then goto huy2 end

                    result = {value = cheatvar:Get()}
                end
                if (result.array ~= nil) then
                    goto huy
                end

                if color_exceptions[name] then
                    local color = cheatvar:GetColor()
                    result["color"] = {r = color.r, g = color.g, b = color.b, a = color.a}
                end

                if type(result.value) == "userdata" then
                    result["color"] = {r = result.value.r, g = result.value.g, b = result.value.b, a = result.value.a}
                end
                ::huy::
                if not config[tabname] then config[tabname] = {} end

                config[tabname][name] = result

                ::huy2::
            end
        end
        local exported_to_armenia = "Melonity" .. json.stringify(config)
        set_clipboard_text(VGUI_System,"Melonity".. base64:encode(exported_to_armenia ) ,#("Melonity".. base64:encode(exported_to_armenia )) )
        Cheat.AddNotify("Melonity Solutions", "Config was succesfully exported!")
    end,
    import = function (array, color_exceptions , siska , aa)
        local clipboard_text_length = get_clipboard_text_count(VGUI_System)
        local clipboard_data = ""
       
        if siska~=nil then
            clipboard_data = siska
            goto poshel_naxyu
        end



        if clipboard_text_length > 0 then
            buffer = ffi.new("char[?]", clipboard_text_length)
            size = clipboard_text_length * ffi.sizeof("char[?]", clipboard_text_length)
       
            get_clipboard_text(VGUI_System,0, buffer, size )
       
            clipboard_data = ffi.string( buffer, clipboard_text_length-1 )
        end

       
        ::poshel_naxyu::
       if not clipboard_data then return end
       if not string.find( clipboard_data , "Melonity") then
        Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
        return
       end
        local notified = false
       local config = json.parse((base64:decode( clipboard_data:gsub("Melonity" , "") )):gsub("Melonity", "") )

        if not config then
            Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
            return
        end

        for tabname , tab in pairs(config) do
            if not tab or not tabname then
                Cheat.AddNotify("Melonity Solutions", "An error occured with config!")
                return
            end

            for name, cheatvar in pairs(tab) do

                if not name or not cheatvar or not array[tabname] or not array[tabname][name] then
                    if not notified then    
                        Cheat.AddNotify("Melonity Solutions", "An error occured with config or config might be outdated!")
                        notified = true
                    end
                    goto mama
                end


                if cheatvar.color then
                    array[tabname][name]:SetColor(Color.new(tonumber(cheatvar.color.r), tonumber(cheatvar.color.g), tonumber(cheatvar.color.b), tonumber(cheatvar.color.a)))

                end
                if cheatvar.array then
                    for i=1, #array[tabname][name] do
                        if array[tabname][name][i] and cheatvar.array[i] then
                            array[tabname][name][i]:Set(cheatvar.array[i])
                        end
                    end
                end
                if not cheatvar.array and not (cheatvar.color and not color_exceptions[name]) then
                    if  array[tabname][name] and cheatvar.value then
                       
                        array[tabname][name]:Set(cheatvar.value)
                    end
                end
                 ::mama::
            end
        end
        if not notified and not aa then
            Cheat.AddNotify("Melonity Solutions", "Config was succesfully loaded!")
        end
        anti_brute:adjust_abrute()
     end,

}


export:RegisterCallback( function()

    configs.export(ui_array , {})
end)

import:RegisterCallback( function()

    configs.import(ui_array , {} , nil , false)

end)

hitsound = Menu.Switch("> Misc", "Main", "[-] Enable Hitsound" , false)
hitsound_list = Menu.Combo("> Misc", "Main", "Select Hitsound", {"Skeet", "Alternative"}, 0)
hitsound_vol = Menu.SliderInt("> Misc", "Main" , "Hitsound Volume" , 75 , 0 , 100)

local pi_divided = math.pi / 180
local new_vec2, new_vec, new_angle, vec_length, callback, inverter = Vector2.new, Vector.new, QAngle.new, Vector.new(0, 0, 0).Length, Cheat.RegisterCallback, AntiAim.GetInverterState
local sin, cos = math.sin, math.cos

local angle_vec = function(angles)
    local forward, right = new_vec(), new_vec()

    local pitch, yaw, roll = angles.pitch * pi_divided, angles.yaw * pi_divided, angles.roll * pi_divided
    local cp = cos(pitch)
    local sp = sin(pitch)

    local cy = cos(yaw)
    local sy = sin(yaw)

    local cr = cos(roll)
    local sr = sin(roll)

    forward.x = cp * cy
    forward.y = cp * sy
    forward.z = -sp

    right.x = -1 * sr * sp * cy + -1 * cr * -sy
    right.y = -1 * sr * sp * sy + -1 * cr * cy
    right.z = -1 * sr * cp

    return forward, right
end

local actual_mov = new_vec2(0, 0)
local mov_fix = function(user_cmd)
    local frL, riL = angle_vec(new_angle(0, user_cmd.viewangles.yaw, 0))
    local frC, riC = angle_vec(user_cmd.viewangles)

    frL.z = 0
    riL.z = 0
    frC.z = 0
    riC.z = 0

    frL = frL / vec_length(frL)
    riL = riL / vec_length(riL)
    frC = frC / vec_length(frC)
    riC = riC / vec_length(riC)

    local worldCoords = frL * actual_mov.x + riL * actual_mov.y;

    user_cmd.sidemove = (frC.x * worldCoords.y - frC.y * worldCoords.x) / (riC.y * frC.x - riC.x * frC.y)
    user_cmd.forwardmove = (riC.y * worldCoords.x - riC.x * worldCoords.y) / (riC.y * frC.x - riC.x * frC.y)
end

snapelines = Menu.Switch("> Visuals", "Other", "[-] Snapelines", false)
snapelines_render = Menu.Combo("> Visuals", "Other" , "Line Position" , {"Crosshair" , "Hitbox Center"} , 0)
local snapelines_color = Menu.ColorEdit("> Visuals", "Other", "Line color", Color.RGBA(185, 129, 235, 255))

function is_alive1234()
    local player = EntityList.GetLocalPlayer()
    if not player then return end
    local lifeState = player:GetProp("m_lifeState")
   
    return not lifeState
    end

TP = Menu.FindVar("Visuals", "View", "Thirdperson", "Enable Thirdperson")
function snape_lines()
    if not is_alive1234() then return end
    if not snapelines:Get() then return end
    local screen_size = EngineClient.GetScreenSize()
       local lines_color = snapelines_color:GetColor()
       local players = EntityList.GetPlayers()
       local local_player = EntityList.GetLocalPlayer()
     
       for _, player_ptr in ipairs(players) do
          if player_ptr == local_index or player_ptr:IsTeamMate() then goto skip end
          local position = Render.WorldToScreen(player_ptr:GetEyePosition())
          local pos2 = Render.WorldToScreen(EntityList.GetLocalPlayer():GetHitboxCenter(5))
          local vec = Cheat.AngleToForward(EngineClient.GetViewAngles())

          pos2 = TP:Get() and pos2 or Render.WorldToScreen(EntityList.GetLocalPlayer():GetRenderOrigin())
          local lifeState = player_ptr:GetProp("m_lifeState"); if lifeState then goto skip end
          if player_ptr:IsDormant() then goto skip end
          if snapelines_render:GetInt()==0 then
          Render.Line(position, Vector2.new(screen_size.x / 2, screen_size.y / 2), lines_color)
          end
          if snapelines_render:GetInt()==1 then
        Render.Line(position, pos2, lines_color)
          end
         ::skip::
       end
   end

   menu_watermark = Menu.Switch("> Visuals", "Other", "[-] Menu Watermark", true)

   local function in_menu() local pos, size, color, height, text, textcolor = Render.GetMenuPos(), Render.GetMenuSize(), Color.new(79 / 255, 161 / 255, 255 / 255, 255), 100, 'Melonity',Color.new(79 / 255, 161 / 255, 255 / 255, 255);
    if not menu_watermark:Get() then return end
    if Cheat.IsMenuVisible() == true then
        Render.Blur(Vector2.new(pos.x,pos.y-height+50),Vector2.new(pos.x+size.x,pos.y-5),Color.RGBA(255,255,255,255),5)
        Render.BoxFilled(Vector2.new(pos.x,pos.y-height+50),Vector2.new(pos.x+size.x,pos.y-5),Color.RGBA(0,0,0,125),5)
        Render.Text(text,Vector2.new(pos.x+size.x/2,pos.y+22-height/2),Color.RGBA(255,255,255,255),30,true,true)
    end
end



function handle_vis()
    if not Cheat.IsMenuVisible() then return end

    list_debug_panel:SetVisible(should_hide and enable_debug_panel:Get())
    viewmodel_in_scope:SetVisible(should_hide and scope_line.menu.enable:Get())
    menu_watermark:SetVisible(should_hide)
    enable_clantag:SetVisible(should_hide)
    hitchance_conditions:SetVisible(should_hide)
    hitchance_in_air:SetVisible(should_hide and hitchance_conditions:Get(1))
    noscope_hitchance:SetVisible(should_hide and hitchance_conditions:Get(2))
    languageonkill:SetVisible(should_hide and ttonkill:Get())
    snapelines_render:SetVisible(should_hide and snapelines:Get())
    enable_antibackstab:SetVisible(should_hide)
    hitsound:SetVisible(should_hide)
    hitsound_vol:SetVisible(hitsound:Get())
    hitsound_list:SetVisible(should_hide and hitsound:Get())
    menu_elements.custom_aa:SetVisible(should_hide)
    menu_elements.custom_type:SetVisible(should_hide and menu_elements.custom_aa:GetBool())
    menu_elements.custom_presets:SetVisible(should_hide and menu_elements.custom_type:Get()==1 and menu_elements.custom_aa:GetBool())
    menu_elements.custom_cond:SetVisible(should_hide and menu_elements.custom_type:Get()~=1 and menu_elements.custom_aa:GetBool())
    menu_elements.anti_defensive:SetVisible(should_hide)
    menu_elements.teleport_in_air:SetVisible(should_hide)
    menu_elements.teleport_weapons:SetVisible(should_hide and menu_elements.teleport_in_air:GetBool())
    scope_line.menu.enable:SetVisible(should_hide)
scope_line.menu.offset:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.length:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.anim_speed:SetVisible(should_hide and scope_line.menu.enable:GetBool())
scope_line.menu.col_1:SetVisible(should_hide and scope_line.menu.enable:GetBool())
enable_logs:SetVisible(should_hide)
quick_peek:SetVisible(should_hide)
legit_aa:SetVisible(should_hide )
enable_animation_breaker:SetVisible(should_hide)
animation_breaker:SetVisible(should_hide  and enable_animation_breaker:GetBool())
edge_yaw:SetVisible(should_hide)
export:SetVisible(should_hide)
import:SetVisible(should_hide)
enable_indicators:SetVisible(should_hide)
indicators_list:SetVisible(should_hide and enable_indicators:GetBool())
enable_debug_panel:SetVisible(should_hide)
arrows_type:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()~=1)
indic2_color:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()==2)
color123456:SetVisible(should_hide and enable_indicators:GetBool() and indicators_list:Get()~=0 and indicators_list:Get()==1)
arrows_color:SetVisible(should_hide and enable_indicators:GetBool() and arrows_type:Get()~=0 and indicators_list:Get()~=1)
arrows_inverted_color:SetVisible(should_hide and enable_indicators:GetBool() and arrows_type:Get()~=0 and arrows_type:Get()==2 and indicators_list:Get()~=1)
keybinds_123:SetVisible(should_hide)
ui_themes:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:GetInt()~=0)
ui_line_color:SetVisible(should_hide and keybinds_123:GetBool() and ui_themes:GetInt()~=0 and select_ui_windows:GetInt()~=0)
custom_name_switch:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(2))
custom_name_text:SetVisible(should_hide and keybinds_123:GetBool() and custom_name_switch:Get() and select_ui_windows:Get(2) )
bind_state_ui:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(1))
cheat_name:SetVisible(should_hide and keybinds_123:GetBool() and select_ui_windows:Get(2))
enable_min_damage_indicator:SetVisible(should_hide )
min_damage_indicator_pos:SetVisible(should_hide and enable_min_damage_indicator:GetBool())
menu_elements.BodyDT:SetVisible(should_hide)
load_def:SetVisible(should_hide)
type_of_logs:SetVisible(should_hide and enable_logs:GetBool() and type2_of_logs:Get()==0)
type3_of_logs:SetVisible(should_hide and enable_logs:GetBool() and type2_of_logs:Get()==1)
type2_of_logs:SetVisible(should_hide and enable_logs:GetBool())
select_ui_windows:SetVisible(should_hide and keybinds_123:GetBool())
switch_flick:SetVisible(should_hide )
sliderint_flick:SetVisible(should_hide  and switch_flick:Get())
ttonkill:SetVisible(should_hide)
tickbase_indicator_color:SetVisible(should_hide  and tickbase_enable:Get() and keybinds_123:Get())
tickbase_enable:SetVisible(should_hide  and keybinds_123:Get())
welcome_back:SetVisible(should_hide)
info_lua:SetVisible(should_hide)
update_log:SetVisible(should_hide)
update_lua:SetVisible(should_hide)
discord_button:SetVisible(should_hide)
get_font:SetVisible(should_hide)
blur_background:SetVisible(should_hide and keybinds_123:Get() and select_ui_windows:GetInt()~=0)
snapelines:SetVisible(should_hide )
snapelines_color:SetVisible(should_hide  and snapelines:Get())


    for i=1 , 5 do
        menu_elements.yaw_add_r[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_add_l[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.r_limit[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.l_limit[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.inv_jitter[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.random[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.freestand_desync[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.desync_on_shot[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_modifier[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.yaw_modifier_degree[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1 and menu_elements.yaw_modifier[i]:Get()~=0)
        menu_elements.fake_options[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
        menu_elements.lby_mode[i]:SetVisible(should_hide and  menu_elements.custom_aa:GetBool() and menu_elements.custom_type:Get()==0  and menu_elements.custom_cond:Get()==i-1)
    end

    menu_elements.switch:SetVisible(should_hide)
    anti_brute:adjust_abrute()
    externded_desync_switch:SetVisible(should_hide)
    dmg_marker:SetVisible(should_hide)
    dmg_marker_color:SetVisible(should_hide and dmg_marker:GetBool())
    d_switch:SetVisible(should_hide)
    d_min_damage:SetVisible(d_switch:Get())

end

local shot_data = {}

local hitsound = function()
    local IEngineSoundClient = ffi.cast("void***" , Utils.CreateInterface("engine.dll", "IEngineSoundClient003")) or error("Failed to find IEngineSoundClient003!")
    local play_sound_fn = ffi.cast("void(__thiscall*)(void*, const char*, float, int, int, float)",IEngineSoundClient[0][12])
    local play_sound = function (name , pitch , bitch)
        return play_sound_fn( IEngineSoundClient, name , pitch , bitch ,0,0)
    end
   
    handlers:subscribe("events", function(event)
        if not hitsound:Get() then return end
        if event:GetName()=="player_hurt" then
            if refs.hitsound:Get()==true then refs.hitsound:Set(false) end

            local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker", 0))
            local me = EntityList.GetLocalPlayer()
            local userid = event:GetInt("userid", 1)

            local player = EntityList.GetPlayerForUserID(userid)
            if me and attacker == me and player~= me and hitsound_list:Get()==0 then
               play_sound("buttons\\arena_switch_press_02.wav",  hitsound_vol:Get()/100 ,100)
            end
            if me and attacker == me and player~= me and hitsound_list:Get()==1 then
                play_sound("buttons\\hitsound.wav",  hitsound_vol:Get()/100 ,100)
            end

        end
    end)

    handlers:subscribe("destroy" , function()
       
        refs.hitsound:Set(true)
   
    end)

end

local function paint()
    if not dmg_marker:Get() then return end
    dmg_marker_windows:SetBool(false)
    local dmg_color_picker = dmg_marker_color:GetColor()
    for i=1, #shot_data do
        local shot = shot_data[i]
        if shot.draw then
            if shot.z >= shot.target then
                shot.alpha = shot.alpha - 1
            end
            if shot.alpha <= 0 then
                shot.draw = false
            end
            local wts = Render.WorldToScreen(Vector.new(shot.x, shot.y, shot.z))
            local sx, sy = wts.x, wts.y
            if sx ~= nil then
                Render.Text("-"..tostring(shot.damage), Vector2.new(sx, sy), Color.new(dmg_color_picker.r,dmg_color_picker.g,dmg_color_picker.b,shot.alpha/255), 12, font_logs, false)
            end
            shot.z = shot.z + 0.50
        end
    end
end

local function player_hurt(e)
    if not dmg_marker:Get() then return end
    dmg_marker_windows:SetBool(false)
    local attacker_entindex = EntityList.GetPlayerForUserID(e:GetInt("attacker"))
    local victim_entindex   =  EntityList.GetPlayerForUserID(e:GetInt("userid"))
    if attacker_entindex ~= EntityList.GetLocalPlayer() then
        return
    end

    local lol = victim_entindex:GetProp("m_vecOrigin")
    local x, y, z       = lol.x, lol.y, lol.z
    local duck_amount   = victim_entindex:GetProp("m_flDuckAmount")
    z = z + (46 + (1 - duck_amount) * 18)
    shot_data[#shot_data + 1] = {
        x       = x,
        y       = y,
        z       = z,
        target  = z + 25,
        damage  = e:GetInt('dmg_health'),
        alpha   = 255,
        draw    = true
    }
end

function round_start()
    shot_data = {}
end

handlers:subscribe('draw', paint)
handlers:subscribe('events', function(e)
    if e:GetName() == 'player_hurt' then player_hurt(e) end
    if e:GetName() == 'round_start' then round_start(e) end
end)

local was_in_backstab = false
mrefs = {
    yaw_add = Menu.FindVar( "Aimbot", "Anti Aim", "Main", "Yaw Add" ),
    yaw_base = Menu.FindVar( "Aimbot", "Anti Aim", "Main", "Yaw Base" ),
}

function anti_backstab(e)
    local players = EntityList.GetPlayers()
    local localplayer = EntityList.GetLocalPlayer()

    if not localplayer then return end

    local is_exists = false

    for i = 1, #players do
        local player = players[ i ]

        if player:IsTeamMate( ) or player:IsAlive( ) == false then
            goto skip
        end

        local enemy_weapon = player:GetActiveWeapon( )

        if not enemy_weapon then
            goto skip
        end

        if enemy_weapon:IsKnife( ) == false then
            goto skip
        end

        local origin = localplayer:GetProp( "m_vecOrigin" )
        local enemy_origin = player:GetProp( "m_vecOrigin" )

        if origin:DistTo( enemy_origin ) <= 200 then
            is_exists = true

            break
        end

        ::skip::
    end

    if is_exists == false then
        if was_in_backstab == true then
            mrefs.yaw_add:Set( 0 )
            was_in_backstab = false
        end

        return
    end

    if enable_antibackstab:Get() then
    mrefs.yaw_base:Set( 4 )
    mrefs.yaw_add:Set( 180 )
    was_in_backstab = true
    end
end


hitchance_conditions = Menu.MultiCombo("> Rage", "Other", "[-] Hitchance Conds", {"In Air", "Noscope"}, 0)
hitchance_in_air = Menu.SliderInt("> Rage", "Other", "Hitchance In Air", 0, 0, 100)
noscope_hitchance = Menu.SliderInt("> Rage", "Other", "Noscope Hitchance", 0,  0, 100)

function hitchance_conditions123()
    local ent = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if not ent then
        return
    end
    local player = ent:GetPlayer()
    if not player or not player:IsAlive() then
        return
    end
    if not EngineClient.IsConnected() then
        return
    end
    local local_player = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
    is_alive = local_player:GetProp("DT_BasePlayer", "m_iHealth") > 0
    if not is_alive then return end
    local active_weapon = local_player:GetActiveWeapon()
    if active_weapon == nil then return end
    local weapon_id = active_weapon:GetWeaponID()
    local players = EntityList.GetPlayers()
    local player = EntityList.GetLocalPlayer()
    local onGround = bit.band(local_player:GetProp("DT_BasePlayer", "m_fFlags"), bit.lshift(1,0)) ~= 0;
    local scoped = player:GetProp("m_bIsScoped");

    for _, player in ipairs(players) do
        if not player:IsTeamMate() then
            local user_index = player:EntIndex()
            if weapon_id == 40 and not onGround and hitchance_conditions:Get(1) then
                RageBot.OverrideHitchance(user_index, hitchance_in_air:GetInt())
            end

            if weapon_id == 11 or weapon_id == 38 and not scoped and hitchance_conditions:Get(2) then
                RageBot.OverrideHitchance(user_index, noscope_hitchance:GetInt())
            end
        end
    end
end

enable_clantag = Menu.Switch("> Misc", "Other", "[-] Melonity Clantag", false)

set_clan_tag_fn = ffi.cast("int(__fastcall*)(const char*, const char*)", Utils.PatternScan("engine.dll", "53 56 57 8B DA 8B F9 FF 15"))
set_clan_tag = function(tag)
    set_clan_tag_fn(tag, tag)
end

function build_tag(tag)
    local arr = {}

    for i = 1, #tag do
        arr[#arr+1] = tag:sub(1, i)
    end

    return arr
end

clantag = build_tag(" melonity ")

first1 = false

function tag()
    if not enable_clantag:Get() then
        if first1 then
            set_clan_tag("")
            first1 = false
        end
        return
    end

    first1 = true
    local curtime = math.floor(GlobalVars.curtime * 2)

    if old_time ~= curtime then
        set_clan_tag(clantag[curtime % #clantag + 1])
        old_time = curtime
    end
end

function disable_clantag()

    if first1 then
        set_clan_tag("")
        first1 = false
    end
end


function destroy()
    disable_clantag()
end

function prediction(args)  
   aa_main(args)
   teleport_in_air_dt()
   quickpeek_lua(args)
   abrute_pred()
   flick_on_prediction()
   anti_backstab(args)

end

function pre_pred(args)
    desync_on_use(args)
    edge(args)
    hitchance_conditions123()
end

function draw()
    debug_panel2()
    handle_vis()
    logs_notify()
    viewmodel_in_scope2()
    debug_panel()
    scope_line.on_draw()
   -- legbreaker()
   prediction_arrows()
    keybinds_draggable:update()
    drawlog()
    indicators_melonity2()
    melonity_main_indic()
    watermark()
    arrows_indicator()
    teamskeet_arrows()
    damage_indicator_dmg()
    render_dt_indicator()
    snape_lines()
    tag()
    in_menu()
end

function createmove(args)
    preferbaim()
end

handlers:subscribe("createmove", createmove)
handlers:subscribe("destroy", destroy)

handlers:subscribe("destroy", scope_line.on_destroy)

handlers:subscribe("pre_prediction", pre_pred)
handlers:subscribe("prediction", prediction)
handlers:subscribe("draw", draw)
hitsound()
dormant_aimbot()

starthooks()
бля можешь еще новые глаза слить пж
 
axcord.ws
Забаненный
Статус
Оффлайн
Регистрация
8 Апр 2021
Сообщения
178
Реакции[?]
30
Поинты[?]
1K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
у кого то есть на неё топовые настройки?
 
Эксперт
Статус
Оффлайн
Регистрация
10 Фев 2021
Сообщения
1,739
Реакции[?]
559
Поинты[?]
2K
Конечно все весело, но если почитать код хотябы до 750 строчки, можно увидеть оч много чего интересного
(Ну там ax = ax +10.5)
 
Эксперт
Статус
Оффлайн
Регистрация
22 Мар 2020
Сообщения
2,191
Реакции[?]
484
Поинты[?]
3K
Конечно все весело, но если почитать код хотябы до 750 строчки, можно увидеть оч много чего интересного
(Ну там ax = ax +10.5)
клёво, а ты будешь в каждой теме код обсуждать? Я не понимаю тебя.
 
Сверху Снизу