Crack Lua Psycho src leak

Забаненный
Забаненный
Статус
Оффлайн
Регистрация
7 Авг 2022
Сообщения
10
Реакции
3
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Credits: Hellfish#9343
смертрет
code_language.lua:
Expand Collapse Copy
EngineClient.ExecuteClientCmd("clear")

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

ffi.cdef[[
    typedef struct
    {
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    } uint_colors_t;


    typedef void*(__thiscall* c_entity_list_get_client_entity_t)(void*, int);
    typedef void (__cdecl* console_color_print)(void*, const uint_colors_t&, const char*, ...);
    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);

    void* GetProcAddress(void* hModule, const char* lpProcName);
    void* GetModuleHandleA(const char* lpModuleName);

    bool PathFileExistsA(const char* pszPath);
    bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes);
    bool DeleteUrlCacheEntryA(const char* lpszUrlName);
    void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);

    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 struct
    {
        float x;
        float y;
        float z;
    } Vector_t;

    typedef int16_t WORD;

    typedef struct {
        WORD wYear;
        WORD wMonth;
        WORD wDayOfWeek;
        WORD wDay;
        WORD wHour;
        WORD wMinute;
        WORD wSecond;
        WORD wMilliseconds;
    } SYSTEMTIME;

    void GetLocalTime(SYSTEMTIME* time);

    struct pose_params_t {
        char pad[8];
        float     m_flStart;
        float     m_flEnd;
        float     m_flState;
    };

    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;
    int CreateDirectoryA(const char*, void*);
    void* CreateFileA(const char*, uintptr_t, uintptr_t, void*, uintptr_t, uintptr_t, void*);
    uintptr_t GetFileSize(void*, uintptr_t*);
    int ReadFile(void*, void*, uintptr_t, uintptr_t*, void*);
    int CloseHandle(void*);

    typedef int(__thiscall* get_clipboard_text_length)(void*);
    typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
    typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);

    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);
]]

local json = Panorama.LoadString([[
    return {
        parse: JSON.parse,
        stringify: JSON.stringify
    };
]])()

local ffi_functions = {}

ffi_functions.animstate_offset = 0x9960
ffi_functions.interface_type = ffi.typeof("uintptr_t**")
ffi_functions.bind_argument = function(r_function, arg)
    return function(...)
        return r_function(arg, ...)
    end
end

ffi_functions.engine_cvars = Utils.CreateInterface("vstdlib.dll", "VEngineCvar007")
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, ffi_functions.engine_cvars)
ffi_functions.color_print = ffi.cast("console_color_print", ffi_functions.cvar_interface[0][25])

local color_print = function(text, color)
    local new_color = ffi.new("uint_colors_t")
    local rgba_table = {"r", "g", "b", "a"}

    for index, current_color in ipairs(rgba_table) do
        new_color[current_color] = color[current_color] * 255
    end
   
    local stringed_text = tostring(text)
    ffi_functions.color_print(ffi_functions.cvar_interface, new_color, stringed_text)
end

ffi_functions.interface_type = ffi.typeof('uintptr_t**')
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface('vstdlib.dll', 'VEngineCvar007'))
ffi_functions.print = ffi.cast('console_color_print', ffi_functions.cvar_interface[0][25])

ffi_functions.color_print1 = function(color, text)
    if color == nil then return end
    if text == nil then return end
    local col = ffi.new('uint_colors_t')
    if col == nil then return end
    col.r = color.r * 255
    col.g = color.g * 255
    col.b = color.b * 255
    col.a = color.a * 255
    ffi_functions.print(ffi_functions.cvar_interface, col, text)
end

ffi_functions.i_client_entity_list = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface("client.dll", "VClientEntityList003"))
ffi_functions.get_client_entity = ffi_functions.bind_argument(ffi.cast("c_entity_list_get_client_entity_t", ffi_functions.i_client_entity_list[0][3]), ffi_functions.i_client_entity_list)

local pose_parameter_pattern = "55 8B EC 8B 45 08 57 8B F9 8B 4F 04 85 C9 75 15"
ffi_functions.get_pose_parameters = ffi.cast( "struct pose_params_t*(__thiscall* )( void*, int )", Utils.PatternScan( "client.dll", pose_parameter_pattern))

ffi_functions.client_entity_list = Utils.CreateInterface("client.dll", "VClientEntityList003")
ffi_functions.entity_list_pointer = ffi.cast("void***", ffi_functions.client_entity_list)

ffi_functions.get_client_entity_fn = ffi.cast("GetClientEntity_4242425_t", ffi_functions.entity_list_pointer[0][3])
ffi_functions.get_entity_address = function(ent_index)
    local addr = ffi_functions.get_client_entity_fn(ffi_functions.entity_list_pointer, ent_index)
    return addr
end

local engine_client = Utils.CreateInterface('engine.dll', 'VEngineClient014')
local interfacePointer = ffi.typeof('void***')
local netChannelBool = ffi.typeof('bool(__thiscall*)(void*)')
local netChannelBoolWithArgs = ffi.typeof('bool(__thiscall*)(void*, int, int)')
local netChannelFloat = ffi.typeof('float(__thiscall*)(void*, int)')
local netChannelInt = ffi.typeof('int(__thiscall*)(void*, int)')
local netChannelFramerate = ffi.typeof('void(__thiscall*)(void*, float*, float*, float*)')

local I_EngineClientPtr = ffi.cast(interfacePointer, engine_client) or error('engine_client is nil', 2)
local getNetChannelInfo = ffi.cast('void*(__thiscall*)(void*)', I_EngineClientPtr[0][78]) or error('I_EngineClientPtr is nil')

function GetNetChannel(netChannelInfo)
    if netChannelInfo == nil then
        return
    end

    local SequenceNr = ffi.cast(netChannelInt, netChannelInfo[0][17])(netChannelInfo, 1)

    return {
        SequenceNr = SequenceNr,

        IsLoopback = ffi.cast(netChannelBool, netChannelInfo[0][6])(netChannelInfo),
        IsTimingOut = ffi.cast(netChannelBool, netChannelInfo[0][7])(netChannelInfo),

        Latency = {
            RTT = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][9])(netChannelInfo, flow) end,
            AvgLatency = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][10])(netChannelInfo, flow) end,
        },

        AvgLoss = ffi.cast(netChannelFloat, netChannelInfo[0][11])(netChannelInfo, 1),
        AvgChoke = ffi.cast(netChannelFloat, netChannelInfo[0][12])(netChannelInfo, 1),
        InputBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 1),
        SendBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 0),

        IsValidPacket = ffi.cast(netChannelBoolWithArgs, netChannelInfo[0][18])(netChannelInfo, 1, SequenceNr-1),
    }
end

hitlogs = {}
safety = 0
hit_id = -1
shot_id = 0
hit_ids = 0
total_hits = 0

ffi_functions.open_link = function(link)
    local panorama_handle = Panorama.Open()
    local steam_overlay_API = panorama_handle.SteamOverlayAPI
    local open_external_browser_url = steam_overlay_API.OpenExternalBrowserURL
   
    open_external_browser_url(link)
end
ffi_functions.urlmon = ffi.load('UrlMon')
ffi_functions.wininet = ffi.load('WinInet')
ffi_functions.download_file_from_url = function(from, to)
    ffi_functions.wininet.DeleteUrlCacheEntryA(from)
    ffi_functions.urlmon.URLDownloadToFileA(nil, from, to, 0,0)
end

ffi_functions.ct = ffi.typeof('char[?]')
ffi_functions.c_invalid_handle_value = ffi.cast('void*', -1)
local cfg_system = {}
package.loaded.readfile = function(filename)
    local fp = ffi.C.CreateFileA(filename, 0x80000000, 3, nil, 3, 128, nil)
    if ffi_functions.c_invalid_handle_value ~= fp then
        local size = ffi.C.GetFileSize(fp, nil)
        local buf = ffi_functions.ct(size + 1)
        ffi.C.ReadFile(fp, buf, size, nil, nil)
        ffi.C.CloseHandle(fp)
        return ffi.string(buf, size)
    end
end

local img_bytes = '\xFF\xD8\xFF\xDB\x00\x43\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\x0A\x10\x0A\x0A\x09\x09\x0A\x14\x0E\x0F\x0C\x10\x17\x14\x18\x18\x17\x14\x16\x16\x1A\x1D\x25\x1F\x1A\x1B\x23\x1C\x16\x16\x20\x2C\x20\x23\x26\x27\x29\x2A\x29\x19\x1F\x2D\x30\x2D\x28\x30\x25\x28\x29\x28\xFF\xDB\x00\x43\x01\x07\x07\x07\x0A\x08\x0A\x13\x0A\x0A\x13\x28\x1A\x16\x1A\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\xFF\xC0\x00\x11\x08\x00\xB8\x00\xB8\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xFF\xC4\x00\x1B\x00\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x08\x07\x05\x06\x03\x01\xFF\xC4\x00\x43\x10\x00\x01\x03\x02\x01\x09\x05\x05\x03\x08\x0B\x00\x00\x00\x00\x00\x00\x01\x02\x04\x03\x05\x11\x06\x15\x21\x35\x54\x73\x93\xB2\xD1\x07\x12\x13\x31\x41\x08\x14\x51\x61\x71\x16\x22\xA1\x17\x23\x52\x56\x81\x91\x92\xA2\x25\x27\x33\x55\x62\x72\x94\x95\xB3\xC1\xD2\xFF\xC4\x00\x14\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xC4\x00\x14\x11\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xDA\x00\x0C\x03\x01\x00\x02\x11\x03\x11\x00\x3F\x00\xE2\xB7\x19\xB2\xE8\xDC\x24\xD2\xA3\x26\xBD\x3A\x6C\xAA\xE6\xB5\xAD\xA8\xA8\x88\x88\xAB\xF3\x26\xCE\x33\xB6\xD9\x3C\x57\x75\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x3D\x3B\x74\xD9\x75\xAE\x11\xA9\x56\x93\x5E\xA5\x37\xD5\x6B\x5C\xD7\x54\x55\x45\x45\x54\xF9\x82\x6B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x0F\x6B\x25\x32\x5E\xEF\x95\x57\x14\x85\x64\x88\xFA\xEF\x4C\x16\xA3\xD7\x43\x29\x27\xC5\xCE\xF4\x4F\xC5\x7D\x31\x03\xC5\x06\x90\xC9\x9E\xC0\x2D\x94\x29\x32\xA6\x51\xDC\x6B\x4B\x91\x86\x2B\x4A\x2E\x14\xE9\xA2\xFA\xA7\x79\x51\x5C\xEF\xAE\x83\xEB\x5B\xD8\xE6\x42\xB5\xA8\x8B\x64\x57\x2A\x79\xAA\xCB\xAF\x8A\xFF\x00\x38\x19\x08\x1A\x82\xF9\xD8\x2E\x4D\xCC\xA6\xAB\x6A\x93\x36\xDD\x5B\x0F\xBB\xF7\x92\xB3\x3F\x6B\x5D\xA5\x7F\x62\xA1\xC4\xF2\xF7\xB3\x7B\xEE\x46\x3B\xC5\x9B\x49\x24\xDB\x95\x70\x6C\xCA\x18\xAB\x31\xF4\x47\x26\x18\xB5\x7E\xBA\x3E\x0A\xA0\x7C\x58\x00\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x0F\x6F\x23\x32\x72\x5E\x55\xE5\x1C\x4B\x4C\x1F\xBA\xFA\xCE\xC5\xF5\x15\x31\x4A\x4C\x4D\x2E\x72\xFD\x3F\x15\xD0\x6C\xAC\x92\xC9\xBB\x76\x4A\xD9\x68\xDB\x6D\x34\x51\x94\x98\x88\xAF\x7A\xA2\x77\xEA\xBF\x0C\x15\xCE\x5F\x55\x5C\x3F\xE9\x34\x1C\xAF\xD9\x86\xC2\xC8\xF6\x1B\x8D\xF2\xA3\x3F\x3F\x2E\xAF\xBB\xD3\x55\xF4\xA6\xC4\x45\x5C\x3E\xAE\x5F\xE5\x3B\x68\x00\x71\x4E\xDB\xFB\x52\x97\x93\xF3\x56\xC1\x93\x8F\x65\x39\xE8\xC4\x74\x99\x2A\x88\xE5\xA2\x8A\x98\xA3\x5A\x9F\xA5\x82\xE3\x8A\xA6\x84\x5D\x1A\x7C\xB8\x0C\x8C\xA4\xBE\x48\xAE\xB5\xEB\xDE\x2E\x2F\xAC\xAB\x8F\x7D\xD2\x5E\xAB\x8F\xD7\x10\x37\x49\xF9\xC9\xA1\x4A\x54\x7A\x91\xE4\xD2\xA7\x5A\x85\x56\xAB\x5F\x4E\xA3\x51\x5A\xE4\x54\xC1\x51\x53\xD5\x0C\xCB\xD9\x87\x6C\x77\x3B\x54\xFA\x30\x72\xA2\x4D\x49\xF6\xAA\x8A\x8D\x5A\xF5\x55\x5D\x56\x82\xF9\x77\x95\xDE\x6E\x6F\xC5\x17\x15\xF8\x7C\x17\x4E\xB1\xED\x7B\x1A\xF6\x39\x1C\xD5\x44\x72\x2B\x57\x14\x54\xF3\xC5\x14\x0C\x97\xDB\x5F\x67\xFF\x00\x63\xAF\x2C\x95\x6E\x6A\xAD\x96\x6B\x97\xC2\x45\xC5\x56\x8B\xFD\x69\xAA\xFC\x3D\x51\x57\xD3\xE9\x89\xCD\x8D\xA5\xDA\xAD\x85\x99\x45\x90\x77\x68\x4A\xDE\xF5\x66\x52\x5A\xF4\x17\xD5\x2A\x31\x3B\xCD\xC3\xE1\x8E\x0A\x9F\x45\x31\x68\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x1A\xE3\xB0\x79\x11\xA9\x76\x55\x65\x6B\xEB\x51\x63\xD5\x6B\xAB\x91\x5C\x88\xB8\xF8\xEF\xF3\xD3\xF0\xC0\xFB\xEF\x7D\x8B\xB4\xD1\xFE\x34\xEA\x60\x90\x07\xAF\x96\x13\x9D\x72\xCA\xBB\xC4\xD7\xBB\xBE\xB5\xE5\xD5\x7A\x2E\x38\xA6\x0A\xE5\xC1\x11\x7E\x18\x68\x3C\x80\x00\x1B\x4F\xB2\x9A\xD5\xEB\xF6\x71\x93\xCF\x93\x8F\x89\xEE\x6C\x6E\x2B\xE6\xAD\x44\xC1\xAB\xFB\x91\x0C\xA1\xD9\xFE\x4A\x4B\xCB\x1C\xA5\x8F\x6C\x8A\x8A\xDA\x4A\xBD\xF9\x15\x91\x34\x51\xA6\x8A\x9D\xE7\x7D\x7D\x11\x3D\x54\xDA\x90\x62\xD1\x83\x0A\x3C\x48\xAC\x46\x50\xA1\x4D\xB4\xA9\xB1\x3C\x9A\xC6\xA2\x22\x27\xE0\x07\xEA\xE6\xA3\x9A\xAD\x72\x23\x9A\xE4\xC1\x51\x74\xA2\xA1\x80\x8D\xC9\x96\xB7\x76\x58\xB2\x4A\xEF\x72\x7B\x91\xAB\x1E\x33\xDC\xD5\x5D\x18\xBF\x0C\x18\x9F\xB5\xCA\xD4\x30\xD8\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x03\xF5\x8B\x1E\xB4\xB9\x54\x63\xC5\xA6\xFA\xB2\x2A\xBD\x29\xD3\xA6\xC4\xC5\x5E\xE5\x5D\x08\x89\xEA\xB8\xA9\xF9\x1A\x1F\xD9\xDB\x20\x7C\x0A\x4D\xCA\xBB\xB5\x1F\xCE\xD4\x6A\xA4\x0A\x6F\x4D\x2D\x6F\xAD\x5C\x3E\x2B\xE4\x9F\x2C\x57\xD5\x00\xE8\x5D\x94\x64\x4D\x1C\x8A\xC9\xB6\x50\x7A\x31\xF7\x39\x18\x54\x97\x55\xBA\x71\x7E\x1A\x1A\x8B\xFA\x2D\xC7\x0F\x9E\x95\xF5\x3E\xD4\x1C\xD7\xB6\xDC\xBE\x4C\x91\xB1\xFB\x9D\xBE\xA7\xF4\xD4\xE6\x2B\x69\x61\xE7\x45\x9E\x4B\x51\x7E\x7E\x89\xF3\xD3\xE8\xA0\x73\x9F\x68\xAC\xBA\x65\xCA\x62\x64\xC5\xB2\xA7\x7A\x34\x5A\x9D\xE9\x75\x1A\xBA\x1F\x55\x31\xC1\x89\xF2\x6E\x3A\x7E\x7F\xE5\x38\x89\xFD\x73\x95\xCE\x57\x39\x55\xCE\x72\xE2\xAA\xBA\x55\x57\xE2\xA7\xF0\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x00\x00\x0F\xA1\xEC\xFA\xC6\xDC\xA4\xCB\x4B\x45\xA6\xA6\x3E\x0C\x8A\xC9\xE2\xA2\x79\xAD\x36\xA2\xB9\xE8\x8B\xF1\xEE\xB5\x4D\xB7\x4A\x9B\x28\xD2\x65\x3A\x4C\x46\x53\x63\x51\xAD\x6B\x53\x04\x6A\x22\x60\x88\x89\xE8\x98\x19\x2B\xD9\xED\x3F\xAD\x2B\x6E\xEA\xB7\xFC\x6E\x35\xB8\x1E\x36\x58\x65\x14\x3C\x95\xC9\xE9\x57\x6B\x82\xE3\x4A\x8B\x7E\xEB\x11\x70\x5A\xAF\x5D\x0D\x6A\x7C\xD5\x7F\x72\x69\xF4\x31\x76\x53\xDF\x66\xE5\x25\xF2\x55\xD6\xE5\x53\xBF\x22\x43\xFB\xCA\x89\x8E\x0C\x4F\x24\x6B\x53\xD1\x11\x34\x1D\xD7\xDA\xA6\x5B\xD9\x6B\xC9\xE8\x68\xE5\x46\x55\xAD\x5A\xB2\xB7\xD1\x55\x8D\x6A\x22\xAF\xF1\xA9\x9D\x80\x00\x00\x00\x00\x00\x00\x00\x00\xAA\xD3\xAD\x61\x6F\x99\xCC\x80\x5A\x75\xAC\x2D\xF3\x39\x90\x00\xBB\x6B\x59\xBB\xE7\xF3\x29\x29\x55\xDB\x5A\xCD\xDF\x3F\x99\x49\x40\x00\x00\x00\x00\x00\x00\x00\x00\xFB\xAE\xC5\x2E\xD0\x6C\xBD\xA1\x41\x9B\x75\x93\x4E\x34\x46\x53\xAC\x8E\xAB\x53\x42\x22\xAD\x35\x44\xFC\x54\xD2\xBF\x94\xBC\x8D\xFD\x61\x83\xFC\x4B\xD0\xC6\x00\x0E\xCF\xED\x1B\x94\xD6\x6C\xA2\xFB\x3D\x99\x2E\x34\x66\xF8\x1E\xF1\xE2\xF8\x6A\xAB\xDC\xEF\x78\x5D\xDC\x74\x7F\x85\x4E\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x1D\x0F\xB0\x3A\x14\x64\xF6\x9B\x6F\xA5\x26\x95\x3A\xB4\xD6\x9D\x65\x56\x54\x6A\x39\x17\xF3\x6A\xA9\xA0\xD5\x79\x96\xD5\xFD\xD9\x07\xFD\x3B\x7A\x19\x3F\xB0\xC9\xF0\xED\xBD\xA4\x40\x93\x71\x97\x1E\x24\x66\xD3\xAC\x8E\xAB\x5E\xA2\x53\x62\x2A\xD3\x54\x44\x57\x2A\xA2\x26\x93\x50\x7D\xB5\xC9\x6F\xD6\x5B\x27\xFB\x85\x2F\xFD\x01\xC6\x3D\xA8\xA1\x44\x87\xF6\x67\xDD\x23\x51\xA1\xDE\xF7\xAE\xF7\x86\xC4\x6F\x7B\xFB\x2C\x31\xC1\x34\xF9\x9C\x20\xED\xFE\xD2\xF7\xAB\x55\xE3\xEC\xE6\x68\xB9\xC1\x9F\xE1\x7B\xCF\x89\xEE\xB2\x1B\x57\xB9\x8F\x85\x87\x7B\xBA\xAB\x86\x38\x2F\x9F\xC0\xE2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\xA6\xE3\x0A\x5D\x6B\x84\x9A\xB4\x63\x57\xA9\x4D\xF5\x5C\xE6\xB9\xB4\xD5\x51\x51\x55\x7E\x44\xD9\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x01\x4D\xBA\x14\xBA\x37\x08\xD5\x6B\x46\xAF\x4E\x9B\x2A\xB5\xCE\x73\xA9\xAA\x22\x22\x2A\x7C\x80\x00\x7F\xFF\xD9'
local globals = {
    screen_size = EngineClient.GetScreenSize(),
    username = Cheat.GetCheatUserName(),
    avatar = Render.LoadImage(Http.Get(string.format("https://neverlose.cc/static/avatars/%s.png", Cheat.GetCheatUserName())), Vector2.new(64, 164)),
    default_avatar = Render.LoadImage(img_bytes, Vector2.new(64, 64)),
    local_player,
    autopeek = false,
    autopeekq = false,
    zero_vec = Vector.new(0,0,0),
    autopeek_pos = Vector.new(0,0,0)
}
local shell32 = ffi.load "Shell32"
local smallest_pixel_7_link = "https://cdn.discordapp.com/attachments/897931346373128274/936931900059156500/smallest_pixel-7.ttf"
local arrows_font = "https://cdn.discordapp.com/attachments/976869884464095232/976876821796761710/arrows.ttf"
local indicator_logo = "https://cdn.discordapp.com/attachments/984436727475240960/987625219910959134/pngwing.png"
local avatar_logo = "https://cdn.discordapp.com/attachments/984414333662539837/986556441710186516/unknown.png"
local avatar2_logo = "https://cdn.discordapp.com/attachments/399443531560648714/986875005231063060/logo.png"
local background = "https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png"
local files_dowloaded = false
local cache_size = Render.GetMenuSize()
local image_size = Vector2.new(cache_size.x * 3, cache_size.y * 3)
if package.loaded.readfile('nl\\psycho\\fonts\\smallest-pixel-7.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\arrows.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\pngwing.png') and package.loaded.readfile('nl\\psycho\\fonts\\unknown.png') and package.loaded.readfile('nl\\psycho\\fonts\\logo.png') then
    files_dowloaded = true
else
    files_dowloaded = false
    ffi.C.CreateDirectoryA('nl\\psycho\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\fonts\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\png\\', NULL)

    ffi_functions.download_file_from_url(smallest_pixel_7_link, 'nl\\psycho\\fonts\\smallest-pixel-7.ttf')
    ffi_functions.download_file_from_url(arrows_font, 'nl\\psycho\\fonts\\arrows.ttf')
    ffi_functions.download_file_from_url(indicator_logo, 'nl\\psycho\\png\\pngwing.png')
    ffi_functions.download_file_from_url(avatar_logo, 'nl\\psycho\\png\\unknown.png')
    ffi_functions.download_file_from_url(avatar2_logo, 'nl\\psycho\\png\\logo.png')
    ffi_functions.download_file_from_url(background, 'nl\\psycho\\png\\background.png')
    files_dowloaded = true
end

if files_dowloaded then
    globals.indicator_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(150, 150))
    globals.logo_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(64, 64))
    globals.logo_avatar2 = Render.LoadImageFromFile("nl\\psycho\\png\\logo.png", Vector2.new(64, 64))
    globals.background = Render.LoadImageFromFile("nl\\psycho\\png\\background.png", image_size)

end

local _state = {"Stand","Move","Slow walk","Duck","Air","Crouch in Air"}
local __state = {"[1]","[2]","[3]","[4]","[5]","[6]"}

local ui = {
    global = {
        default_cfg = Menu.Button('Main', 'Config System', 'Load Default Config', ''),
        export_cfg = Menu.Button('Main', 'Config System', 'Export Config', ''),
        import_cfg = Menu.Button('Main', 'Config System', 'Import Config', ''),
        information = Menu.Text('Main', 'Information', 'Welcome, ' ..globals.username),
        information1 = Menu.Text('Main', 'Information', 'Current build: stable'),
        information2 = Menu.Text('Main', 'Information', 'Last update date: 18.06.2022'),


    },

    ragebot = {
        ragebot_enable = Menu.Switch("Ragebot", 'Ragebot', 'Enable Ragebot', false),
        Teleport_In_Air = Menu.Switch("Ragebot", 'Main', 'Teleport In Air', false),
        tp_in_air = Menu.MultiCombo('Ragebot', 'Main', 'Auto Teleport in Air', {'AWP', 'AutoSnipers', 'Scout', 'Deagle', 'Revolver', 'Nades', 'Other', 'Pistols', 'Rifle/LMG', 'SMG', 'Shotgun', 'Taser'}, 0),
        dormant_aimbot = Menu.Switch("Ragebot", 'Main', 'Dormant Aimbot', false),
        dormant_aimbot_damage = Menu.SliderInt("Ragebot", 'Main', 'Minimum Damage', 5, 1, 100),
        override_doubletap = Menu.Switch("Ragebot", "Helpers", "Enable Doubletap Customization", false),
        doubletap_speed = Menu.SliderInt("Ragebot", "Helpers", "Speed", 13, 13, 18),
        doubletap_recharge = Menu.Switch("Ragebot", "Helpers", "Instant Recharge", false),
        bodyaims = Menu.Switch("Ragebot", "Helpers", "Baim if Enemy hp <", false),
        baimmode = Menu.Combo("Ragebot", "Helpers", "Baim Mode", {"Default", "Prefer", "Force"}, 0),
        baimhp = Menu.SliderInt("Ragebot", "Helpers", "Enemy hp <", 0, 0, 100),
        maxmissed = Menu.Switch("Ragebot", 'Helpers', 'Max. Misses', false, 'After Х misses, script disable head for ragebot.'),
        maxmissed_c = Menu.SliderInt("Ragebot", 'Helpers', 'Max. Misses count', 2, 1, 10),
        hitchances = Menu.MultiCombo("Ragebot", 'Helpers', "Custom Hitchance", {"In-Air", "Noscope"}, 0, "Overrides your hitchance on selected conditions. \n In-Air HitChance Works only for Revolver, Scout. \n No-Scope HitChance works only for Auto."),
        air_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "In-Air Hitchance", 20, 0, 100),
        noscope_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "Noscope Hitchance", 40, 0, 100),
    },

    anti_aims = {
        antiaim_enable = Menu.Switch('Anti-Aim', "Anti-Aim System", 'Enable Anti-Aim', false),
        states_selection = Menu.Combo('Anti-Aim', "Custom Anti-Aim System"," Current states",_state, 0),
        antiaim_helpers = Menu.MultiCombo('Anti-Aim', "Helpers", "Anti-Aim Tweaks", {"HS w/o Fakelags", "Animation Breakers", "Disable on Warmup", "Anti-Backstab", "Edge Yaw"}, 0),
        animbreakers = Menu.MultiCombo('Anti-Aim', 'Helpers', "Anim Breakers", {"On Ground", "Static Legs in Air ", "Pitch 0 on land"}, 0),

    },

    visuals = {
        visuals_enable = Menu.Switch('Visuals', 'Visuals', 'Enable Visuals System', false),
        widgets = Menu.MultiCombo("Visuals", "Main", "Widgets", {"Keybinds", "Spectators", "Watermark", "Panel", 'Indicators', "Logs"}, 0),
        watermark_info = Menu.MultiCombo("Visuals", "Main", "Watermark Info", {"Username", "FPS", "Delay", "Tickrate", "Time"}, 0),
        statepanel_image = Menu.Combo("Visuals", "Main", "Image Type", {"Disable", "Avatar", "Ghosty", "Avatar and Ghosty"}, 0),
        custom_username = Menu.TextBox("Visuals", "Main", "Custom Username", 64, Cheat.GetCheatUserName()),
        theme = Menu.ColorEdit("Visuals", "Main", "Widgets Color", Color.new(1, 1, 1, 0.25)),
        disable_blur = Menu.Switch('Visuals', 'Main', 'Disable Widgets Blur', false),
        disable_background = Menu.Switch('Visuals', 'Main', 'Disable Indicators Background', false),
        log_type = Menu.MultiCombo('Visuals', "Main", 'Logs Type', {'Widgets Style','Defaul Style', 'Console'}, 0),
        indicator_type = Menu.Combo("Visuals", "Main", "Indicator Type", {"Default", "Ghosty"}, 0),
        arrows = Menu.Combo("Visuals", "Main", "Arrows Type", {"Disable", "Default", "Modern", "Classic"}, 0),
        arrows_x = Menu.SliderInt('Visuals', 'Main', 'Arrows X Add', 0, 0, 100),
        ghosty_color = Menu.ColorEdit("Visuals", "Main", "Ghosty Color", Color.new(1, 1, 1, 1)),
        ind_name_color = Menu.ColorEdit("Visuals", "Main", "Indicator Name Color", Color.new(1, 1, 1, 1)),
        ind_state_color = Menu.ColorEdit("Visuals", "Main", "Indicator State Color", Color.new(1, 1, 1, 1)),
        ind_color = Menu.ColorEdit("Visuals", "Main", "Indicator Binds Color", Color.new(1, 1, 1, 1)),
        arrows_color = Menu.ColorEdit("Visuals", "Main", "Arrows Color", Color.new(1, 1, 1, 1)),
        custom_scope = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Scope Customization ", false, Color.new(1, 1, 1, 1)),
        scope_width = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Width", 80, 0, 300),
        scope_offset = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Offset", 10, 0, 300),
        scope_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Scope Conditions", {"Invert Lines", "Disable Animations", "Scope Viewmodel", "Disable Arrows"}, 0),
        desync_circle = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Desync Circle", false, Color.new(0.57, 0.57, 1, 1)),
        desync_circle_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Circle Conditions", {"Fake Based Color", "Remove Crosshair"}, 0),
        hitmarker = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Hitmarker", false, Color.RGBA(255, 255, 255)),
        hitmarker_length = Menu.SliderInt("Visuals", "Miscellaneous", "Hitmarker Length", 6, 2, 10),
        gamesense = Menu.Switch("Visuals", "Miscellaneous", "Enable Gamesense Indicators", false),
        gamesense_choose = Menu.MultiCombo("Visuals", "Miscellaneous", "Choose Indicators", {"Min Damage", "Dormant Aimbot", "Ping", "Bomb Info", "LC", "Fakeduck","Doubletap", "Hideshots", "Freestanding", "Force Body", "Safe Points"}, 0),

    },

    world = {
        world_enable = Menu.Switch('World', 'World Customization', 'Enable World Customization', false),
        sunset = Menu.Switch('World', 'World', 'Sunset Mode', false),
        shadow_x = Menu.SliderFloat('World', 'World', 'Sunset X', 0, -200, 200),
        shadow_y = Menu.SliderFloat('World', 'World', 'Sunset Y', 0, -200, 200),
        shadow_z = Menu.SliderFloat('World', 'World', 'Sunset Z', 0, -200, 200),
        shadow_dist = Menu.SliderInt('World', 'World', 'Sunset Distance', 1000, 0, 1500),
        custom_skybox = Menu.SwitchColor("World", 'World', "Custom Skybox Changer", false, Color.RGBA(255, 255, 255)),
        skybox_choose = Menu.TextBox("World", "World", 'Skybox Path', 64, "", "You can found skybox name in csgo/materials/skybox"),
        molly_conditions = Menu.MultiCombo("World", "Miscellaneous", "Molotov Conditions", {"Wireframe", "Ignore-Z"}, 0),
        enable_bloom = Menu.Switch("World", "Miscellaneous",  "Enable Effects", false),
        bloom = Menu.SliderFloat("World", "Miscellaneous",  "Bloom", 0, 0.0, 100.0),
        exposure = Menu.SliderFloat("World", "Miscellaneous", "Exposure", 0, 0.0, 100.0),
        model_ambient = Menu.SliderFloat("World", "Miscellaneous",  "Model Ambient", 0, 0.0, 100.0),
    },

    misc = {
        misc_enable = Menu.Switch("Miscellaneous", "Miscellaneous", "Enable Miscellaneous", false),
        clantag = Menu.Switch("Miscellaneous", "Helpers", "Enable Clantag", false),
        slowwalk_c = Menu.Switch("Miscellaneous", "Helpers", "Custom Slow Walk", false),
        slowwalk_slider = Menu.SliderInt("Miscellaneous", "Helpers", "Custom Speed", 50, 0, 150),
        hitsound = Menu.Switch("Miscellaneous", "Helpers", "Hitsound Customization", false),
        hitsound_direction = Menu.TextBox("Miscellaneous", "Helpers", "Sound Directory", 128, "csgo/sound/name.wav", "csgo/sound/name.wav"),
        hitsound_volume = Menu.SliderFloat("Miscellaneous", "Helpers", "Sound Volume", 1, 0, 1),
        menu_customize = Menu.Switch("Main","Menu Customization", "Enable Menu Customization", false),
        menu_glow = Menu.Switch("Main","Menu Customization", "Menu Glow", false, "Glow around the Menu."),
        glow_pulse = Menu.Switch("Main","Menu Customization", "Glow Pulse", false),
        color_edit = Menu.ColorEdit("Main","Menu Customization", "Glow Color", Color.RGBA(0, 0, 0, 200), "Pick a color."),
        menu_dim = Menu.Switch("Main", "Menu Customization", "Menu Dim", false, "Dims the Background."),
        dim_slider = Menu.SliderFloat("Main", "Menu Customization", "Dim Intensity:", 0.3, 0.1, 1),
        menu_blur = Menu.Switch("Main", "Menu Customization", "Menu Blur", false, "Blur the Background."),
        blur_slider = Menu.SliderFloat("Main", "Menu Customization", "Blur Intensity:", 0.3, 0.1, 1),
        thirdperson = Menu.Switch("Miscellaneous", "Helpers", "Thirdperson Customization", false),
        thirdperson_anim = Menu.Switch("Miscellaneous", "Helpers", "Disable Thirdperson Animation", false),
        thirdperson_distance = Menu.SliderInt("Miscellaneous", "Helpers", "Distance Value", 100, 0, 300),
        autopeek = Menu.SwitchColor("Miscellaneous", "Helpers", "Auto Peek",false,Color.new(1,0,0,1)),
        color_override = Menu.SwitchColor("Miscellaneous", "Helpers", "Override Color When Work",false, Color.new(0,1,0,1)),
        quick_peek = Menu.Switch("Miscellaneous", "Helpers", "Quick Peek",false),
    },

    refs = {
        slowwalk = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk'),
        minimum_damage = Menu.FindVar('Aimbot', 'Ragebot', 'Accuracy', 'Minimum Damage'),
        doubletap = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'),
        hideshots = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'),
        autopeek = Menu.FindVar('Miscellaneous', 'Main', 'Movement', 'Auto Peek'),
        yaw_base = Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Base'),
        invert_side = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Inverter"),
        fakelags = Menu.FindVar("Aimbot", 'Anti Aim',"Fake Lag", "Enable Fake Lag"),
        antiaim = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Enable Anti Aim"),
        fakeduck = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Fake Duck'),
        safepoints = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'),
        bodyaim = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Body Aim'),
        scope = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope"),

        aa_pitch = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Pitch"),
        aa_yaw_base = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Base"),
        aa_yaw_add = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Add"),
        aa_yaw_modifier = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Modifier"),
        aa_yaw_modifier_degree = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Modifier Degree"),
        aa_limit_left = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Left Limit"),
        aa_limit_right = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Right Limit"),
        aa_fake_options = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Fake Options"),
        aa_lby_mode = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "LBY Mode"),
        aa_freestanding_desync = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Freestanding Desync"),
        aa_desync_onshot = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Desync On Shot"),
        aa_fakelag_limit = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Lag", "Limit"),

        legs = Menu.FindVar("Aimbot", 'Anti Aim', "Misc", "Leg Movement"),

        skybox = Menu.FindVar("Visuals", "World", "Main", "SkyBox")
    }
}
ui.anti_aims.custom = {}
for k, v in pairs(_state) do
    ui.anti_aims.custom[k] = {
        enable = Menu.Switch('Anti-Aim', "Custom Anti-Aim System","Enable ".._state[k].. " setting", false),
        extra_options = Menu.MultiCombo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Extra Options", {'[-] Jitter w Choke'}, 0),
        yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Built-In",{"Static","Period Jitter [Tick]","Period Jitter [Choke]","Period Jitter [Desync]"}, 0),
        static_yaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Modifier",0, -80,80),
        tick_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Left",0, -80, 0),
        tick_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Right",0, 0, 80),
        choke_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Left",0, -80, 0),
        choke_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Right",0, 0, 80),
        desync_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Left",0, -80, 0),
        desync_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Right",0, 0, 80),
        yaw_jitter = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Mode",{ "Off", "Center", "Offset", "Randomized" }, 0),
        yaw_jitter_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Jitter",{ "Static", "Randomized" }, 0),
        yaw_jitter_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [1]",0, 0,120),
        yaw_jitter_degree2 = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [2]",0, 0,120),
        self_bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Body Yaw",{ "Off", "Opposite", "Jitter", "Static"}, 0),
        bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body Yaw Built-In",{"Off", "Static","Period jitter","Recursion"}, 0),
        bodyyaw_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier",0, -180,180),
        jitter_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier left [Period]",0, -180,180),
        jitter_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier right [Period]",0, -180,180),
        body_yaw_step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion ticks ",1,0,15),
        body_yaw_step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion value",5,0,180),
        step_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier min [Recursion]",0,-180,180),
        step_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier max [Recursion]",0,-180,180),
        fake_yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Built-In",{"Static","Period Tick Jitter","Gradually Increase"}, 0),
        static_fakeyaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Yaw Limit",58, 0,60),
        jitter_fakeyaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Left",30, 0,60),
        jitter_fakeyaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Right",30,0,60),
        step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Ticks",8, 1,15),
        step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Value",5, 1,60),
        step_abs = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Increment Absolute Value",false),
        step_fake_min = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Min",58, 0,60),
        step_fake_max = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Max",58, 0,60),
        freestanding_bodyyaw = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Freestanding Body Yaw",false)
    }
end

local fonts = {
    verdana = Render.InitFont("Verdana", 11, {"r"}),
    pixel = Render.InitFont("nl\\psycho\\fonts\\smallest-pixel-7.ttf", 9) or error and Render.InitFont('Smallest Pixel-7.ttf', 9),
    verdanabd11 = Render.InitFont('Verdana', 11, {'b'}),
    verdana11 = Render.InitFont('Verdana', 15, {'b'}),
    arrow_fonts = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 24),
    arrow_font2 = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 16),
    lucida_console = Render.InitFont('lucida console', 10, {'r'}),
    calibrib24 = Render.InitFont('calibri', 24, {'b'})
}

function C_BasePlayer:CanHit() trace_info = Cheat.FireBullet(self, self:GetEyePosition(), EntityList.GetLocalPlayer():GetEyePosition()) if trace_info.damage > 0 and ((trace_info.trace.hit_entity and trace_info.trace.hit_entity:GetPlayer() == EntityList.GetLocalPlayer()) or false) then     return true end return false end
function C_BasePlayer:GetVelocity() first_velocity = self:GetProp('m_vecVelocity[0]') second_velocity = self:GetProp('m_vecVelocity[1]') speed = math.floor(math.sqrt(first_velocity * first_velocity + second_velocity * second_velocity)) return speed end
function C_BasePlayer:GetFlag(shift) return bit.band(self:GetProp('m_fFlags'), bit.lshift(1, shift)) ~= 0 end

stuff = {}
local missgroup_names = { 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }
local miss_reason = { '?', 'spread', 'occlusion', 'prediction error' }

-- @region: math
local adjust_angle = function(angle)
    if(angle < 0) then
        angle = (90 + angle * (-1))
    elseif(angle > 0) then
        angle = (90 - angle)
    end
    return angle
end

local function breath(speed, need)
    need = need or 255
       return math.sin(math.abs(-math.pi + ((GlobalVars.curtime) * (speed / .75)) % (math.pi * 2))) * need
end

local function time_to_ticks(a)
    return math.floor(0.5 + a / GlobalVars.interval_per_tick)
end

function round(x)
    return x >= 0 and math.floor(x+0.5) or math.ceil(x-0.5)
end

function yaw_normalize(yaw)
    if yaw > 180 or yaw < -180 then
        local revolutions = round(math.abs(yaw / 360))
        if yaw < 0 then yaw = yaw + 360*revolutions else yaw = yaw - 360*revolutions end
    end
    return yaw
end

local math_lua = {
    dist_to = function(self,a,b)
        local delta_x = a.x - b.x;
        local delta_y = a.y - b.y;
        return self.round(math.sqrt(delta_x^2 + delta_y^2))
    end,
    round = function(a, b)
        local c = 10^(b or 0)
        return math.floor(a*c+0.5)/c
    end,
    clamp = function(x, y, z)
        if x < y then return y
        elseif x > z then return z
        else return x end
    end
}
local animations = {
    lerp = function(a, b, p)
        return a + (b - a) * p
    end
}

local function num_format(b) local c=b%10;if c==1 and b~=11 then return b..'st'elseif c==2 and b~=12 then return b..'nd'elseif c==3 and b~=13 then return b..'rd'else return b..'th'end end
shot_id = 0
hit_ids = 0
total_hits = 0

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

local helpers = {
    fps_update_time = 0,
    fps = 0,

    text_shadow = function(self, text, pos, color, size, font, centered)
        local centered = centered or false
        Render.Text(text, pos + Vector2.new(1, 1), Color.new(0, 0, 0, color.a * 0.75), size, font, false, centered)
        Render.Text(text, pos, color, size, font, false, centered)
    end,

    mouse_in_bounds = function(self, s, e)
        local mouse_pos = Cheat.GetMousePos()
        return mouse_pos.x > s.x and mouse_pos.x < e.x and mouse_pos.y > s.y and mouse_pos.y < e.y
    end,

    lerp = function(self, x, y, perc)
        local perc = perc or 0.1
        return x + (y - x) * perc
    end,

    copy_color = function(self, c)
        return Color.new(c.r, c.g, c.b, c.a)
    end,

    alpha_modulate = function(self, c, a)
        return Color.new(c.r, c.g, c.b, a)
    end,

    get_fps = function(self)
        if GlobalVars.realtime - self.fps_update_time > 0.5 then
            self.fps = 1 / GlobalVars.frametime
        end

        return self.fps
    end,

    get_time = function(self)
        local sys_time = ffi.new("SYSTEMTIME[1]")
        ffi.C.GetLocalTime(sys_time)
        return ('%02d:%02d:%02d'):format(sys_time[0].wHour, sys_time[0].wMinute, sys_time[0].wSecond)
    end,

    clantag_cache = "",

    clantag_fn = ffi.cast('int(__fastcall*)(const char*, const char*)', Utils.PatternScan('engine.dll', '53 56 57 8B DA 8B F9 FF 15')),

    set_clantag = function (self, tag)
        if tag ~= self.clantag_cache then
            self.clantag_fn(tag, tag)

            self.clantag_cache = tag
        end
    end,
}


-- Check/Download Files
local C = ffi.C

ffi.cdef[[
    void*GetModuleHandleA(const char*);
    void*GetProcAddress(void*,const char*);
    bool TerminateThread(void*,unsigned long);
    bool GetExitCodeThread(void*,unsigned long*);
   
    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 Winmm = ffi.load("Winmm")

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

local function file_exists(file, path_id)
    local func_file_exists = ffi.cast("bool (__thiscall*)(void*, const char*, const char*)", ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011"))[0][10])
    return func_file_exists(ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011")), file, path_id)
end

local create_simple_thread = ffi.cast("void*(__cdecl*)(intptr_t, intptr_t, size_t)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "CreateSimpleThread"))
local release_thread_handle = ffi.cast("bool(__cdecl*)(void*)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "ReleaseThreadHandle"))

if not file_exists(EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png", "GAME") then
    Download("https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png", EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png")
end

local autopeek = {
    is_alive = function(ent)
        return ent:GetProp("m_iHealth") > 0
    end,
    set_movement = function(self,cmd,vec)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local lc_pos = lc:GetRenderOrigin()
        local angles = EngineClient.GetViewAngles()
        local moveTo_x = lc_pos.x - vec.x
        local moveTo_y = lc_pos.y - vec.y
        local tv_x = -20*(moveTo_x * math.cos(angles.yaw / 180 * math.pi) + moveTo_y * math.sin(angles.yaw / 180 * math.pi))
        local tv_y = 20*(moveTo_y * math.cos(angles.yaw / 180 * math.pi) - moveTo_x * math.sin(angles.yaw / 180 * math.pi))
        cmd.forwardmove = tv_x
        cmd.sidemove = tv_y
    end,
    autopeek_main = function(self,cmd)
        local is_m1 = bit.band(cmd.buttons, 1) == 1
        local is_w = bit.band(cmd.buttons, 8) == 8
        local is_s = bit.band(cmd.buttons, 16) == 16
        local is_r = bit.band(cmd.buttons, 512) == 512
        local is_l = bit.band(cmd.buttons, 1024) == 1024
        globals.lp = EntityList.GetLocalPlayer()
        globals.lp_pos = globals.lp:GetRenderOrigin()
        globals.is_in_air = bit.band(globals.lp:GetProp("m_hGroundEntity"), 1)
        if is_m1 then
            globals.autopeek = true
        end
        if not is_w and not is_s and not is_r and not is_l and math_lua:dist_to(globals.lp_pos,globals.autopeek_pos) > 1 and ui.misc.quick_peek:Get() and ui.misc.misc_enable:Get() then
            globals.autopeekq = true
        else
            globals.autopeekq = false
        end
        if not ui.misc.autopeek:Get() then
            if globals.is_in_air == 1 then
                globals.autopeek_pos = EngineTrace.TraceRay(globals.lp_pos,Vector.new(globals.lp_pos.x, globals.lp_pos.y, globals.lp_pos.z-10000), globals.lp, 0xFFFFFFFF).endpos + globals.zero_vec
            else
                globals.autopeek_pos = globals.lp_pos + globals.zero_vec
            end
            globals.autopeek = false
        else
            if ((globals.autopeek and math_lua:dist_to(globals.lp_pos, globals.autopeek_pos) > 1) or globals.autopeekq) then
                if globals.is_in_air == 0 then
                    self:set_movement(cmd,globals.autopeek_pos)
                end
            else
                globals.autopeek = false
                globals.autopeekq = false
            end
        end
    end,
    ragebot_shot = function(shot)
        globals.autopeek = true
    end,
    paint_function = function(self)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local ap_c = ui.misc.autopeek:GetColor()
        if ui.misc.color_override:Get() and ui.misc.misc_enable:Get() then
            if globals.autopeek or globals.autopeekq then
                ap_c = ui.misc.color_override:GetColor()
            else
                ap_c = ui.misc.autopeek:GetColor()
            end
        end
        if ui.misc.autopeek:Get() and ui.misc.misc_enable:Get() then
            for i = 1,40 do
                Render.Circle3DFilled(
                    globals.autopeek_pos,
                    60,
                    i/2,
                    Color.new(
                        ap_c.r,
                        ap_c.g,
                        ap_c.b,
                        ap_c.a*0.03),
                    false)
            end
        end
    end
}

-- @region: ragebot
local rage = {}
rage.data = {}

rage.fix_ang = function(angles)
    while angles.pitch < -180.0 do
        angles.pitch = angles.pitch + 360.0
    end
    while angles.pitch > 180.0 do
        angles.pitch = angles.pitch - 360.0
    end

    while angles.yaw < -180.0 do
        angles.yaw = angles.yaw + 360.0
    end
    while angles.yaw > 180.0 do
        angles.yaw = angles.yaw - 360.0
    end

    if angles.pitch > 89.0 then
        angles.pitch = 89.0
    elseif angles.pitch < -89.0 then
        angles.pitch = -89.0
    end
    if angles.yaw > 180.0 then
        angles.yaw = 180.0
    elseif angles.pitch < -180.0 then
        angles.pitch = -180.0
    end

    return angles
end

rage.vec_ang = function(src, dist)
    local forward = dist - src

    if forward.x == 0 and forward.y == 0 then
        local yaw = 0

        if forward.z > 0 then
            pitch = 270
        else
            pitch = 90
        end

    else
        yaw = (math.atan2(forward.y, forward.x) * 180 / math.pi)
        if yaw < 0 then
            yaw = yaw + 360
        end

        tmp = math.sqrt(forward.x * forward.x + forward.y * forward.y)
        pitch = (math.atan2(-forward.z, tmp) * 180 / math.pi)

        if pitch < 0 then
            pitch = pitch + 360
        end

    end

    return rage.fix_ang(QAngle.new(pitch, yaw, 0))
end
rage.modify_velocity = function(cmd, goalspeed)
    local minspeed = math.sqrt((cmd.forwardmove * cmd.forwardmove) + (cmd.sidemove * cmd.sidemove))
    if goalspeed <= 0 or minspeed <= 0 then
        return
    end

    if EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') >= 1 then
        goalspeed = goalspeed * 2.94117647
    end

    if minspeed <= goalspeed then
        return
    end

    local speedfactor = goalspeed / minspeed
    cmd.forwardmove = cmd.forwardmove * speedfactor
    cmd.sidemove = cmd.sidemove * speedfactor
end
rage.roundStarted = 0
rage.player_info_prev = {}
for i = 1, 64 do
    rage.player_info_prev[i] = {
        origin = Vector.new(0, 0, 0),
    }
end


local baim = ui.refs.bodyaim:Get()

rage.baim = function()

    if not ui.ragebot.ragebot_enable:Get() and ui.ragebot.bodyaims:Get() then return end
    local all_players = EntityList.GetEntitiesByName("CCSPlayer")
    for i = 1, #all_players do
        local target = all_players[i]:GetPlayer()
        if target ~= EntityList.GetLocalPlayer() and not target:IsTeamMate() and target:GetProp("m_iHealth") > 0 then

        local me = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        local weap = target:GetActiveWeapon()

        local hp = target:GetProp('m_iHealth')
            if ui.ragebot.baimmode:Get() == 0 then
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 1 then
                ui.refs.bodyaim:SetInt(1)
            else
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 2 then
                ui.refs.bodyaim:SetInt(2)
            else
                ui.refs.bodyaim:SetInt(baim)
            end

        end
    end

end

rage.hitchances = function()

    local accepted_weapons = {
        ["261"] = 1,
        ["242"] = 1,
    }
    local accepted_weapons2 = {
        ["267"] = 1,
        ["46"] = 1,
    }

    local get_enemies = function()
        local ret = {}
        local players = EntityList.GetPlayers()
        for _ , player in pairs(players) do      
            if player:IsTeamMate() or not player:IsAlive() or player:IsDormant() then goto s end

            ret[#ret+1] = player:EntIndex()
            ::s::
        end

        return ret
    end

    if not ui.ragebot.ragebot_enable or ui.ragebot.hitchances == 0 then return end
   
    local i = get_enemies()
    local air_check = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1) == 0 and ui.ragebot.hitchances:Get(1) and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons2[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]
    local wpn_check = ui.ragebot.hitchances:Get(2) and EntityList.GetLocalPlayer():GetProp("m_bIsScoped")==false and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]

    if (not air_check and not wpn_check)  then return end

    for k,v in pairs(i) do
        RageBot.OverrideHitchance(v , (air_check==1 and ui.ragebot.air_hitchance:Get() or ui.ragebot.noscope_hitchance:Get()))
    end
end

rage.ragebot = function(cmd)
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer or not localplayer:IsAlive() then
        return
    end

    if not ui.ragebot.ragebot_enable:Get() or not ui.ragebot.override_doubletap:Get() then return end

    if ui.ragebot.override_doubletap:Get() then
        Exploits.OverrideDoubleTapSpeed(ui.ragebot.doubletap_speed:Get())  
    end

    if ui.ragebot.doubletap_recharge:Get() then
        Exploits.ForceCharge()
    end

end

rage.dormant_aim = function(cmd)
    if ui.ragebot.dormant_aimbot:GetBool() then
        local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        if lp == nil then return end
        rage.can_hit_i = false
        rage.choke = false
        local ent = lp:GetActiveWeapon()
        if not ent then return end
        local inaccuracy = 1 / ent:GetInaccuracy(ent)
        if inaccuracy == nil then return end
        local tickcount = GlobalVars.tickcount
        local eyepos = lp:GetEyePosition()
        local simtime = lp:GetProp('m_flSimulationTime')
        local weapon = ent:GetWeaponID()
        local scoped = lp:GetProp('m_bIsScoped')
   
        local onground = bit.band(lp:GetProp('m_fFlags'), bit.lshift(1, 0))
        if tickcount < rage.roundStarted then return end -- to prevent shooting at ghost dormant esp @ the beginning of round
        local is_AWP = weapon == 9
        local is_auto = (weapon == 38 or weapon == 11)
        local is_scout = weapon == 40
        if ent:IsKnife() or ent:IsGrenade() or ent:IsReloading() or weapon == 31 then return end
        local hs_fix = ui.refs.hideshots:GetBool() and 0.3 or 0
        if weapon == 64 then -- for some reason can_shoot returns always false with r8 despite all 3 props being true, no idea why
            rage.can_shoot = simtime > ent:GetProp('m_flNextPrimaryAttack') + hs_fix -- doing this fixes it ><
        elseif ent:IsPistol() and not weapon == 64 and not weapon == 1 then
            rage.can_shoot = false
        else
            rage.can_shoot = simtime > math.max(lp:GetProp('m_flNextAttack') + hs_fix, ent:GetProp('m_flNextPrimaryAttack') + hs_fix, ent:GetProp('m_flNextSecondaryAttack'))
        end
   
        -- new player info
        local players = EntityList.GetEntitiesByName('CCSPlayer')
        rage.player_info = {}
        for i = 1, #players do
            local player = players[i]:GetPlayer()
            if EngineClient.IsConnected() and lp:IsAlive() then
                --if plist_get(player, 'Add to whitelist') then goto skip end
                if player:IsDormant() and not player:IsTeamMate() and player:GetProp('m_iHealth') > 0 and player ~= lp then
                    if player:GetRenderOrigin():Length2D() > ent:GetWeaponRange() then return end
                    rage.origin = player:GetProp('m_vecOrigin')
                    rage.alpha_multiplier = player:GetESPAlpha() -- grab alpha of the dormant esp
                    if rage.player_info_prev[i] ~= nil and rage.origin.x ~= 0 and rage.alpha_multiplier > 0 then -- if origin / dormant esp is valid
                        local dormant_accurate = rage.alpha_multiplier > 0.1 -- for debug purposes lower this to 0.1
                        if dormant_accurate then
                            local target_points = {
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 28) or Vector.new(0, 0, 38)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 30) or Vector.new(0, 0, 40)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 32) or Vector.new(0, 0, 42)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 40) or Vector.new(0, 0, 50))
                            }
                       
                            for i = 1, #target_points do
                                local target = target_points[i]
                                local target_pos = rage.vec_ang(eyepos, target)
                                local dmg = Cheat.FireBullet(lp, eyepos, target)
                                if is_AWP then
                                    max_player_speed_alt = 100
                                elseif is_auto then
                                    max_player_speed_alt = 120
                                else
                                    max_player_speed_alt = ent:GetMaxSpeed() * 0.86
                                end
                                rage.can_hit = (dmg.trace.hit_entity == nil or dmg.trace.hit_entity:EntIndex() == player:EntIndex()) and (dmg.damage > ui.ragebot.dormant_aimbot_damage:GetInt()) and (not player:IsVisible(target)) -- added visibility check to mitigate shooting at anomalies?
                               
                                if rage.can_hit then
                                    rage.can_hit_i = true
                                    if rage.can_shoot then
                                        rage.modify_velocity(cmd, (scoped and max_player_speed_alt or ent:GetMaxSpeed())*0.2)
                                        -- autoscope
                                        if not scoped and ent:IsSniper() and onground == 1 then
                                            cmd.buttons = bit.bor(cmd.buttons, 2048)
                                        end
                                    end
                                   
                                    if ui.refs.hideshots:GetBool() then
                                        rage.choke = rage.can_shoot
                                    else
                                        rage.choke = true
                                    end
                                   
                                    if inaccuracy >= 90 and rage.choke == true then
                                        cmd.viewangles.pitch = target_pos.pitch
                                        cmd.viewangles.yaw = target_pos.yaw
                                        cmd.viewangles.roll = 0
                                        cmd.buttons = bit.bor(cmd.buttons, 1)
                                        -- dont shoot again
                                        rage.can_shoot = false
                                    end
                                end
                            end
                        end
                    end
                    rage.player_info[i] = {rage.origin, rage.alpha_multiplier, rage.can_hit_i}
                end
            end
        end
        rage.player_info_prev = rage.player_info
    end
end

rage.resetter = function(event)
    if not ui.ragebot.dormant_aimbot:Get() then return end
    if event:GetName() ~= 'round_prestart' then return end
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
    if lp == nil then return end
    freezetime = (CVar.FindVar('mp_freezetime'):GetFloat()+1) / GlobalVars.interval_per_tick -- get freezetime plus 1 second and disable dormantbob for that amount of ticks
    rage.roundStarted = GlobalVars.tickcount + freezetime
    rage.origin = nil
    rage.player_info_prev = {}
    for i = 1, 64 do
        rage.player_info_prev[i] = {
            origin = Vector.new(0, 0, 0),
        }
    end
    rage.player_info = {}
end

rage.on_registered_shot = function(shot)
    if shot.reason ~= 1 then return end
   
    if not rage.data[shot.target_index] then
        rage.data[shot.target_index] = {
            esp_bool = false,
            shots = 0,
        }
    end

    rage.data[shot.target_index].shots = rage.data[shot.target_index].shots + 1
end

rage.on_prediction = function()
    if not ui.ragebot.maxmissed:Get() and ui.ragebot.ragebot_enable:Get() then return end
   
    for player_index, data in pairs(rage.data) do
        if data.shots >= ui.ragebot.maxmissed_c:Get() then
            data.esp_bool = true

            RageBot.EnableHitbox(player_index, 0, false)
        end
    end
end

rage.reset_data = function(event)
    if event:GetName() ~= 'round_start' then return end
   
    rage.data = {}
end

-- @endregion

-- @region: misc
local misc = {}
misc.slowwalk = function(cmd)
    if not ui.misc.slowwalk_c:GetBool() then return end
        if cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.forwardmove < 0 and -cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = -ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove < 0 and -cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = -ui.misc.slowwalk_slider:GetInt() end
end

local clantag_restore = false
-- clantag
misc.clantag = function()
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer then return end

    if ui.misc.clantag:Get() and ui.misc.misc_enable:Get() then
        local tag =
        {
            "ps",
            "psy",
            "psyc",
            "psych ",
            "psycho",
            "psycho ",
            "psych",
            "psyc",
            "psy",
            "ps",
            "p",
            "",

        }

        local netchann_info = EngineClient.GetNetChannelInfo()

        if netchann_info == nil then
            return
        end

        local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
        local tickcount_pred = GlobalVars.tickcount + latency
        local iter = math.floor(math.fmod(tickcount_pred / 32, #tag) + 1)
       
        helpers:set_clantag(tag[iter])
        clantag_restore = false

    elseif not clantag_restore then
        helpers:set_clantag("")  
    end
end

local t = {}
misc.removeimpact = function()
    if #t == nil then
        return
    end

    if not EngineClient.IsConnected() then
        table.remove(t, #t)
        return
    end

    for i = 1, #t do
        if t[i] == nil then
            return
        end

        if t[i].ctime + 4 > math.floor(GlobalVars.curtime) then
            return
        end

        t[i].a = t[i].a - math.floor(GlobalVars.frametime * 300)

        if t[i].a < 0 then
            table.remove(t, i)
        end
    end
end
-- @endregion

-- @region: anti-aims
local anti_aims = {}
local flag_status = 0

AntiAim.jitter = {}
AntiAim.jitter.c_var = {
    choke = 0,
    yaw_v = 0,
    yaw_r = 1,
    byaw_v = 0,
    byaw_r = 1,
    fyaw_v = 0,
    fyaw_r = 0
}

AntiAim.c_var = {
    c = 1,
    ground_ticks = 0,
    step_ticks = 0,
    min = 0,
    max = 0,
    step = 0,
    return_value = 0,
    bodystep_ticks = 0,
    bodystep_min = 0,
    bodystep_max = 0,
    bodystep_step = 0,
    bodystep_return_value = 0
}

AntiAim.save_antiaims = {
    pitch = "Off",
    yaw_base = "Local view",
    yaw_1 = "Off",
    yaw_2 = 0,
    yaw_jitter_1 = "Off",
    yaw_jitter_2 = 0,
    body_yaw_1 = "Off",
    body_yaw_2 = 0,
    fake_yaw_limit = 0,
    freestanding_body_yaw = false
}

function AntiAim.jitter:tick(a,b)
    return GlobalVars.tickcount % 4 >= 2 and a or b
end

function AntiAim.jitter:choke_yaw(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.yaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.yaw_r = AntiAim.jitter.c_var.yaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.yaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
   
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end

function AntiAim.jitter:normalize_yaw(p)
    while p > 180 do
        p = p - 360
    end
    while p < -180 do
        p = p + 360
    end
    return p
end

function AntiAim.jitter:choke_body_yaw(a,b)
    local inverted = AntiAim.GetInverterState()
    local invert = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return invert and a or b
    end
end

function AntiAim.jitter:choke_fake(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.fyaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.fyaw_r = AntiAim.jitter.c_var.fyaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.fyaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
   
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end
local start_time = GlobalVars.curtime

local function get_tick()
    local end_time = GlobalVars.curtime
    local get_time = math.abs(math.floor((start_time - end_time) * 100)) % 2
    return get_time
end

function AntiAim.jitter:desync(a,b)
    local inverted = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return inverted and a or b
    end
end

clamp = function(value, minimum, maximum)
    if minimum > maximum then
        return math.min(math.max(value, maximum), minimum)
    else
        return math.min(math.max(value, minimum), maximum)
    end
end

AntiAim.side = 1
AntiAim.override_yaw = function(cmd, yaw_add, jitter_value, jitter_type)
    if FakeLag.SentPackets() ~= 0 then
        AntiAim.side = AntiAim.side * -1
    end
   
    local yaw_modifier = yaw_add
   
    if jitter_type == 1 then
        yaw_modifier = yaw_modifier+(jitter_value/2)*AntiAim.side
    elseif jitter_type == 2 then
        yaw_modifier = yaw_modifier+jitter_value*((AntiAim.side+1)/2)
    elseif jitter_type == 3 then
        yaw_modifier = math.random(-jitter_value,jitter_value)
    elseif jitter_type == 4 then
        yaw_modifier = yaw_modifier-(GlobalVars.tickcount*3)%jitter_value
    end

    return yaw_modifier
end

function AntiAim:run_custom(cmd)
    if EntityList.GetLocalPlayer() == nil or not ui.anti_aims.antiaim_enable:GetBool() then
        return
    end
    local p_duck = EntityList.GetLocalPlayer():GetProp("m_flDuckAmount")
    local inair = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags" ), 1 ) == 0
    local on_ground = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1)
    local vx, vy, vz = EntityList.GetLocalPlayer():GetProp("m_vecVelocity").x, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").y, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").z
    local p_still = math.sqrt(vx ^ 2 + vy ^ 2)
    local p_slow = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk')

    AntiAim.jitter.c_var.choke = ClientState.m_choked_commands
    local m = ui.anti_aims.custom
    AntiAim.save_antiaims.yaw_1 = "180"

    if on_ground == 1 then
        AntiAim.c_var.ground_ticks = AntiAim.c_var.ground_ticks + 1
    else
        AntiAim.c_var.ground_ticks = 0
    end
    if m[3].enable:Get() and p_slow then
        AntiAim.c_var.c = 3
    elseif inair and m[6].enable:Get() and EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') > 0.7 then
        AntiAim.c_var.c = 6
    elseif inair and m[5].enable:Get() then
        AntiAim.c_var.c = 5
    elseif p_duck > 0.8 and not inair and AntiAim.c_var.ground_ticks > 8 and m[4].enable:Get() then
        AntiAim.c_var.c = 4
    elseif p_still > 70 and AntiAim.c_var.ground_ticks > 8 and m[2].enable:Get() then
        AntiAim.c_var.c = 2
    elseif p_still < 2 and  AntiAim.c_var.ground_ticks > 8 and m[1].enable:Get() then
        AntiAim.c_var.c = 1
    else
        AntiAim.c_var.c = 5
    end
    AntiAim.save_antiaims.yaw_base = "At targets"
    AntiAim.save_antiaims.yaw_1 = "180"
    AntiAim.save_antiaims.pitch = 1

    if AntiAim.c_var.c == 1 and m[1].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 2 and m[2].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 3 and m[3].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 24
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 4 and m[4].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 35
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 5 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 15
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 6 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 17
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    else
        AntiAim.c_var.max = m[AntiAim.c_var.c].step_fake_max:Get()
        AntiAim.c_var.min = m[AntiAim.c_var.c].step_fake_min:Get()
        AntiAim.c_var.step = m[AntiAim.c_var.c].step_value:Get()
        AntiAim.c_var.step_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].step_ticks:Get()

        if m[AntiAim.c_var.c].step_fake_min:Get() >= m[AntiAim.c_var.c].step_fake_max:Get()then
            m[AntiAim.c_var.c].step_fake_min:Set(m[AntiAim.c_var.c].step_fake_max:Get())
        end

        if AntiAim.c_var.step_ticks == m[AntiAim.c_var.c].step_ticks:Get() - 1 then
            if AntiAim.c_var.return_value < AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.return_value + m[AntiAim.c_var.c].step_value:Get()
            elseif AntiAim.c_var.return_value >= AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.min
            end
        end

        AntiAim.c_var.bodystep_max = m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get()
        AntiAim.c_var.bodystep_min = m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get()
        AntiAim.c_var.bodystep_step = m[AntiAim.c_var.c].body_yaw_step_value:Get()
        AntiAim.c_var.bodystep_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].body_yaw_step_ticks:Get()

        if m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get() >= m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get() then
            m[AntiAim.c_var.c].step_bodyyaw_degree_left:Set(m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get())
           
        end
        if AntiAim.c_var.bodystep_ticks == m[AntiAim.c_var.c].body_yaw_step_ticks:Get() - 1 then
            if AntiAim.c_var.bodystep_return_value < AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_return_value + AntiAim.c_var.bodystep_step
            elseif AntiAim.c_var.bodystep_return_value >= AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_min
            end
        end

        if m[AntiAim.c_var.c].yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.yaw_2 = m[AntiAim.c_var.c].static_yaw:Get()
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:tick(m[AntiAim.c_var.c].tick_yaw_left:Get(),m[AntiAim.c_var.c].tick_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 2 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:choke_yaw(m[AntiAim.c_var.c].choke_yaw_left:Get(),m[AntiAim.c_var.c].choke_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 3 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:desync(m[AntiAim.c_var.c].desync_yaw_left:Get(),m[AntiAim.c_var.c].desync_yaw_right:Get())
        end

        if m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 1 then
            if m[AntiAim.c_var.c].yaw_jitter_degree:Get() >= m[AntiAim.c_var.c].yaw_jitter_degree2:Get() then
                m[AntiAim.c_var.c].yaw_jitter_degree:Set(m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
            end
        end

        AntiAim.save_antiaims.yaw_jitter_1 = m[AntiAim.c_var.c].yaw_jitter:Get()
        AntiAim.save_antiaims.yaw_jitter_2 = m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 0 and m[AntiAim.c_var.c].yaw_jitter_degree:Get() or math.random(m[AntiAim.c_var.c].yaw_jitter_degree:Get(), m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
        AntiAim.save_antiaims.body_yaw_1 = m[AntiAim.c_var.c].self_bodyyaw_mode:Get()

        if m[AntiAim.c_var.c].bodyyaw_mode:Get() == 1 then
            AntiAim.save_antiaims.body_yaw_2 = m[AntiAim.c_var.c].bodyyaw_degree:Get()
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 2 then
            AntiAim.save_antiaims.body_yaw_2 = AntiAim.jitter:choke_body_yaw(m[AntiAim.c_var.c].jitter_bodyyaw_degree_left:Get(), m[AntiAim.c_var.c].jitter_bodyyaw_degree_right:Get())
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 3 then
            AntiAim.save_antiaims.body_yaw_2 = clamp(AntiAim.c_var.bodystep_return_value, AntiAim.c_var.bodystep_min, AntiAim.c_var.bodystep_max)
        end

        if m[AntiAim.c_var.c].fake_yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.fake_yaw_limit = m[AntiAim.c_var.c].static_fakeyaw:Get()
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.fake_yaw_limit = AntiAim.jitter:choke_fake(m[AntiAim.c_var.c].jitter_fakeyaw_left:Get(),m[AntiAim.c_var.c].jitter_fakeyaw_right:Get())
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 2 then
            if m[AntiAim.c_var.c].step_abs:Get() then
                AntiAim.save_antiaims.fake_yaw_limit = math.abs(clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max))
            else
                AntiAim.save_antiaims.fake_yaw_limit = clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max)
            end
        end
        AntiAim.save_antiaims.freestanding_body_yaw = m[AntiAim.c_var.c].freestanding_bodyyaw:Get()
    end
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Pitch'):Set(AntiAim.save_antiaims.pitch)

    AntiAim.OverrideYawOffset(AntiAim.override_yaw(cmd, AntiAim.save_antiaims.yaw_2, AntiAim.save_antiaims.yaw_jitter_2, AntiAim.save_antiaims.yaw_jitter_1))
    AntiAim.OverrideLimit(AntiAim.save_antiaims.fake_yaw_limit)

    if AntiAim.save_antiaims.body_yaw_1 == 0 then -- off
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 1 then -- opposite
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 2 then -- jitter
        AntiAim.OverrideInverter(AntiAim.side ~= 1)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
    else -- static
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Set(2, false)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
    end
   
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Add'):Set(0)
   
    Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Freestanding Desync'):Set(AntiAim.save_antiaims.freestanding_body_yaw and 1 or 0)
end

vector_lerp = function(vecSource, vecDestination, flPercentage) return vecSource + (vecDestination - vecSource) * flPercentage end
anti_aims.vecnew = Vector.new()
anti_aims.edge_yaw = function()
    if not ui.anti_aims.antiaim_enable:Get() then return end
    if ui.anti_aims.antiaim_helpers:Get(5) then
        local local_player = EntityList.GetLocalPlayer()
        if local_player == nil then return end
        local flag = EntityList.GetLocalPlayer():GetProp("m_fFlags")
        if (flag == 256 or flag == 262) then -- air
            return
        end
        --if local_player:GetState() == 'Air' then return end
        if ClientState.m_choked_commands == 0 then
            anti_aims.vecnew = local_player:GetEyePosition()
        end
        local trace_end = {}
        local ang_view_angles = EngineClient.GetViewAngles()
        for yaww = 18, 360, 18 do
            local yaww = normalize_yaw(yaww)
            local edge_angle = QAngle.new(0, yaww, 0)
            local vec_trace_end = anti_aims.vecnew + Cheat.AngleToForward(edge_angle) * 0x60
            local traceInfo = EngineTrace.TraceRay(anti_aims.vecnew, vec_trace_end, local_player, 0x200400B)
            if traceInfo.hit_entity and traceInfo.hit_entity:GetClassName() == 'CWorld' and traceInfo.fraction < 0.3 then
                trace_end[#trace_end + 1] = {
                    vec_trace_end = traceInfo.endpos,
                    yaww = yaww
                }
            end
        end
        table.sort(trace_end, function(a, b)
            return a.yaww < b.yaww
        end)
        local edge_angle
        if #trace_end >= 2 then
            local vec_trace_center = vector_lerp(trace_end[1].vec_trace_end, trace_end[#trace_end].vec_trace_end, 0.5)
            edge_angle = Cheat.VectorToAngle(anti_aims.vecnew - vec_trace_center)
        end

        if edge_angle then
            local yaww = ang_view_angles.yaw
            local edgee_yaw = edge_angle.yaw
            local difff = normalize_yaw(edgee_yaw - yaww)
            if math.abs(difff) < 90 then
                difff = 0
                yaww = normalize_yaw(edgee_yaw + 180)
            end
            local new_yaw = -yaww
            new_yaw = normalize_yaw(new_yaw + edgee_yaw + 180)
            new_yaw = normalize_yaw(new_yaw + difff)
            AntiAim.OverrideYawOffset(new_yaw)
        end
    end
end

anti_aims.avoid_backstab = function()
    if ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(4) then
        local all_players = EntityList.GetEntitiesByName('CCSPlayer')
        for i = 1, #all_players do
            local enemy = all_players[i]:GetPlayer()
            if enemy ~= EntityList.GetLocalPlayer() and not enemy:IsTeamMate() and not enemy:IsDormant() and enemy:IsAlive() and enemy:GetActiveWeapon() ~= nil and enemy:GetActiveWeapon():IsKnife() then
                if EntityList.GetLocalPlayer():GetRenderOrigin():DistTo(enemy:GetProp('m_vecOrigin')) <= 300 then
                    AntiAim.OverrideYawOffset(180)
                end
            end
        end
    end
end

anti_aims.antiaim_helpers = function()

    if not ui.anti_aims.antiaim_enable:Get() then return end

        if ui.anti_aims.antiaim_helpers:Get(1) then

            if ui.refs.hideshots:Get() then
                    ui.refs.fakelags:Set(false)
                else
                    ui.refs.fakelags:Set(true)
            end
        end
end

anti_aims.disable_aa_warmup = function()

    local warmup_period = EntityList.GetGameRules():GetProp("m_bWarmupPeriod")

    if  ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(3) then

        if warmup_period == true then
            ui.refs.antiaim:Set(false)
        else
            ui.refs.antiaim:Set(true)
        end

    end

end

anti_aims.exploit_teleport = function()
    if ui.ragebot.tp_in_air:Get() ~= 0 and ui.anti_aims.antiaim_enable:Get() and ui.refs.doubletap:Get() and ui.ragebot.Teleport_In_Air:Get() then
        local allow_teleport = false
        local enable_teleport = false

        local active_weapon = EntityList.GetLocalPlayer():GetActiveWeapon()
        if active_weapon == nil then return end
        local weapon_id = active_weapon:GetWeaponID()

        local guns = {
            is_AWP = weapon_id == 9,
            is_auto = (weapon_id == 38 or weapon_id == 11),
            is_scout = weapon_id == 40,
            is_deagle = weapon_id == 1,
            is_r8 = weapon_id == 64,
            is_nades = active_weapon:IsGrenade(),
            is_pistols = active_weapon:IsPistol() and not is_deagle and not is_r8,
            is_smg = (weapon_id == 34 or weapon_id == 23 or weapon_id == 24 or weapon_id == 19 or weapon_id == 26 or weapon_id == 33 or weapon_id == 17),
            is_shotguns = (weapon_id == 35 or weapon_id == 25 or weapon_id == 27 or weapon_id == 29),
            is_rifle = active_weapon:IsRifle() and not is_smg and not is_shotguns,
            is_taser = weapon_id == 31,
        }
       
        for _, weapons in pairs({
            {Value = 1, active_weapon = guns.is_AWP},
            {Value = 2, active_weapon = guns.is_auto},
            {Value = 3, active_weapon = guns.is_scout},
            {Value = 4, active_weapon = guns.is_deagle},
            {Value = 5, active_weapon = guns.is_r8},
            {Value = 6, active_weapon = guns.is_nades},
            {Value = 7, active_weapon = not (guns.is_AWP or guns.is_auto or guns.is_scout or guns.is_deagle or guns.is_r8 or guns.is_nades or guns.is_pistols or guns.is_rifle or guns.is_smg or guns.is_shotguns or guns.is_taser)},
            {Value = 8, active_weapon = guns.is_pistols},
            {Value = 9, active_weapon = guns.is_rifle},
            {Value = 10, active_weapon = guns.is_smg},
            {Value = 11, active_weapon = guns.is_shotguns},
            {Value = 12, active_weapon = guns.is_taser}
        }) do
            if ui.ragebot.tp_in_air:Get(weapons.Value) and weapons.active_weapon then
                allow_teleport = true
            end
        end

        if allow_teleport then
            all_players = EntityList.GetEntitiesByName('CCSPlayer')
            for i = 1, #all_players do
                enemy = all_players[i]:GetPlayer()
                if not enemy:IsTeamMate() and enemy:IsAlive() and not enemy:IsDormant() and enemy:CanHit() then
                    enable_teleport = true
                end
            end
        end
       
        if enable_teleport and not EntityList.GetLocalPlayer():GetFlag(0) and EntityList.GetLocalPlayer():GetVelocity() > 25 then
            Exploits.ForceTeleport()
        end
    end
end

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

ffi_functions.get_entity_address = function(entity_index)
    local addr = ffi_functions.GET_CLIENT_ENTITY_FN(ffi_functions.ENTITY_LIST_POINTER, entity_index)
    return addr
end

ffi_functions.hook = {hooks = {}}
ffi_functions.hook.new = function(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(ffi_functions.hook.hooks, new_hook)
    return setmetatable(new_hook, mt)
end

anti_aims.is_jumping = false
anti_aims.ground_ticks, anti_aims.end_time = 1, 0
anti_aims.updateCSA_hk = function(thisptr, edx)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if localplayer == nil then return anti_aims.updateCSA_fn(thisptr, edx) end
    local lp_ptr = ffi_functions.get_entity_address(EngineClient.GetLocalPlayer())

    if ui.anti_aims.animbreakers:Get(1) then ui.refs.legs:Set(1) end

    if ui.anti_aims.animbreakers:Get() == 0 or not ui.anti_aims.antiaim_enable:Get() then anti_aims.updateCSA_fn(thisptr, edx) return end

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end

    if ui.anti_aims.animbreakers:Get(2) then
        ffi.cast('float*' , lp_ptr+10104)[0] = 1
    end

    if ui.anti_aims.animbreakers:Get(3) then
        ffi.cast('float*' , lp_ptr+10104)[12] = 0
    end

    anti_aims.updateCSA_fn(thisptr, edx)

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end
   
    if ui.anti_aims.animbreakers:Get(3) then
        if bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), 1) == 1 then
            anti_aims.ground_ticks = anti_aims.ground_ticks + 1
        else
            anti_aims.ground_ticks = 0
            anti_aims.end_time = GlobalVars.curtime + 1
        end
        if not anti_aims.is_jumping and anti_aims.ground_ticks > 1 and anti_aims.end_time > GlobalVars.curtime then
            ffi.cast('float*' , lp_ptr+10104)[12] = 0.5
        end
    end
end

Cheat.RegisterCallback('destroy', function()
    for i, v in ipairs(ffi_functions.hook.hooks) do
        if v.status then
            v.stop()
        end
    end
end)

anti_aims.updateCSA_fn = ffi_functions.hook.new('void(__fastcall*)(void*, void*)', anti_aims.updateCSA_hk, ffi.cast('uintptr_t', Utils.PatternScan('client.dll', '8B F1 80 BE ? ? ? ? ? 74 36', -5))) or error("updateCSA_fn can't hook")
-- @endregion

local draggable = {}
function draggable:new(name, size, init_pos)
    local drag = {}
    local init_pos = init_pos or Vector2.new(100, 100)
    drag.size = size
    drag.x = Menu.SliderInt('Visuals', "draggable elements", name .. "_x", init_pos.x, 0, globals.screen_size.x)
    drag.y = Menu.SliderInt('Visuals', "draggable elements", name .. "_y", init_pos.y, 0, globals.screen_size.y)
    drag.x:SetVisible(false)
    drag.y:SetVisible(false)
    drag.captured = false
    drag.clicked = false
    drag.mouse_offset = Vector2.new(0, 0)

    setmetatable(drag, self)
    self.__index = self
   
    return drag
end

function draggable:get()
    return Vector2.new(self.x:Get(), self.y:Get())
end

function draggable:update()
    if not Cheat.IsMenuVisible() then
        return
    end

    local mouse_pos = Cheat.GetMousePos()
    local mouse_hold = Cheat.IsKeyDown(1)

    if not self.clicked and mouse_hold then
        self.clicked = true
        if not self.captured and mouse_hold and helpers:mouse_in_bounds(self:get(), self:get() + self.size) then
            self.captured = true
            self.mouse_offset = mouse_pos - self:get()
        end
    end

    if not mouse_hold then
        self.captured = false
        self.clicked = false
    end

    if self.captured then
        self.x:Set(mouse_pos.x - self.mouse_offset.x)
        self.y:Set(mouse_pos.y - self.mouse_offset.y)
    end
end

function draggable:set_size(size)
    self.size = size
end

-- @region: widgets
local indicators = {}
indicators.on_plant_time, indicators.fill, indicators.planting_site, indicators.planting = 0, 0, '', false
indicators.Render_Shadow = function(start_pos, endpos, color)
    Render.GradientBoxFilled(start_pos, Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), endpos.y), Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color)
    Render.GradientBoxFilled(Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), start_pos.y), endpos, color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0))
end

indicators.contains = function(table, val)
    for i=1, #table do
        if table[i] == val then
            return true
        end
    end
    return false
end

indicators.clear_planting_info = function()
    planting = false
    fill = 0
    on_plant_time = 0
    planting_site = ''
end

indicators.bomb = function(event)
    typese = {
        'bomb_abortplant', 'bomb_defused', 'bomb_planted', 'round_prestart'
    }
   
    if indicators.contains(typese, event:GetName()) then indicators.clear_planting_info() end
   
    if event:GetName() == 'bomb_beginplant' then
        on_plant_time = GlobalVars.curtime
        planting = true
        bombsite = event:GetInt('site');
        APlants = (454 or 372 or 102 or 276 or 174 or 121 or 301 or 142 or 408 or 97 or 213 or 216)
        if bombsite == APlants then
            planting_site = 'Bombsite A'
        else
            planting_site = 'Bombsite B'
        end
    end
end

indicators.Render_Indicator = function(text, col, cur)
    local position = Vector2.new(20, (globals.screen_size.y / 1.55) + (39 * cur))
    local positionS = Vector2.new(21, (globals.screen_size.y / 1.55 + 1) + (39 * cur))
    local textsize = Render.CalcTextSize(text, 24, fonts.calibrib24)

    indicators.Render_Shadow(Vector2.new(position.x - 10, position.y - 7), Vector2.new(position.x + textsize.x - 10, position.y + textsize.y + 2), Color.RGBA(0, 0, 0, 56 * col.a))

    Render.Text(text, positionS, Color.RGBA(33, 33, 33, 127 * col.a), 24, fonts.calibrib24)
    Render.Text(text, position, col, 24, fonts.calibrib24)
end

widgets = {
    create_window = function(self, s, e, alpha)
        local color = helpers:copy_color(ui.visuals.theme:Get())
        local background_color = Color.new(0, 0, 0, alpha * ui.visuals.theme:Get().a)
        local border_color1 = helpers:alpha_modulate(color, alpha)
        local border_color2 = helpers:alpha_modulate(color, alpha * 0.4)

        Render.Blur(s, e, Color.new(1 - background_color.a, 1 - background_color.a, 1 - background_color.a, alpha), 5)

        if not ui.visuals.disable_blur:Get() then
        Render.Box(s - Vector2.new(6, 6), e + Vector2.new(6, 6), helpers:alpha_modulate(border_color1, alpha * 0.02), 5)
        Render.Box(s - Vector2.new(5, 5), e + Vector2.new(5, 5), helpers:alpha_modulate(border_color1, alpha * 0.03), 5)
        Render.Box(s - Vector2.new(4, 4), e + Vector2.new(4, 4), helpers:alpha_modulate(border_color1, alpha * 0.04), 5)
        Render.Box(s - Vector2.new(3, 3), e + Vector2.new(3, 3), helpers:alpha_modulate(border_color1, alpha * 0.08), 5)
        Render.Box(s - Vector2.new(2, 2), e + Vector2.new(2, 2), helpers:alpha_modulate(border_color1, alpha * 0.13), 5)
        Render.Box(s - Vector2.new(1, 1), e + Vector2.new(1, 1), helpers:alpha_modulate(border_color1, alpha * 0.20), 5)
        end
       
        Render.BoxFilled(s + Vector2.new(5, 0), Vector2.new(e.x - 5, s.y + 1), border_color1)
        Render.BoxFilled(Vector2.new(s.x + 5, e.y - 1), e - Vector2.new(5, 0), border_color2)
        Render.GradientBoxFilled(Vector2.new(s.x, s.y + 5), Vector2.new(s.x + 1, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.GradientBoxFilled(Vector2.new(e.x - 1, s.y + 5), Vector2.new(e.x, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.Circle(s + Vector2.new(5, 5), 5, 8, border_color1, 1, -90, -180)
        Render.Circle(Vector2.new(s.x + 5, e.y - 5), 5, 8, border_color2, 1, 90, 180)
        Render.Circle(e - Vector2.new(5, 5), 5, 8, border_color2, 1, 0, 90)
        Render.Circle(Vector2.new(e.x - 5, s.y + 5), 5, 8, border_color1, 1, -90, 0)
    end,

    keybinds = {
        anims = {},
        drag = draggable:new("keybinds", Vector2.new(150, 20)),
        size = 100,
        alpha = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(1) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local bind_list = Cheat.GetBinds()
            local render_list = {}
            local opened = Cheat.IsMenuVisible()
            local render_offset = 0
            local raw_size = 100

            for _, bind in pairs(bind_list) do
                local bind_name = bind:GetName()
                if not self.anims[bind_name] then
                    self.anims[bind_name] = 0
                end

                self.anims[bind_name] = helpers:lerp(self.anims[bind_name], bind:IsActive() and 1 or 0)

                if bind:IsActive() then
                    opened = true
                end

                if self.anims[bind_name] > 0.01 then
                    local r_bind = {}

                    r_bind.name = bind_name:lower():gsub("^%l", string.upper)
                    r_bind.value = string.format("[%s]", bind:GetValue())
                    r_bind.alpha = self.anims[bind_name]
                    r_bind.offset = render_offset

                    if r_bind.value == "[on]" or r_bind.value == "[off]" then
                        r_bind.value = bind:GetMode() == 0 and "[toggled]" or "[hold]"
                    end

                    local name_size = Render.CalcTextSize(r_bind.name, 11, fonts.verdana).x + Render.CalcTextSize(r_bind.value, 11, fonts.verdana).x + 15

                    render_offset = render_offset + r_bind.alpha * 16
                    raw_size = math.max(raw_size, name_size)

                    table.insert(render_list, r_bind)
                end
            end

            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)
            self.size = helpers:lerp(self.size, raw_size)

            if self.alpha < 0.01 then
                return
            end
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
            helpers:text_shadow("keybinds", pos + Vector2.new(self.size, 20) / 2, Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)

            for _, r in pairs(render_list) do
                helpers:text_shadow(r.name, pos + Vector2.new(5, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
                helpers:text_shadow(r.value, pos + Vector2.new(self.size - 5 - Render.CalcTextSize(r.value, 11, fonts.verdana).x, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
            end
        end
    },
   
    spectators = {
        data = {},
        drag = draggable:new("spectators", Vector2.new(120, 20)),
        size = 100,
        alpha = 0,
        getsteamid64 = function(self, steamid)
            return string.sub(tostring(ffi.new("uint64_t", 76561197960265728) + ffi.new("uint64_t", steamid)), 1, -4)
        end,
        get_list = function(self)
            if not EntityList.GetLocalPlayer() then
                return {}, Cheat.IsMenuVisible()
            end

            local observe_target = EntityList.GetLocalPlayer()

            if EntityList.GetLocalPlayer():GetProp("m_iObserverMode") ~= 0 then
                local ent = EntityList.GetClientEntityFromHandle(EntityList.GetLocalPlayer():GetProp("m_hObserverTarget"))

                if ent and ent:IsPlayer() then
                    observe_target = ent:GetPlayer()
                end
            end

            if not observe_target then
                return {}, Cheat.IsMenuVisible()
            end

            local players = EntityList.GetPlayers()
            local rtn_list = {}
            local opened = Cheat.IsMenuVisible()

            for _, pl in pairs(players) do  
                if pl ~= EntityList.GetLocalPlayer() then
                    local name = pl:GetName()
                    local info = pl:GetPlayerInfo()
                    local steamid = self:getsteamid64(info.iSteamID)

                    if not self.data[steamid] then
                        if not info.fakeplayer then
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                            }

                            local player_data = self.data[steamid]

                            player_data.callback1 = function(content)
                                local parsed = json.parse(content).response
                                if not parsed then
                                    return
                                end
                                parsed = parsed.players[0]
                                if not parsed then
                                    return
                                end
                                Http.GetAsync(parsed.avatar, player_data.callback2)
                            end

                            player_data.callback2 = function(content)
                                player_data.avatar = Render.LoadImage(content, Vector2.new(32, 32))
                            end

                            Http.GetAsync("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=E8A1E59F9C119FA9BFB73F29C2A8A109&steamids=" .. steamid, player_data.callback1)
                        else
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                                avatar = globals.default_avatar,
                            }
                        end
                    end

                    local data = self.data[steamid]
                    local observer = EntityList.GetClientEntityFromHandle(pl:GetProp("m_hObserverTarget"))
                    local is_observer = (observer and observer:IsPlayer() and observer:GetPlayer() == observe_target)
               
                    if is_observer then
                        opened = true
                    end

                    data.alpha = helpers:lerp(data.alpha, is_observer and 1 or 0)

                    if data.alpha > 0.01 then
                        table.insert(rtn_list, data)
                    end
                end
            end

            return rtn_list, opened
        end,
        draw = function(self)
            if not ui.visuals.widgets:Get(2) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local render_offset = 0
            local raw_size = 100

            local list, opened = self:get_list()

            for _, data in pairs(list) do
                local reneder_pos = pos + Vector2.new(5, 23 + render_offset)

                if not data.avatar then return end
                Render.Image(data.avatar, reneder_pos, Vector2.new(16, 16), Color.new(1, 1, 1, data.alpha))
                helpers:text_shadow(data.name, reneder_pos + Vector2.new(21, 2), Color.new(1, 1, 1, data.alpha), 11, fonts.verdana)

                local size = 30 + Render.CalcTextSize(data.name, 11, fonts.verdana).x

                if size > raw_size then
                    raw_size = size
                end

                render_offset = render_offset + 18 * data.alpha
            end

            self.size = helpers:lerp(self.size, raw_size)
            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)

            if self.alpha > 0.01 then
                widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
                helpers:text_shadow("spectators", pos + Vector2.new(self.size / 2, 10), Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)
            end
        end,
    },

    watermark = {
        size = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(3) then
                return
            end

            local full_text = ""

            if ui.visuals.watermark_info:Get(1) then
                full_text = full_text .. " | " .. ui.visuals.custom_username:Get()
            end

            if ui.visuals.watermark_info:Get(2) then
                full_text = full_text .. " | " .. tostring(math.floor(helpers:get_fps())) .. " fps"
            end

            if ui.visuals.watermark_info:Get(3) then
                local net_channel = EngineClient.GetNetChannelInfo()
                local ping = 0

                if net_channel then
                    ping = net_channel:GetAvgLatency(0)
                end

                full_text = full_text .. " | delay: " .. tostring(math.floor(ping * 1000)) .. "ms"
            end

            if ui.visuals.watermark_info:Get(4) then
                full_text = full_text .. " | " .. tostring(math.floor(1 / GlobalVars.interval_per_tick + 0.5)) .. "tick"
            end

            if ui.visuals.watermark_info:Get(5) then
                full_text = full_text .. " | " .. helpers:get_time()
            end

            local size = Render.CalcTextSize("psycho" .. full_text, 11, fonts.verdana).x + 54
            self.size = helpers:lerp(self.size, size)

            local pos = Vector2.new(globals.screen_size.x - 10 - self.size, 10)
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), 1)
            pos = pos + Vector2.new(6, 3)

            helpers:text_shadow("psy", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("psy", 11, fonts.verdana).x
            helpers:text_shadow("cho", pos, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("cho", 11, fonts.verdana).x
            helpers:text_shadow(" [stable]", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize(" [stable]", 11, fonts.verdana).x
            helpers:text_shadow(full_text, pos, Color.new(1, 1, 1), 11, fonts.verdana)

        end
    },

    lua_panel = {
        drag = draggable:new("lua_panel", Vector2.new(170, 45), Vector2.new(100, globals.screen_size.y / 2 - 23)),
        draw = function(self)
            if not ui.visuals.widgets:Get(4) then
                return
            end

            self.drag:update()

            local pos = self.drag:get()

            widgets:create_window(pos, pos + Vector2.new(170, 45), 1)

            local cursor = pos + Vector2.new(5, 4)

            helpers:text_shadow("» psycho anti-aim", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» psycho anti-aim ", 11, fonts.verdana).x
            helpers:text_shadow("technology", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» user:", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» user: ", 11, fonts.verdana).x
            helpers:text_shadow(globals.username, cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» build: ", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» build: ", 11, fonts.verdana).x
            helpers:text_shadow("stable", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)

            if ui.visuals.statepanel_image:Get() == 1 then
                Render.Image(globals.avatar, pos + Vector2.new(145, 20), Vector2.new(20, 20))
            elseif ui.visuals.statepanel_image:Get() == 2 then
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
            else
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
                Render.Image(globals.avatar, pos + Vector2.new(105, 19), Vector2.new(22, 22))
            end

        end
    },

    gamesense = {

        draw = function(self)

            local local_player = EntityList.GetLocalPlayer()
            if not local_player then return end

            if not local_player:IsAlive() then return end
            local cur_dmg = ui.refs.minimum_damage:GetInt()
            if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
            local isDmg = false
            local isPing = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
                if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                    isPing = true
                end
            end
            local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
            local crouch = local_player:GetProp('m_flDuckAmount')
            local isDmg = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                local bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
            end

            if ui.visuals.gamesense:Get() then
                local current_pos = 1
               
                if ui.visuals.gamesense_choose:Get(1) and isDmg then
                    indicators.Render_Indicator('DMG: '..tostring(cur_dmg), Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
       
                if ui.visuals.gamesense_choose:Get(2) and ui.ragebot.dormant_aimbot:GetBool() then
                    local colors = Color.RGBA(132,196,20,255)
                    for k, v in pairs(rage.player_info_prev) do
                        if k ~= nil then
                            if v[3] == true then
                                colors = Color.RGBA(252,222,30,255)
                                break
                            end
                        end
                    end
                    indicators.Render_Indicator('DA', colors, current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(3) and isPing then
                    local net_channel = EngineClient.GetNetChannelInfo()
                    local outgoing, incoming = net_channel:GetLatency(0), net_channel:GetLatency(1)
                    local ping = math.max(0, (incoming-outgoing)*1000)
                    indicators.Render_Indicator('PING', Color.RGBA(math.floor(255 - ((ping / 189 * 60) * 1.90)), math.floor((ping / 189 * 60) * 3.05), math.floor((ping / 189 * 60) * 0.32), 255), current_pos); current_pos = current_pos - 1;
                end
                local c4 = EntityList.GetEntitiesByClassID(129)[1];
                if ui.visuals.gamesense_choose:Get(4) and c4 ~= nil then
                    local time = c4:GetProp('m_flC4Blow') - GlobalVars.curtime
                    local timer = string.format('%.1f', time)
                    local defused = c4:GetProp('m_bBombDefused')
                    if math.floor(timer) > 0 and not defused then
                        local defusestart = c4:GetProp('m_hBombDefuser') ~= 4294967295
                        local defuselength = c4:GetProp('m_flDefuseLength')
                        local defusetimer = defusestart and (c4:GetProp('m_flDefuseCountDown') - GlobalVars.curtime) / 1 or -1
                        if defusetimer > 0 then
                            local color = math.floor(timer) > defusetimer and Color.RGBA(75, 230, 64, 80) or Color.RGBA(255, 0, 0, 80)
                       
                            local barlength = ((globals.screen_size.y - 50) / defuselength) * (defusetimer)
                            Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                            Render.Box(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                           
                            Render.BoxFilled(Vector2.new(0, globals.screen_size.y - barlength), Vector2.new(19, globals.screen_size.y), color)
                        end
                       
                        local bombsite = c4:GetProp('m_nBombSite') == 0 and 'A' or 'B'
                        local health = EntityList.GetLocalPlayer():GetProp('m_iHealth')
                        local armor = EntityList.GetLocalPlayer():GetProp('m_ArmorValue')
                        local willKill = false
                        local eLoc = c4:GetRenderOrigin()
                        local lLoc = EntityList.GetLocalPlayer():GetRenderOrigin()
                        local distance = eLoc:DistTo(lLoc)
                        local a = 450.7
                        local b = 75.68
                        local c = 789.2
                        local d = (distance - b) / c;
       
                        local damage = a * math.exp(-d * d)
                        if armor > 0 then
                            newDmg = damage * 0.5;
           
                            armorDmg = (damage - newDmg) * 0.5
                            if armorDmg > armor then
                                armor = armor * (1 / .5)
                                newDmg = damage - armorDmg
                            end
                            damage = newDmg;
                        end
                        local dmg = math.ceil(damage)
                        if dmg >= health then
                            willKill = true
                        else
                            willKill = false
                        end
                        indicators.Render_Indicator(bombsite..' - '..string.format('%.1f', timer)..'s', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                        if EntityList.GetLocalPlayer() then
                            if willKill == true then
                                indicators.Render_Indicator('FATAL', Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                            elseif damage > 0.5 then
                                indicators.Render_Indicator('-'..dmg..' HP', Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                            end
                        end
                    end
                end
                if ui.visuals.gamesense_choose:Get(4) and planting then
                    indicators.Render_Indicator(planting_site, Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                    local fill = 3.125 - (3.125 + on_plant_time - GlobalVars.curtime)
                    if fill > 3.125 then
                        fill = 3.125
                    end
                    local ts = Render.CalcTextSize(planting_site, 24, fonts.calibrib24)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(0, 0, 0, 200), 5)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(213, 213, 214, 255), 3, -1, (fill/3.3)*375)
                end

                if ui.visuals.gamesense_choose:Get(5) and bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), bit.lshift(1,0)) == 0 then
                    indicators.Render_Indicator('LC', EntityList.GetLocalPlayer():GetVelocity() > 260 and Color.RGBA(132, 196, 20, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(6) and ui.refs.fakeduck:Get() then
                    indicators.Render_Indicator('DUCK', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if  ui.visuals.gamesense_choose:Get(7) and ui.refs.doubletap:Get() then
                    indicators.Render_Indicator('DT', Exploits.GetCharge() == 1 and Color.RGBA(213, 213, 214, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(8) and ui.refs.hideshots:Get() then
                    indicators.Render_Indicator('ONSHOT', Color.RGBA(132, 196, 20, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(9) and ui.refs.yaw_base:Get() == 5 then
                    indicators.Render_Indicator('FS', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
       
                if ui.visuals.gamesense_choose:Get(10) and ui.refs.bodyaim:Get() == 2 then
                    indicators.Render_Indicator('BODY', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(11) and ui.refs.safepoints:Get() == 2 then
                    indicators.Render_Indicator('SAFE', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
            end
        end
    },

    indicators = {
        x_add = 0,
        -----------------------
        draw = function(self)
            if not ui.visuals.widgets:Get(5) then return end
                local local_player = EntityList.GetLocalPlayer()
                if not local_player then return end

                if not local_player:IsAlive() then return end
                local cur_dmg = ui.refs.minimum_damage:GetInt()
                if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
                local isDmg = false
                local isPing = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                    if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                        isPing = true
                    end
                end
                local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
                local crouch = local_player:GetProp('m_flDuckAmount')
                local isDmg = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    local bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                end
                local scope = local_player:GetProp('m_bIsScoped')
                self.x_add = helpers:lerp(self.x_add, scope and 35 or 0, GlobalVars.frametime * 8)

                local alpha = 0
                local y = 0

                if scope then
                    alpha = 0.5
                else
                    alpha = 1
                end
                if globals.indicator_avatar == nil then return end
                if globals.logo_avatar2 == nil then return end
                if fonts.pixel == nil then return end
                if fonts.arrow_fonts == nil then return end
                if fonts.arrow_font2 == nil then return end

                if ui.visuals.indicator_type:Get() == 1 then
                   
                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 2), Vector2.new(100, 75), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, breath(2, ui.visuals.ghosty_color:GetColor().a * 100 / 235)))
                    end

                    Render.Image(globals.logo_avatar2, Vector2.new(globals.screen_size.x/2 - 20 +self.x_add, globals.screen_size.y/2 + 17), Vector2.new(40, 40), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, alpha))
                end
                --if ui.visuals.indicator_type:Get() == 1 then
                --Render.Image(globals.logo_avatar, Vector2.new(globals.screen_size.x/2 - 21 +self.x_add, globals.screen_size.y/2 + 20), Vector2.new(35, 35), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, alpha))
                --end

                if ui.visuals.indicator_type:Get() == 0 then

                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 8), Vector2.new(100, 75), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, breath(2, ui.visuals.ind_name_color:GetColor().a * 100 / 235)))
                    end

                    Render.Text('psycho', Vector2.new(globals.screen_size.x/2-17+self.x_add, globals.screen_size.y/2+16), Color.new(0, 0, 0, 0.5), 11, fonts.verdanabd11)
                    Render.Text('psy', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+15), AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
                    Render.Text('cho', Vector2.new(globals.screen_size.x/2-1+self.x_add, globals.screen_size.y/2+15), not AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
               
                    if ground then
                        state = 'AIR'
                    elseif crouch >= 1 then
                        state = 'CROUCHING'
                    elseif ui.refs.slowwalk:Get() then
                        state = 'SLOWWALKING'
                    elseif local_player:GetVelocity() > 5 then
                        state = 'MOVING'
                    else
                        state = 'STANDING'
                    end
                    local text_sizes = Render.CalcTextSize(state, 9, fonts.pixel)
                    Render.Text(state, Vector2.new(globals.screen_size.x/2+1-text_sizes.x/2+self.x_add, globals.screen_size.y/2+28), Color.new(ui.visuals.ind_state_color:GetColor().r, ui.visuals.ind_state_color:GetColor().g, ui.visuals.ind_state_color:GetColor().b, 1), 9, fonts.pixel, true)

                    Render.Text('OS', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+37), ui.refs.hideshots:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('DT', Vector2.new(globals.screen_size.x/2-4+self.x_add, globals.screen_size.y/2+37), ui.refs.doubletap:Get() and (Exploits.GetCharge() >= 0.9 and Color.new(0, 1, 0, 1) or Color.new(1, 0, 0, 1)) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('AP', Vector2.new(globals.screen_size.x/2+9+self.x_add, globals.screen_size.y/2+37), ui.refs.autopeek:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                        if isDmg then
                            local text_size = Render.CalcTextSize(('DMG: %s'):format(ui.refs.minimum_damage:Get()), 9, fonts.pixel)
                            Render.Text(('DMG: %s'):format(ui.refs.minimum_damage:Get()), Vector2.new(globals.screen_size.x/2-text_size.x/2+1+self.x_add, globals.screen_size.y/2+46), Color.new(1, 1, 1, 1), 9, fonts.pixel, true)
                        end
                    end
                scope = EntityList.GetLocalPlayer():GetProp("m_bIsScoped")
                alpha = 0.7
       
                if ui.visuals.scope_conditions:Get(4) and scope then
                    alpha = 0
                else
                    if ui.visuals.arrows:GetInt() == 1 then
                        Render.Text('<', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                        Render.Text('>', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                    end

                    if ui.visuals.arrows:GetInt() == 2 then
                        Render.Text('X', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('Z', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end

                    if ui.visuals.arrows:GetInt() == 3 then
                        Render.Text('w', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('x', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end
                end
            end
        }
}
-- @endregion

-- @region: visuals
local visuals = {}
local scope_anim = 0
visuals.scope = function()
    -- vars
    x,y,w,o = globals.screen_size.x / 2, globals.screen_size.y / 2, ui.visuals.scope_width:GetInt(), ui.visuals.scope_offset:GetInt()
    -- проверки
    local fov_cs_debug = CVar.FindVar("fov_cs_debug")

    if not EngineClient.IsConnected() then return end
    if not EntityList.GetLocalPlayer() then return end
    if not EntityList.GetLocalPlayer():GetProp("m_bIsScoped") then return end
    if ui.visuals.custom_scope:GetBool() then
        ui.refs.scope:SetInt(2)
       
        if scope_anim > 0 then scope_anim = scope_anim - 5
            else scope_anim = 0
        end
        if ui.visuals.scope_conditions:Get(2) then scope_anim = 255 else if scope_anim < 255 then scope_anim = scope_anim + 5 else scope_anim = 255 end end
        if ui.visuals.custom_scope and ui.visuals.scope_conditions:Get(3) and fov_cs_debug:GetInt()~=90 then fov_cs_debug:SetInt(90) end

        if ui.visuals.scope_conditions:Get(1) then
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
        else
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
        end

        Render.GradientBoxFilled(Vector2.new(x - w - o, y), Vector2.new(x - o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x + w + o, y), Vector2.new(x + o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x, y - o - w), Vector2.new(x + 1, y - o), color1, color1, color2, color2)
        Render.GradientBoxFilled(Vector2.new(x, y + o + w), Vector2.new(x + 1, y + o), color1, color1, color2, color2)
    else
        ui.refs.scope:SetInt(1)
    end
end

visuals.circle_desync = function()  
   
    local local_player = EntityList.GetLocalPlayer()
    if not local_player then return end

     if not local_player:IsAlive() then return end
    if ui.visuals.desync_circle_conditions:Get(2) and ui.visuals.desync_circle:GetBool() then
        CVar.FindVar('crosshair'):SetInt(0)
    else
        CVar.FindVar('crosshair'):SetInt(1)
    end

    if ui.visuals.desync_circle:Get() then

        local color = Color.new(ui.visuals.desync_circle:GetColor().r, ui.visuals.desync_circle:GetColor().g, ui.visuals.desync_circle:GetColor().b, 1)
        local view_angles = EngineClient.GetViewAngles()
        local real_yaw = AntiAim.GetCurrentRealRotation()
        local view_yaw = view_angles.yaw - 180;
        local fake = adjust_angle(real_yaw - view_yaw);
        local delta = math.abs(normalize_yaw(AntiAim.GetCurrentRealRotation() % 360 - AntiAim.GetFakeRotation() % 360)) / 2
        local fake_color = Color.RGBA(math.floor(255 - (delta * 2.29824561404)), math.floor(delta * 3.42105263158), math.floor(delta * 0.22807017543), 255)

        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, Color.new(0, 0, 0, 1), 4, 0, 360)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, 90, ui.refs.invert_side == false and -90 or 270)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 15, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, fake+30, fake-30)
    end
end

visuals.hitmarker = function()
    if not EngineClient.IsConnected() then return end
    if not ui.visuals.hitmarker:Get() then return end

    misc.removeimpact()
    local color = ui.visuals.hitmarker:GetColor()
    local r = color.r local g = color.g local b = color.b local l = ui.visuals.hitmarker_length:Get()

    for i = 1, #t do

        local screen_pos = Render.WorldToScreen(Vector.new(t[i].x, t[i].y, t[i].z))
        local sx,sy = screen_pos.x, screen_pos.y

        Render.BoxFilled(Vector2.new(sx, sy - l), Vector2.new(sx, sy + l), Color.new(r, g, b, (t[i].a / 255)), 1.0)
        Render.BoxFilled(Vector2.new(sx - l, sy), Vector2.new(sx + l, sy), Color.new(r, g, b, (t[i].a / 255)), 1.0)
    end
end

visuals.thirdperson = function()
    if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
        Menu.FindVar("Visuals", "View", "Thirdperson", "Distance"):Set(ui.misc.thirdperson_distance:Get())
    end
        if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
            Cheat.SetThirdPersonAnim(not ui.misc.thirdperson_anim:Get())
        else
            Cheat.SetThirdPersonAnim(true)
        end
end
visuals._verification = function(shot)
    local text = ''

    local hg_diff = hgroup ~= aimed_hgroup
    local dmg_diff = shot.damage ~= shot.wanted_damage

    if hg_diff or dmg_diff then
        text = string.format(
            ' | mismatch: [ %s ]', (function()
                local addr = ''

                if dmg_diff then addr = 'dmg: ' .. shot.wanted_damage .. (hg_diff and ' | ' or '') end
                if hg_diff then addr = addr .. (hg_diff and 'hitgroup: ' .. aimed_hgroup or '') end

                return addr
            end)()
        )
    end

    return text
end

local size_changed = false

local text = ''

visuals.glowmenu = function()
    if not ui.misc.menu_customize:Get() then return end
    local menu_pos = Render.GetMenuPos()
    local menu_sz = Render.GetMenuSize()
   
    function force_update()    image_size = Vector2.new(menu_sz.x * 3, menu_sz.y * 3)    end
    if menu_sz.x ~= cache_size.x then force_update() size_changed = true end
    if size_changed == true and cache_size.x == menu_sz.x then force_update() end
    if not Cheat.IsMenuVisible() then return end
   
    if ui.misc.menu_dim:Get() then
        Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(0, 0, 0, ui.misc.dim_slider:GetFloat()))
    end

    if ui.misc.menu_blur:Get() then

        Render.Blur(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(1, 1, 1, ui.misc.blur_slider:GetFloat()))
    end
   
    if ui.misc.menu_glow:Get() then
        local alpha = 0
        if ui.misc.glow_pulse:Get() then
                alpha = breath(2, ui.misc.color_edit:GetColor().a * 175 / 235)
            else
                alpha = ui.misc.color_edit:GetColor().a
        end

        Render.Image(globals.background, Vector2.new(menu_pos.x - menu_sz.x, menu_pos.y - menu_sz.y), image_size, Color.new(ui.misc.color_edit:GetColor().r, ui.misc.color_edit:GetColor().g, ui.misc.color_edit:GetColor().b, alpha ))
    end
end

visuals.events = function(event)

    local name = event:GetName()
    if name == "player_hurt" then
        local attacker = event:GetInt("attacker")

        if EntityList.GetPlayerForUserID(attacker) == globals.local_player then
       
            if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(1) then
                local player = EntityList.GetPlayerForUserID(event:GetInt("userid"))

                if not player then
                    return
                end

                local hitgroup_names = {
                    [0] = "generic",
                    [1] = "head",
                    [2] = "chest",
                    [3] = "stomach",
                    [4] = "left arm",
                    [5] = "right arm",
                    [6] = "left leg",
                    [7] = "right leg",
                    [10] = "gear"
                }

                logs:add(string.format("Hit %s in the %s for %d damage (%d health remaining)", player:GetName(), hitgroup_names[event:GetInt("hitgroup")] or "?", event:GetInt("dmg_health"), event:GetInt("health")))
            end
        end
    end

    if name == "bullet_impact" then
        local fire_plr = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        local localplayer = EntityList.GetLocalPlayer()
            if fire_plr ~= localplayer then
                return
            end
         table.insert(t, {
            x = event:GetInt("x"),
            y = event:GetInt("y"),
            z = event:GetInt("z"),
            a = 255,
            ctime = GlobalVars.curtime,
         })
    end

    if name == 'player_connect_full' then
        t = {}
    end

    if name == "player_hurt" then
        local localplayer = EntityList.GetLocalPlayer()
        local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker"))
        if ui.misc.hitsound:Get() and ui.misc.misc_enable:Get() then
            if attacker == localplayer then
                EngineClient.ExecuteClientCmd(string.format("playvol %s %s", ui.misc.hitsound_direction:Get(), ui.misc.hitsound_volume:Get()))
            end
        end
    end

    if name == 'player_hurt' then
        local weapon = event:GetString('weapon', '');
        if (weapon == 'hegrenade' or weapon == 'inferno' or weapon == 'knife') then
            if event:GetInt('userid') == nil then return end
            if event:GetInt('attacker') == nil then return end
            local attacker_id = EntityList.GetPlayerForUserID(event:GetInt('attacker'))
            if attacker_id == nil or attacker_id ~= EntityList.GetLocalPlayer() then
                return
            end
           
            local hittype = 'Hit'
            if weapon == 'hegrenade' then
                hittype = 'Naded';
            elseif weapon == 'inferno' then
                hittype = 'Burned';
            elseif weapon == 'knife' then
                hittype = 'Knifed';
            end
            local server_damage = event:GetInt('dmg_health')
            local target_id = EntityList.GetPlayerForUserID(event:GetInt('userid'))
            if target_id == nil then return end
            local target_name = string.lower(target_id:GetName())
            local health = target_id:GetProp('m_iHealth')-server_damage
            if health < 0 then health = 0 end
            text = string.format('%s %s for %i damage (%i remaining)', hittype, target_name, server_damage, health)
            if ui.visuals.log_type:Get(3) then
                ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
                ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), text..'\n')

                table.insert(hitlogs, {text = text, time = GlobalVars.realtime})

            end
        end
    end

end
local hitgroup_names1 = { 'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }

visuals.ragebot_shot = function(shot)
    miss_hitbox = missgroup_names[shot.hitgroup] or '?'
end

visuals.registered_shot = function(shot)

    hit_id = hit_id + 1
    shot_id = num_format((hit_id % 15) + 1)
    local safety = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'):Get()
    local name = string.lower(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetName())
    if name == nil then return end
    local hgroup = hitgroup_names1[shot.hitgroup + 1] or '?'
    local hit_chance = tostring(math.floor(shot.hitchance + 0.5))
    local backtrack = shot.backtrack
    local m_iHealth = EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_iHealth')
    if m_iHealth == nil then return end
    local health = m_iHealth - shot.damage
    if health < 0 then health = 0 end
    local aimed_hgroup = hitgroup_names1[shot.wanted_hitgroup + 1] or '?'
   
    local feet_yaw = math.min(58, math.max(yaw_normalize(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter')[12] * 120 - 60), -58))
    if EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter') == nil then return end
    if feet_yaw == nil then return end
    local ping = EngineClient.GetNetChannelInfo():GetLatency(0)*1000
    local avg_ping = EngineClient.GetNetChannelInfo():GetAvgLatency(0)*1000
    --if shot.reason == nil or hit_id == nil or aimed_hgroup == nil or shot_id == nil or feet_yaw == nil or safety == nil or name == nil or hit_chance == nil or ping == nil or avg_ping == nil then return end
    local netChannelInfo = ffi.cast('void***', getNetChannelInfo(I_EngineClientPtr)) or error('netchaninfo is nil')
    local netChannel = GetNetChannel(netChannelInfo)
    local net_state = string.format(
        'delay: %d:%.2f | dropped: %.0f',
        avg_ping, math.abs(avg_ping-ping), (netChannel.AvgLoss*100)
    )
   
    local uflags = {
        math.abs(avg_ping-ping) < 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction'):GetInt() == 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction_force_server_tick') == 999 and 0 or 1
    }

    local pflags = {
        ClientState.m_choked_commands > 1 and 1 or 0,
        EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier') < 1.00 and 1 or 0,
        (EntityList.GetLocalPlayer():GetRenderOrigin().z <= EntityList.GetClientEntity(shot.target_index):GetPlayer():GetRenderOrigin().z) and 1 or 0
    }

    local correction = Menu.FindVar('Aimbot', 'Ragebot', 'Main', 'Override Resolver'):GetBool()
   
    if shot.reason == 0 then
        text = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s%% | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
        textc = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance .. '%%', safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
    elseif shot.reason == 1 then
        shot_reason = (shot.reason == 1 and total_hits ~= EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')) and 'damage rejection' or string.format('unknown [angle: %.2f° | %d:%d°]', shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw)
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to %s ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot_reason, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 2 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to spread [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 3 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to occlusion [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 4 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to prediction error [%s] [vel_modifier: %.1f | history(Δ): %d | error: %s]',
        shot_id, name, miss_hitbox, hit_chance, net_state, EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier'), backtrack, table.concat(uflags))
    end
    if ui.visuals.log_type:Get(3) then

        if shot.reason == 0 then
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), textc..'\n')
        else
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 200), text1..'\n')
        end

        table.insert(hitlogs, {text = text, time = GlobalVars.realtime})
    end

end

-- @endregion

-- @region: world
local world = {}
world.sun_set = function()
    if not ui.world.world_enable:GetBool() then return end
    local CCascadeLights = EntityList.GetEntitiesByName('CCascadeLight')
    if not CCascadeLights == nil then return end
    for i=1, #CCascadeLights do
        local CCascadeLight = CCascadeLights[i]
        if ui.world.sunset:GetBool() then
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
            end
            if CCascadeLight:GetProp('m_flMaxShadowDist') ~= ui.world.shadow_dist:Get() then
                CCascadeLight:SetProp('m_flMaxShadowDist', ui.world.shadow_dist:Get())
            end
        else
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(0, 0, 0) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(0, 0, 0))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(0, 0, 0))
            end
        end
    end
end

local materials = {
    "particle/fire_burning_character/fire_env_fire_depthblend_oriented", "particle/fire_burning_character/fire_burning_character", "particle/fire_explosion_1/fire_explosion_1_oriented", "particle/fire_explosion_1/fire_explosion_1_bright", "particle/fire_burning_character/fire_burning_character_depthblend", "particle/fire_burning_character/fire_env_fire_depthblend",
}

world.molotov = function()
    for _, v in pairs(materials) do
        local material = MatSystem.FindMaterial(v, "")

        if material ~= nil then
            material:SetMaterialVarFlag(bit.lshift(1, 28), ui.world.molly_conditions:Get(1) and ui.world.world_enable:GetBool())
            material:SetMaterialVarFlag(bit.lshift(1, 15), ui.world.molly_conditions:Get(2) and ui.world.world_enable:GetBool())
        end
    end

end

-- effects
world.effects = function()
    if not ui.world.enable_bloom:Get() and ui.world.world_enable:Get() then return end
    if not EntityList.GetLocalPlayer() then
        return
    end

        local ambient = CVar.FindVar('r_modelAmbientMin')

        local CETC = EntityList.GetEntitiesByName('CEnvTonemapController')

        for idx, entity in pairs(CETC) do
            entity:SetProp('m_bUseCustomAutoExposureMin', true)
            entity:SetProp('m_bUseCustomAutoExposureMax', true)
            entity:SetProp('m_bUseCustomBloomScale', true)
            entity:SetProp('m_flCustomAutoExposureMin', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomAutoExposureMax', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomBloomScale', ui.world.bloom:GetFloat() / 10);
        end

        ambient:SetFloat(ui.world.model_ambient:GetFloat() / 10)

end

world.custom_skybox = function()
    if ui.world.custom_skybox:GetBool() and ui.world.world_enable:GetBool() then
        skybox_color = ui.world.custom_skybox:GetColor()
        skyboxname = ui.world.skybox_choose:GetString()
        cvar = CVar.FindVar("sv_skyname")
        ui.refs.skybox:SetInt(0)
        ui.refs.skybox:SetColor(skybox_color)
        cvar:SetString(skyboxname)
    else
        return  
    end
end
-- @endregion

logs = {
    logs = {},
    draw = function(self)
        local draw_offset = 50

        for _, log in pairs(self.logs) do
            local expired = log.expire_time < GlobalVars.realtime

            if expired then
                log.alpha = helpers:lerp(log.alpha, 0)
                log.pos = helpers:lerp(log.pos, 0)
            else
                log.alpha = helpers:lerp(log.alpha, 1)
                log.pos = helpers:lerp(log.pos, draw_offset)
                draw_offset = draw_offset + 30
            end

            if log.alpha < 0.01 and expired then
                table.remove(self.logs, _)
            else
                local size = Render.CalcTextSize(log.text, 11, fonts.verdana).x
                local pos = Vector2.new((globals.screen_size.x - size) * 0.5 - 5, globals.screen_size.y - log.pos)
                widgets:create_window(pos, pos + Vector2.new(size + 10, 20), log.alpha)
                Render.Text(log.text, pos + Vector2.new(5, 4), Color.new(1, 1, 1, log.alpha), 11, fonts.verdana)
            end
        end
    end,
    add = function(self, text)
        local log = {
            text = text,
            expire_time = GlobalVars.realtime + 5,
            pos = 0,
            alpha = 0,
        }

        table.insert(self.logs, log)
    end
}

-- @region: config system
ffi_functions.VGUI_System = ffi.cast(ffi.typeof('void***'), Utils.CreateInterface('vgui2.dll', 'VGUI_System010'))
ffi_functions.get_clipboard_text_length = ffi.cast('get_clipboard_text_length', ffi_functions.VGUI_System[0][7])
ffi_functions.get_clipboard_text = ffi.cast('get_clipboard_text', ffi_functions.VGUI_System[0][11])
ffi_functions.set_clipboard_text = ffi.cast('set_clipboard_text', ffi_functions.VGUI_System[0][9])

cfg_system.set_clipboard = function(text)
    ffi_functions.set_clipboard_text(ffi_functions.VGUI_System, text, #text)
end

cfg_system.get_clipboard = function()
    local clipboard_text_length = ffi_functions.get_clipboard_text_length(ffi_functions.VGUI_System)

    if (clipboard_text_length > 0) then
        local buffer = ffi.new('char[?]', clipboard_text_length)

        ffi_functions.get_clipboard_text(ffi_functions.VGUI_System, 0, buffer, clipboard_text_length * ffi.sizeof('char[?]', clipboard_text_length))
        return ffi.string(buffer, clipboard_text_length - 1)
    end

    return ''
end

cfg_system.cfg_data = {
    bools = {
        ui.anti_aims.custom[1].enable, ui.anti_aims.custom[2].enable, ui.anti_aims.custom[3].enable, ui.anti_aims.custom[4].enable, ui.anti_aims.custom[5].enable, ui.anti_aims.custom[6].enable,
        ui.anti_aims.custom[1].freestanding_bodyyaw, ui.anti_aims.custom[2].freestanding_bodyyaw, ui.anti_aims.custom[3].freestanding_bodyyaw, ui.anti_aims.custom[4].freestanding_bodyyaw, ui.anti_aims.custom[5].freestanding_bodyyaw, ui.anti_aims.custom[6].freestanding_bodyyaw,
        ui.anti_aims.custom[1].step_abs, ui.anti_aims.custom[2].step_abs, ui.anti_aims.custom[3].step_abs, ui.anti_aims.custom[4].step_abs, ui.anti_aims.custom[5].step_abs, ui.anti_aims.custom[6].step_abs,
        ui.misc.misc_enable,
        ui.misc.slowwalk_c,
        ui.misc.hitsound,
        ui.world.custom_skybox,
        ui.world.world_enable,
        ui.world.sunset,
        ui.visuals.visuals_enable,
        ui.visuals.disable_blur,
        ui.visuals.disable_background,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.anti_aims.antiaim_enable,
        ui.misc.menu_glow,
        ui.misc.glow_pulse,
        ui.misc.menu_dim,
        ui.misc.menu_blur,
        ui.misc.menu_customize,
        ui.misc.thirdperson,
        ui.ragebot.maxmissed,
        ui.misc.thirdperson_anim,
        ui.world.enable_bloom,
        ui.misc.clantag,
        ui.ragebot.dormant_aimbot,
        ui.ragebot.doubletap_recharge,
        ui.ragebot.override_doubletap,
        ui.ragebot.Teleport_In_Air,
        ui.visuals.gamesense,
        ui.ragebot.bodyaims,
        ui.misc.color_override,
        ui.misc.autopeek,
        ui.misc.quick_peek

    },
    ints = {
        ui.anti_aims.custom[1].yaw_mode, ui.anti_aims.custom[2].yaw_mode, ui.anti_aims.custom[3].yaw_mode, ui.anti_aims.custom[4].yaw_mode, ui.anti_aims.custom[5].yaw_mode, ui.anti_aims.custom[6].yaw_mode,
        ui.anti_aims.custom[1].static_yaw, ui.anti_aims.custom[2].static_yaw, ui.anti_aims.custom[3].static_yaw, ui.anti_aims.custom[4].static_yaw, ui.anti_aims.custom[5].static_yaw, ui.anti_aims.custom[6].static_yaw,
        ui.anti_aims.custom[1].tick_yaw_left, ui.anti_aims.custom[2].tick_yaw_left, ui.anti_aims.custom[3].tick_yaw_left, ui.anti_aims.custom[4].tick_yaw_left, ui.anti_aims.custom[5].tick_yaw_left, ui.anti_aims.custom[6].tick_yaw_left,
        ui.anti_aims.custom[1].tick_yaw_right, ui.anti_aims.custom[2].tick_yaw_right, ui.anti_aims.custom[3].tick_yaw_right, ui.anti_aims.custom[4].tick_yaw_right, ui.anti_aims.custom[5].tick_yaw_right, ui.anti_aims.custom[6].tick_yaw_right,
        ui.anti_aims.custom[1].choke_yaw_left, ui.anti_aims.custom[2].choke_yaw_left, ui.anti_aims.custom[3].choke_yaw_left, ui.anti_aims.custom[4].choke_yaw_left, ui.anti_aims.custom[5].choke_yaw_left, ui.anti_aims.custom[6].choke_yaw_left,
        ui.anti_aims.custom[1].choke_yaw_right, ui.anti_aims.custom[2].choke_yaw_right, ui.anti_aims.custom[3].choke_yaw_right, ui.anti_aims.custom[4].choke_yaw_right, ui.anti_aims.custom[5].choke_yaw_right, ui.anti_aims.custom[6].choke_yaw_right,
        ui.anti_aims.custom[1].desync_yaw_left, ui.anti_aims.custom[2].desync_yaw_left, ui.anti_aims.custom[3].desync_yaw_left, ui.anti_aims.custom[4].desync_yaw_left, ui.anti_aims.custom[5].desync_yaw_left, ui.anti_aims.custom[6].desync_yaw_left,
        ui.anti_aims.custom[1].desync_yaw_right, ui.anti_aims.custom[2].desync_yaw_right, ui.anti_aims.custom[3].desync_yaw_right, ui.anti_aims.custom[4].desync_yaw_right, ui.anti_aims.custom[5].desync_yaw_right, ui.anti_aims.custom[6].desync_yaw_right,
        ui.anti_aims.custom[1].yaw_jitter, ui.anti_aims.custom[2].yaw_jitter, ui.anti_aims.custom[3].yaw_jitter, ui.anti_aims.custom[4].yaw_jitter, ui.anti_aims.custom[5].yaw_jitter, ui.anti_aims.custom[6].yaw_jitter,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree, ui.anti_aims.custom[3].yaw_jitter_degree, ui.anti_aims.custom[4].yaw_jitter_degree, ui.anti_aims.custom[5].yaw_jitter_degree, ui.anti_aims.custom[6].yaw_jitter_degree,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree2, ui.anti_aims.custom[3].yaw_jitter_degree2, ui.anti_aims.custom[4].yaw_jitter_degree2, ui.anti_aims.custom[5].yaw_jitter_degree2, ui.anti_aims.custom[6].yaw_jitter_degree2,
     
        ui.anti_aims.custom[1].self_bodyyaw_mode, ui.anti_aims.custom[2].self_bodyyaw_mode, ui.anti_aims.custom[3].self_bodyyaw_mode, ui.anti_aims.custom[4].self_bodyyaw_mode, ui.anti_aims.custom[5].self_bodyyaw_mode, ui.anti_aims.custom[6].self_bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_mode, ui.anti_aims.custom[2].bodyyaw_mode, ui.anti_aims.custom[3].bodyyaw_mode, ui.anti_aims.custom[4].bodyyaw_mode, ui.anti_aims.custom[5].bodyyaw_mode, ui.anti_aims.custom[6].bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_degree, ui.anti_aims.custom[2].bodyyaw_degree, ui.anti_aims.custom[3].bodyyaw_degree, ui.anti_aims.custom[4].bodyyaw_degree, ui.anti_aims.custom[5].bodyyaw_degree, ui.anti_aims.custom[6].bodyyaw_degree,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_left, ui.anti_aims.custom[2].jitter_bodyyaw_degree_left, ui.anti_aims.custom[3].jitter_bodyyaw_degree_left, ui.anti_aims.custom[4].jitter_bodyyaw_degree_left, ui.anti_aims.custom[5].jitter_bodyyaw_degree_left, ui.anti_aims.custom[6].jitter_bodyyaw_degree_left,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_right, ui.anti_aims.custom[2].jitter_bodyyaw_degree_right, ui.anti_aims.custom[3].jitter_bodyyaw_degree_right, ui.anti_aims.custom[4].jitter_bodyyaw_degree_right, ui.anti_aims.custom[5].jitter_bodyyaw_degree_right, ui.anti_aims.custom[6].jitter_bodyyaw_degree_right,
        ui.anti_aims.custom[1].step_bodyyaw_degree_left, ui.anti_aims.custom[2].step_bodyyaw_degree_left, ui.anti_aims.custom[3].step_bodyyaw_degree_left, ui.anti_aims.custom[4].step_bodyyaw_degree_left, ui.anti_aims.custom[5].step_bodyyaw_degree_left, ui.anti_aims.custom[6].step_bodyyaw_degree_left,
        ui.anti_aims.custom[1].step_bodyyaw_degree_right, ui.anti_aims.custom[2].step_bodyyaw_degree_right, ui.anti_aims.custom[3].step_bodyyaw_degree_right, ui.anti_aims.custom[4].step_bodyyaw_degree_right, ui.anti_aims.custom[5].step_bodyyaw_degree_right, ui.anti_aims.custom[6].step_bodyyaw_degree_right,
        ui.anti_aims.custom[1].body_yaw_step_ticks, ui.anti_aims.custom[2].body_yaw_step_ticks, ui.anti_aims.custom[3].body_yaw_step_ticks, ui.anti_aims.custom[4].body_yaw_step_ticks, ui.anti_aims.custom[5].body_yaw_step_ticks, ui.anti_aims.custom[6].body_yaw_step_ticks,
        ui.anti_aims.custom[1].body_yaw_step_value, ui.anti_aims.custom[2].body_yaw_step_value, ui.anti_aims.custom[3].body_yaw_step_value, ui.anti_aims.custom[4].body_yaw_step_value, ui.anti_aims.custom[5].body_yaw_step_value, ui.anti_aims.custom[6].body_yaw_step_value,

        ui.anti_aims.custom[1].fake_yaw_mode, ui.anti_aims.custom[2].fake_yaw_mode, ui.anti_aims.custom[3].fake_yaw_mode, ui.anti_aims.custom[4].fake_yaw_mode, ui.anti_aims.custom[5].fake_yaw_mode, ui.anti_aims.custom[6].fake_yaw_mode,
        ui.anti_aims.custom[1].static_fakeyaw, ui.anti_aims.custom[2].static_fakeyaw, ui.anti_aims.custom[3].static_fakeyaw, ui.anti_aims.custom[4].static_fakeyaw, ui.anti_aims.custom[5].static_fakeyaw, ui.anti_aims.custom[6].static_fakeyaw,
        ui.anti_aims.custom[1].jitter_fakeyaw_left, ui.anti_aims.custom[2].jitter_fakeyaw_left, ui.anti_aims.custom[3].jitter_fakeyaw_left, ui.anti_aims.custom[4].jitter_fakeyaw_left, ui.anti_aims.custom[5].jitter_fakeyaw_left, ui.anti_aims.custom[6].jitter_fakeyaw_left,
        ui.anti_aims.custom[1].jitter_fakeyaw_right, ui.anti_aims.custom[2].jitter_fakeyaw_right, ui.anti_aims.custom[3].jitter_fakeyaw_right, ui.anti_aims.custom[4].jitter_fakeyaw_right, ui.anti_aims.custom[5].jitter_fakeyaw_right, ui.anti_aims.custom[6].jitter_fakeyaw_right,
        ui.anti_aims.custom[1].step_ticks, ui.anti_aims.custom[2].step_ticks, ui.anti_aims.custom[3].step_ticks, ui.anti_aims.custom[4].step_ticks, ui.anti_aims.custom[5].step_ticks, ui.anti_aims.custom[6].step_ticks,
        ui.anti_aims.custom[1].step_value, ui.anti_aims.custom[2].step_value, ui.anti_aims.custom[3].step_value, ui.anti_aims.custom[4].step_value, ui.anti_aims.custom[5].step_value, ui.anti_aims.custom[6].step_value,
        ui.anti_aims.custom[1].step_fake_min, ui.anti_aims.custom[2].step_fake_min, ui.anti_aims.custom[3].step_fake_min, ui.anti_aims.custom[4].step_fake_min, ui.anti_aims.custom[5].step_fake_min, ui.anti_aims.custom[6].step_fake_min,
        ui.anti_aims.custom[1].step_fake_max, ui.anti_aims.custom[2].step_fake_max, ui.anti_aims.custom[3].step_fake_max, ui.anti_aims.custom[4].step_fake_max, ui.anti_aims.custom[5].step_fake_max, ui.anti_aims.custom[6].step_fake_max,
        ui.anti_aims.custom[1].extra_options, ui.anti_aims.custom[2].extra_options, ui.anti_aims.custom[3].extra_options, ui.anti_aims.custom[4].extra_options, ui.anti_aims.custom[5].extra_options, ui.anti_aims.custom[6].extra_options,
        ui.misc.slowwalk_slider,
        ui.world.shadow_dist,
        ui.world.molly_conditions,
        ui.visuals.widgets,
        ui.visuals.watermark_info,
        ui.visuals.statepanel_image,
        ui.visuals.log_type,
        ui.visuals.indicator_type,
        ui.visuals.arrows,
        ui.visuals.arrows_x,
        ui.visuals.scope_width,
        ui.visuals.scope_offset,
        ui.visuals.scope_conditions,
        ui.visuals.desync_circle_conditions,
        ui.visuals.hitmarker_length,
       
        ui.anti_aims.antiaim_helpers,
        ui.ragebot.tp_in_air,
        ui.anti_aims.animbreakers,
        ui.misc.thirdperson_distance,
        ui.ragebot.maxmissed_c,
        ui.ragebot.dormant_aimbot_damage,
        ui.ragebot.doubletap_speed,
        ui.visuals.gamesense_choose,
        ui.ragebot.baimhp,
        ui.ragebot.baimmode,
        ui.ragebot.hitchances,
        ui.ragebot.air_hitchance,
        ui.ragebot.noscope_hitchance,

    },

    floats = {
        ui.misc.hitsound_volume,
        ui.world.shadow_x,
        ui.world.shadow_y,
        ui.world.shadow_z,
        ui.misc.blur_slider,
        ui.misc.dim_slider,
        ui.world.exposure,
        ui.world.bloom,
        ui.world.model_ambient,

    },

    strings = {
        ui.misc.hitsound_direction,
        ui.world.skybox_choose,
        ui.visuals.custom_username
    },

    colors = {
        ui.visuals.ghosty_color,
        ui.visuals.ind_name_color,
        ui.visuals.ind_state_color,
        ui.visuals.ind_color,
        ui.visuals.arrows_color,
        ui.visuals.theme,
        ui.world.custom_skybox,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.misc.color_edit,
        ui.misc.color_override,
        ui.misc.autopeek
    }
}

de_en_coding = 'pl3KmT/U1Djka4d7xA9WHXfNvngIbe56PSRFZGLOwrq2Ms8QEytVYhBJoC0i+czu'

cfg_system.encode = function(data)
    return ((data:gsub('.', function(x)
        local r,de_en_coding= '', x:byte()
        for i=8,1,-1 do r=r..(de_en_coding%2^i-de_en_coding%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 de_en_coding:sub(c+1,c+1)
    end)..({ '', '==', '=' })[#data%3+1])
end

cfg_system.decode = function(data)
    data = string.gsub(data, '[^'..de_en_coding..'=]', '')
    return (data:gsub('.', function(x)
        if (x == '=') then return '' end
        local r,f='',(de_en_coding: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
ui.global.export_cfg:RegisterCallback(function()
    local code = {{}, {}, {}, {}, {}}

    for _, bools in pairs(cfg_system.cfg_data.bools) do
        table.insert(code[1], bools:GetBool())
    end

    for _, ints in pairs(cfg_system.cfg_data.ints) do
        table.insert(code[2], ints:GetInt())
    end

    for _, floats in pairs(cfg_system.cfg_data.floats) do
        table.insert(code[3], floats:GetFloat())
    end

    for _, strings in pairs(cfg_system.cfg_data.strings) do
        table.insert(code[4], strings:GetString())
    end

    for _, colors in pairs(cfg_system.cfg_data.colors) do
        local clr = colors:GetColor()
        table.insert(code[5], string.format('%02X%02X%02X%02X', math.floor(clr.r * 255), math.floor(clr.g * 255), math.floor(clr.b * 255), math.floor(clr.a * 255)))
    end
   
    cfg_system.set_clipboard(cfg_system.encode(json.stringify(code)))
    logs:add('Config exported to clipboard.')
end)

cfg_system.config_load = function(text)
    local decode_cfg = json.parse(cfg_system.decode(text))
    if decode_cfg == nil then
        logs:add('Failed to load config.')
    else
        for k, v in pairs(decode_cfg) do
            k = ({[1] = 'bools', [2] = 'ints', [3] = 'floats', [4] = 'strings', [5] = 'colors'})[k]

            for k2, v2 in pairs(v) do
                if (k == 'bools') then
                    cfg_system.cfg_data[k][k2]:SetBool(v2)
                end

                if (k == 'ints') then
                    cfg_system.cfg_data[k][k2]:SetInt(v2)
                end

                if (k == 'floats') then
                    cfg_system.cfg_data[k][k2]:SetFloat(v2)
                end

                if (k == 'strings') then
                    cfg_system.cfg_data[k][k2]:SetString(v2)
                end

                if (k == 'colors') then
                    cfg_system.cfg_data[k][k2]:SetColor(Color.new(tonumber('0x'..v2:sub(1, 2))/255, tonumber('0x'..v2:sub(3, 4))/255, tonumber('0x'..v2:sub(5, 6))/255, tonumber('0x'..v2:sub(7, 8))/255))
                end
            end
        end
       
        logs:add("Applied imported config.")
    end
end
ui.global.import_cfg:RegisterCallback(function()
    cfg_system.config_load(cfg_system.get_clipboard())
end)

ui.global.default_cfg:RegisterCallback(function()
    cfg_system.config_load("5t1y1Fri1FmRdOAtefHM1F1RdOAtefHM1FaRdLnSIU4Gk31Y1FrYbOXGk31h1FrYbOXGk31B1FrYbOXGk31J1FrYbOXGk31o1FrLvfyVn9ERd910eUDhn9ERaWpRdOAtefHM1Fmy1FrLvfyVn9ERaW1RdLnSIU4Gk31yat10nLTMbBHM1FmY1FrLvfyVn9ERaWHRdLnSIU4Gk31y4R10nLTMbBHM1FmJ1FrLvfyVn9ERaWPRdLnSIU4Gk31yd910eUDhn9ERaFpRdLnSIU4Gk31ta910eUDhn9ERaF1RdOAtefHM1F1V1FrYbOXGk31t4310eUDhn9ERaFHRdOAtefHM1F1B1FrLvfyVn9ERaFbRdLnSIU4Gk31td310eUDhn9ERaFZRdOAtefHM1FaE1FrYbOXGk31Va910eUDhn9ERaV1RdOAtefHM1FaV1FrYbOXGk31V4310eUDhn9ERaVHRdLnSIU4Gk31V4R10eUDhn9ERaVbRdOAtefHM1Fao1FrYbOXGk31Vd910eUDhn9ER4KpRdLnSIU4Gk31Ya910eUDhn9ER4K1RdOAtefHM1FxV1FrLvfyVn9ER4KxRdOAtefHM1Fxh1FrYbOXGk31Y4R10eUDhnNYM1F1RdOMRa910a9ERaR10aRERat10a3ER4310a3ER4910a9ER4R10aRER4t10a3ERd310a3ERd910a3ERaWpRdFpM1Fmy1Fwoa3ERaW1RdFpM1FmV1FwsaRERaWxRdFpM1Fmh1FwEk31y4R10a3ERaWbRdRYtk31yd310a3ERaWZRdF1M1F1E1FwEk31ta910a3ERaF1RdFpM1F1V1Fwtk31t4310a3ERaFHRdFpM1F1B1FwsaRERaFbRdFpM1F1o1FwEk31td910a3ERaVpRdRYtk31Va910a3ERaV1RdF1M1FaV1FwEk31V4310a3ERaVHRdFpM1FaB1Fwtk31V4t10a3ERaVPRdFpM1FaC1FwEk31Ya310a3ER4KmRdFpM1Fxt1FwEk31Yat10a3ER4KxRdFpM1Fxh1FwEk31Y4R10a3ER4KbRdFpM1Fxo1FwEk31Yd910a9ER4WpRdFmM1FHy1Fwyk31haR10a9ER4WaRdFmM1FHY1Fwyk31h49104FvM1FHB1FwJa9ER4WbRdFbJk31hd310aW1M1FHC1FwBa9ER4FpRdFvtk31Ba9104FvM1Fvt1FwJatER4FaRdFPyk31B4310a3ER4FHRdFvhk31B4R104FbM1FvJ1Fwtk31Bd310aRER4FZRdF1M1FbE1FwVk31Ja910aRER4V1RdF1M1FbV1Fwtk31J4310aRER4VHRdFpM1FbB1FwEk31J4t10a9ER4VPRdF1M1FbC1Fwhd3ERdKpRdFHok31oa9104FpM1FPt1FwBa3ERdKaRdFHok31o43104WPM1FPh1FwVa3ERdKvRdFaEk31o4t10aVpM1FPo1FwVa3ERdKZRdFHtk31Ca310aVpM1FZy1FwVa3ERdW1RdFaEk31Cat10aVpM1FZY1FwVa3ERdWHRdFvEk31C4R10aVpM1FZJ1FwYk31Cd31049ERdWZRdFPM1FmEa310d3ERaWpy1Fwok31yaK1RdFxM1FmEat10aRERaWpY1Fwtk31yaKHRdFHM1FmE4R1049ERaWpJ1Fwhk31yaKPRdFmM1FmEd9104WpM1Fmya3104WpM1Fmya9104WPM1FmyaR104WPM1Fmyat104WPM1Fmy43104WpM1Fmy49104FpM1Fmy4R104FpM1Fmy4t104WPM1Fmyd3104WPM1Fmyd9104WPM1Fmta3104FpM1Fmta910a3ERaW1t1FwEk31yaFaRdFpM1Fmt4310a3ERaW1h1FwEk31yaFvRdFpM1Fmt4t104WpM1Fmtd310aWpEa3ERaW1C1FwVk31yaVpRdFvVk31yaVmRdF1Ck31yaV1RdFaM1FmVat1049ERaWaY1Fwyk31yaVHRdF1M1FmV4R10a3ERaWaJ1Fwod9ERaWao1FwtaRERaWaC1Fwy43ERaWxE1Fwtk31y4KmRdFvM1FmYaR10aWmM1FmYat1043ERaWxY1FwJk31y4KHRdFvhk31y4KvRdF1M1FmY4t10a9ERaWxo1Fwy4tERaWxC1FwtaKxJ69ERat105t1y1Fwyk31t1FwBa3ERat104FpM1FxRdFmEa3ER4910a9ER4R10a3oVaKpEaKpEaWmCaFpCaFPC4RER4t10a3ERd310a3ERd910aUYM1FxRdOMRa9101O4EvND2I/H8eBTB1RERaR101G4Evf4GAfCOgfCGkYCGvOXMvX+E431M1FaRdRDEgfCO5LXYn9Dck31h1Fri1FmRdRD3xHmYAZnKd31M1F1RdRD/AZn/AZn/AR1M1FaRdRD/AZn/AZn/AR1M1FxRdRD/AZn/AZn/AR1M1FHRdRD3xFG3AZnKd31M1FvRdRD34KS3AZvEa31M1FbRdRD/AZnTAZX/AR1M1FPRdRD3AWG3AZnKd31M1FZRdRDlaVZyAZn/AR1M1FmE1FwRdWPJAZHoxVPRk31ya9101FPB4ZD/AFxY1Ohc")
end)
-- @endregion

function ui_set_visible(vis, bool)
    vis:SetVisible(bool)
end

local function ui_callbacks()
    --ragebot
    ui.ragebot.maxmissed:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.maxmissed_c:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.maxmissed:GetBool())
    ui.ragebot.dormant_aimbot:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.dormant_aimbot_damage:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.dormant_aimbot:GetBool())
    ui.ragebot.override_doubletap:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.doubletap_speed:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.doubletap_recharge:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.Teleport_In_Air:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.tp_in_air:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.Teleport_In_Air:Get())
    ui.ragebot.bodyaims:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.baimmode:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.baimhp:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.hitchances:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.air_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(1))
    ui.ragebot.noscope_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(2))


    --widgets
    ui.visuals.widgets:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.watermark_info:SetVisible(ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.statepanel_image:SetVisible(ui.visuals.widgets:Get(4) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.custom_username:SetVisible(ui.visuals.watermark_info:Get(1) and ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.theme:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_blur:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_background:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.indicator_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.arrows:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_x:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.ghosty_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 1)
    ui.visuals.ind_name_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_state_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)

    --visuals micellaneous
    ui.visuals.custom_scope:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_width:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_offset:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_conditions:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle_conditions:SetVisible(ui.visuals.desync_circle:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker_length:SetVisible(ui.visuals.hitmarker:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.log_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(6))
    ui.visuals.gamesense:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.gamesense_choose:SetVisible(ui.visuals.gamesense:GetBool() and ui.visuals.visuals_enable:GetBool())
    -- world
    ui.world.sunset:SetVisible(ui.world.world_enable:GetBool())
    ui.world.shadow_x:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_y:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_z:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_dist:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.molly_conditions:SetVisible(ui.world.world_enable:GetBool())
    ui.world.custom_skybox:SetVisible(ui.world.world_enable:GetBool())
    ui.world.skybox_choose:SetVisible(ui.world.world_enable:GetBool() and ui.world.custom_skybox:GetBool())
    ui.world.enable_bloom:SetVisible(ui.world.world_enable:GetBool())
    ui.world.model_ambient:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.bloom:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.exposure:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())

    --antiaim
    ui.anti_aims.antiaim_helpers:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
    ui.anti_aims.animbreakers:SetVisible(ui.anti_aims.antiaim_enable:GetBool() and ui.anti_aims.antiaim_helpers:Get(2))

    --misc
    ui.misc.slowwalk_c:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.slowwalk_slider:SetVisible(ui.misc.slowwalk_c:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_direction:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_volume:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson_distance:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.thirdperson_anim:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.clantag:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.autopeek:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.color_override:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())
    ui.misc.quick_peek:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())

    --main
    ui.misc.menu_glow:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.glow_pulse:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.color_edit:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.menu_dim:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.dim_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_dim:Get())
    ui.misc.menu_blur:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.blur_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_blur:Get())

    --aa buider
   
    local m = ui.anti_aims
    for i = 1,#_state do
        local selects = ui.anti_aims.states_selection:Get()+1
        local cswitch = m.custom[i].enable:Get()
        local show = selects == i and cswitch and ui.anti_aims.antiaim_enable:GetBool()
        ui.anti_aims.states_selection:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].enable:SetVisible(selects == i and ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].extra_options:SetVisible(show)
        ui_set_visible(m.custom[i].yaw_mode,show)
        ---- {"Static","Period jitter \aC08A8AFF[Tick]","Period jitter \aC08A8AFF[Choke]","Period jitter \aC08A8AFF[Desync]"}
        ui_set_visible(m.custom[i].static_yaw,show and m.custom[i].yaw_mode:Get() == 0)
        ui_set_visible(m.custom[i].tick_yaw_left,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].tick_yaw_right,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].choke_yaw_left,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].choke_yaw_right,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].desync_yaw_left,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].desync_yaw_right,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].yaw_jitter,show)
        ui_set_visible(m.custom[i].yaw_jitter_mode,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree2,show and m.custom[i].yaw_jitter:Get() ~= 0 and m.custom[i].yaw_jitter_mode:Get() == 1)

        ui_set_visible(m.custom[i].self_bodyyaw_mode,show)
        ui_set_visible(m.custom[i].bodyyaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)    
        ui_set_visible(m.custom[i].bodyyaw_degree,show and m.custom[i].bodyyaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1 )
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_ticks,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_value,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)

        ui_set_visible(m.custom[i].fake_yaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].static_fakeyaw,show and m.custom[i].fake_yaw_mode:Get() == 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_left,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_right,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_value,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
--
        ui_set_visible(m.custom[i].step_abs,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_fake_min,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_fake_max,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].freestanding_bodyyaw,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
    end

end
local time_to_ticks = function(t) return math.floor(0.5 + (t / GlobalVars.interval_per_tick)) end
local callbacks = {

    on_draw = function()
        if Cheat.IsMenuVisible() then
            ui_callbacks()
        end

        globals.local_player = EntityList.GetLocalPlayer()

        visuals.glowmenu()
       
        misc.clantag()
        autopeek:paint_function()
      if ui.visuals.visuals_enable:Get() then
        widgets.lua_panel:draw()
        widgets.indicators:draw()
        widgets.watermark:draw()
        widgets.keybinds:draw()
        widgets.spectators:draw()
        widgets.gamesense:draw()
        visuals.scope()
        visuals.hitmarker()
        visuals.circle_desync()
        logs:draw()

        local x, y = 5, 5
        if(ui.visuals.log_type:Get(2)) then
            for i, hitlog in ipairs(hitlogs) do
                    Render.Text(hitlog.text, Vector2.new(x+1, y+1), Color.RGBA(0, 0, 0, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)-105), 10, fonts.lucida_console)
                    Render.Text(hitlog.text, Vector2.new(x, y), Color.RGBA(255, 255, 255, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)), 10, fonts.lucida_console)
                y = y + 15
                if #hitlogs > 15 then table.remove(hitlogs,1) end
                if hitlog.time + 10 < GlobalVars.realtime then table.remove(hitlogs, i) end
            end
        end
      end

        world.sun_set()
        world.molotov()
        world.custom_skybox()
        world.effects()
        visuals.thirdperson()
    end,

    on_player_connect_full = function()
        t = {}
    end,

    on_prediction = function(cmd)
        anti_aims.avoid_backstab()
        anti_aims.exploit_teleport()
        anti_aims.disable_aa_warmup()
        rage.ragebot(cmd)
        anti_aims.antiaim_helpers()
        AntiAim.run_custom(cmd)
        anti_aims.edge_yaw()
        misc.slowwalk(cmd)
        rage.on_prediction()
        rage.dormant_aim(cmd)
        autopeek:autopeek_main(cmd)
    end,

    on_createmove = function(cmd)
        rage.baim()
    end,

    on_ragebot_shot = function(shot)
        if EntityList.GetLocalPlayer() == nil then return end
        total_hits = EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')
        if total_hits == nil then return end
        miss_hitbox = missgroup_names[shot.hitgroup] or '?'
        self_choke = ClientState.m_choked_commands
        choke = time_to_ticks(GlobalVars.curtime - EntityList.GetClientEntity(shot.index):GetPlayer():GetProp('m_flSimulationTime')) + 1;
        if choke < 0 then
            choke = 0
        elseif choke > 14 then
            choke = 14
        end
        visuals.ragebot_shot(shot)
        autopeek.ragebot_shot(shot)
    end,

    on_pre_prediction = function(cmd)
        rage.hitchances()
    end,

    registered_shot = function(shot)
        rage.on_registered_shot(shot)
        visuals.registered_shot(shot)

        if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(2) and shot.reason ~= 0 then
            local name = EntityList.GetPlayer(shot.target_index):GetName()
            local hitgroup_names = {
                [0] = "generic",
                [1] = "head",
                [2] = "chest",
                [3] = "stomach",
                [4] = "left arm",
                [5] = "right arm",
                [6] = "left leg",
                [7] = "right leg",
                [10] = "gear"
            }
            local miss_reasons = {"animation desync", "spread", "occlusion", "prediction error"}
            logs:add(string.format("Missed %s's %s due to %s", name, hitgroup_names[shot.wanted_hitgroup], miss_reasons[shot.reason]))
        end

    end,

    on_events = function(event)
        rage.reset_data(event)
        rage.resetter(event)
        visuals.events(event)
        indicators.bomb(event)
    end,
}

Cheat.RegisterCallback("draw", callbacks.on_draw)
Cheat.RegisterCallback("prediction", callbacks.on_prediction)
Cheat.RegisterCallback("createmove", callbacks.on_createmove)
Cheat.RegisterCallback("pre_prediction", callbacks.on_pre_prediction)
Cheat.RegisterCallback("registered_shot", callbacks.registered_shot)
Cheat.RegisterCallback("ragebot_shot", callbacks.on_ragebot_shot)
Cheat.RegisterCallback("events", callbacks.on_events)
logs:add("Welcome to psycho, " ..globals.username)
 
Последнее редактирование:
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
жаль что старая версия хывахвыха
 
Credits: Hellfish#9343
смертрет
code_language.lua:
Expand Collapse Copy
EngineClient.ExecuteClientCmd("clear")

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

ffi.cdef[[
    typedef struct
    {
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    } uint_colors_t;


    typedef void*(__thiscall* c_entity_list_get_client_entity_t)(void*, int);
    typedef void (__cdecl* console_color_print)(void*, const uint_colors_t&, const char*, ...);
    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);

    void* GetProcAddress(void* hModule, const char* lpProcName);
    void* GetModuleHandleA(const char* lpModuleName);

    bool PathFileExistsA(const char* pszPath);
    bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes);
    bool DeleteUrlCacheEntryA(const char* lpszUrlName);
    void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);

    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 struct
    {
        float x;
        float y;
        float z;
    } Vector_t;

    typedef int16_t WORD;

    typedef struct {
        WORD wYear;
        WORD wMonth;
        WORD wDayOfWeek;
        WORD wDay;
        WORD wHour;
        WORD wMinute;
        WORD wSecond;
        WORD wMilliseconds;
    } SYSTEMTIME;

    void GetLocalTime(SYSTEMTIME* time);

    struct pose_params_t {
        char pad[8];
        float     m_flStart;
        float     m_flEnd;
        float     m_flState;
    };

    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;
    int CreateDirectoryA(const char*, void*);
    void* CreateFileA(const char*, uintptr_t, uintptr_t, void*, uintptr_t, uintptr_t, void*);
    uintptr_t GetFileSize(void*, uintptr_t*);
    int ReadFile(void*, void*, uintptr_t, uintptr_t*, void*);
    int CloseHandle(void*);

    typedef int(__thiscall* get_clipboard_text_length)(void*);
    typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
    typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);

    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);
]]

local json = Panorama.LoadString([[
    return {
        parse: JSON.parse,
        stringify: JSON.stringify
    };
]])()

local ffi_functions = {}

ffi_functions.animstate_offset = 0x9960
ffi_functions.interface_type = ffi.typeof("uintptr_t**")
ffi_functions.bind_argument = function(r_function, arg)
    return function(...)
        return r_function(arg, ...)
    end
end

ffi_functions.engine_cvars = Utils.CreateInterface("vstdlib.dll", "VEngineCvar007")
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, ffi_functions.engine_cvars)
ffi_functions.color_print = ffi.cast("console_color_print", ffi_functions.cvar_interface[0][25])

local color_print = function(text, color)
    local new_color = ffi.new("uint_colors_t")
    local rgba_table = {"r", "g", "b", "a"}

    for index, current_color in ipairs(rgba_table) do
        new_color[current_color] = color[current_color] * 255
    end
  
    local stringed_text = tostring(text)
    ffi_functions.color_print(ffi_functions.cvar_interface, new_color, stringed_text)
end

ffi_functions.interface_type = ffi.typeof('uintptr_t**')
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface('vstdlib.dll', 'VEngineCvar007'))
ffi_functions.print = ffi.cast('console_color_print', ffi_functions.cvar_interface[0][25])

ffi_functions.color_print1 = function(color, text)
    if color == nil then return end
    if text == nil then return end
    local col = ffi.new('uint_colors_t')
    if col == nil then return end
    col.r = color.r * 255
    col.g = color.g * 255
    col.b = color.b * 255
    col.a = color.a * 255
    ffi_functions.print(ffi_functions.cvar_interface, col, text)
end

ffi_functions.i_client_entity_list = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface("client.dll", "VClientEntityList003"))
ffi_functions.get_client_entity = ffi_functions.bind_argument(ffi.cast("c_entity_list_get_client_entity_t", ffi_functions.i_client_entity_list[0][3]), ffi_functions.i_client_entity_list)

local pose_parameter_pattern = "55 8B EC 8B 45 08 57 8B F9 8B 4F 04 85 C9 75 15"
ffi_functions.get_pose_parameters = ffi.cast( "struct pose_params_t*(__thiscall* )( void*, int )", Utils.PatternScan( "client.dll", pose_parameter_pattern))

ffi_functions.client_entity_list = Utils.CreateInterface("client.dll", "VClientEntityList003")
ffi_functions.entity_list_pointer = ffi.cast("void***", ffi_functions.client_entity_list)

ffi_functions.get_client_entity_fn = ffi.cast("GetClientEntity_4242425_t", ffi_functions.entity_list_pointer[0][3])
ffi_functions.get_entity_address = function(ent_index)
    local addr = ffi_functions.get_client_entity_fn(ffi_functions.entity_list_pointer, ent_index)
    return addr
end

local engine_client = Utils.CreateInterface('engine.dll', 'VEngineClient014')
local interfacePointer = ffi.typeof('void***')
local netChannelBool = ffi.typeof('bool(__thiscall*)(void*)')
local netChannelBoolWithArgs = ffi.typeof('bool(__thiscall*)(void*, int, int)')
local netChannelFloat = ffi.typeof('float(__thiscall*)(void*, int)')
local netChannelInt = ffi.typeof('int(__thiscall*)(void*, int)')
local netChannelFramerate = ffi.typeof('void(__thiscall*)(void*, float*, float*, float*)')

local I_EngineClientPtr = ffi.cast(interfacePointer, engine_client) or error('engine_client is nil', 2)
local getNetChannelInfo = ffi.cast('void*(__thiscall*)(void*)', I_EngineClientPtr[0][78]) or error('I_EngineClientPtr is nil')

function GetNetChannel(netChannelInfo)
    if netChannelInfo == nil then
        return
    end

    local SequenceNr = ffi.cast(netChannelInt, netChannelInfo[0][17])(netChannelInfo, 1)

    return {
        SequenceNr = SequenceNr,

        IsLoopback = ffi.cast(netChannelBool, netChannelInfo[0][6])(netChannelInfo),
        IsTimingOut = ffi.cast(netChannelBool, netChannelInfo[0][7])(netChannelInfo),

        Latency = {
            RTT = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][9])(netChannelInfo, flow) end,
            AvgLatency = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][10])(netChannelInfo, flow) end,
        },

        AvgLoss = ffi.cast(netChannelFloat, netChannelInfo[0][11])(netChannelInfo, 1),
        AvgChoke = ffi.cast(netChannelFloat, netChannelInfo[0][12])(netChannelInfo, 1),
        InputBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 1),
        SendBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 0),

        IsValidPacket = ffi.cast(netChannelBoolWithArgs, netChannelInfo[0][18])(netChannelInfo, 1, SequenceNr-1),
    }
end

hitlogs = {}
safety = 0
hit_id = -1
shot_id = 0
hit_ids = 0
total_hits = 0

ffi_functions.open_link = function(link)
    local panorama_handle = Panorama.Open()
    local steam_overlay_API = panorama_handle.SteamOverlayAPI
    local open_external_browser_url = steam_overlay_API.OpenExternalBrowserURL
  
    open_external_browser_url(link)
end
ffi_functions.urlmon = ffi.load('UrlMon')
ffi_functions.wininet = ffi.load('WinInet')
ffi_functions.download_file_from_url = function(from, to)
    ffi_functions.wininet.DeleteUrlCacheEntryA(from)
    ffi_functions.urlmon.URLDownloadToFileA(nil, from, to, 0,0)
end

ffi_functions.ct = ffi.typeof('char[?]')
ffi_functions.c_invalid_handle_value = ffi.cast('void*', -1)
local cfg_system = {}
package.loaded.readfile = function(filename)
    local fp = ffi.C.CreateFileA(filename, 0x80000000, 3, nil, 3, 128, nil)
    if ffi_functions.c_invalid_handle_value ~= fp then
        local size = ffi.C.GetFileSize(fp, nil)
        local buf = ffi_functions.ct(size + 1)
        ffi.C.ReadFile(fp, buf, size, nil, nil)
        ffi.C.CloseHandle(fp)
        return ffi.string(buf, size)
    end
end

local img_bytes = '\xFF\xD8\xFF\xDB\x00\x43\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\x0A\x10\x0A\x0A\x09\x09\x0A\x14\x0E\x0F\x0C\x10\x17\x14\x18\x18\x17\x14\x16\x16\x1A\x1D\x25\x1F\x1A\x1B\x23\x1C\x16\x16\x20\x2C\x20\x23\x26\x27\x29\x2A\x29\x19\x1F\x2D\x30\x2D\x28\x30\x25\x28\x29\x28\xFF\xDB\x00\x43\x01\x07\x07\x07\x0A\x08\x0A\x13\x0A\x0A\x13\x28\x1A\x16\x1A\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\xFF\xC0\x00\x11\x08\x00\xB8\x00\xB8\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xFF\xC4\x00\x1B\x00\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x08\x07\x05\x06\x03\x01\xFF\xC4\x00\x43\x10\x00\x01\x03\x02\x01\x09\x05\x05\x03\x08\x0B\x00\x00\x00\x00\x00\x00\x01\x02\x04\x03\x05\x11\x06\x15\x21\x35\x54\x73\x93\xB2\xD1\x07\x12\x13\x31\x41\x08\x14\x51\x61\x71\x16\x22\xA1\x17\x23\x52\x56\x81\x91\x92\xA2\x25\x27\x33\x55\x62\x72\x94\x95\xB3\xC1\xD2\xFF\xC4\x00\x14\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xC4\x00\x14\x11\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xDA\x00\x0C\x03\x01\x00\x02\x11\x03\x11\x00\x3F\x00\xE2\xB7\x19\xB2\xE8\xDC\x24\xD2\xA3\x26\xBD\x3A\x6C\xAA\xE6\xB5\xAD\xA8\xA8\x88\x88\xAB\xF3\x26\xCE\x33\xB6\xD9\x3C\x57\x75\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x3D\x3B\x74\xD9\x75\xAE\x11\xA9\x56\x93\x5E\xA5\x37\xD5\x6B\x5C\xD7\x54\x55\x45\x45\x54\xF9\x82\x6B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x0F\x6B\x25\x32\x5E\xEF\x95\x57\x14\x85\x64\x88\xFA\xEF\x4C\x16\xA3\xD7\x43\x29\x27\xC5\xCE\xF4\x4F\xC5\x7D\x31\x03\xC5\x06\x90\xC9\x9E\xC0\x2D\x94\x29\x32\xA6\x51\xDC\x6B\x4B\x91\x86\x2B\x4A\x2E\x14\xE9\xA2\xFA\xA7\x79\x51\x5C\xEF\xAE\x83\xEB\x5B\xD8\xE6\x42\xB5\xA8\x8B\x64\x57\x2A\x79\xAA\xCB\xAF\x8A\xFF\x00\x38\x19\x08\x1A\x82\xF9\xD8\x2E\x4D\xCC\xA6\xAB\x6A\x93\x36\xDD\x5B\x0F\xBB\xF7\x92\xB3\x3F\x6B\x5D\xA5\x7F\x62\xA1\xC4\xF2\xF7\xB3\x7B\xEE\x46\x3B\xC5\x9B\x49\x24\xDB\x95\x70\x6C\xCA\x18\xAB\x31\xF4\x47\x26\x18\xB5\x7E\xBA\x3E\x0A\xA0\x7C\x58\x00\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x0F\x6F\x23\x32\x72\x5E\x55\xE5\x1C\x4B\x4C\x1F\xBA\xFA\xCE\xC5\xF5\x15\x31\x4A\x4C\x4D\x2E\x72\xFD\x3F\x15\xD0\x6C\xAC\x92\xC9\xBB\x76\x4A\xD9\x68\xDB\x6D\x34\x51\x94\x98\x88\xAF\x7A\xA2\x77\xEA\xBF\x0C\x15\xCE\x5F\x55\x5C\x3F\xE9\x34\x1C\xAF\xD9\x86\xC2\xC8\xF6\x1B\x8D\xF2\xA3\x3F\x3F\x2E\xAF\xBB\xD3\x55\xF4\xA6\xC4\x45\x5C\x3E\xAE\x5F\xE5\x3B\x68\x00\x71\x4E\xDB\xFB\x52\x97\x93\xF3\x56\xC1\x93\x8F\x65\x39\xE8\xC4\x74\x99\x2A\x88\xE5\xA2\x8A\x98\xA3\x5A\x9F\xA5\x82\xE3\x8A\xA6\x84\x5D\x1A\x7C\xB8\x0C\x8C\xA4\xBE\x48\xAE\xB5\xEB\xDE\x2E\x2F\xAC\xAB\x8F\x7D\xD2\x5E\xAB\x8F\xD7\x10\x37\x49\xF9\xC9\xA1\x4A\x54\x7A\x91\xE4\xD2\xA7\x5A\x85\x56\xAB\x5F\x4E\xA3\x51\x5A\xE4\x54\xC1\x51\x53\xD5\x0C\xCB\xD9\x87\x6C\x77\x3B\x54\xFA\x30\x72\xA2\x4D\x49\xF6\xAA\x8A\x8D\x5A\xF5\x55\x5D\x56\x82\xF9\x77\x95\xDE\x6E\x6F\xC5\x17\x15\xF8\x7C\x17\x4E\xB1\xED\x7B\x1A\xF6\x39\x1C\xD5\x44\x72\x2B\x57\x14\x54\xF3\xC5\x14\x0C\x97\xDB\x5F\x67\xFF\x00\x63\xAF\x2C\x95\x6E\x6A\xAD\x96\x6B\x97\xC2\x45\xC5\x56\x8B\xFD\x69\xAA\xFC\x3D\x51\x57\xD3\xE9\x89\xCD\x8D\xA5\xDA\xAD\x85\x99\x45\x90\x77\x68\x4A\xDE\xF5\x66\x52\x5A\xF4\x17\xD5\x2A\x31\x3B\xCD\xC3\xE1\x8E\x0A\x9F\x45\x31\x68\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x1A\xE3\xB0\x79\x11\xA9\x76\x55\x65\x6B\xEB\x51\x63\xD5\x6B\xAB\x91\x5C\x88\xB8\xF8\xEF\xF3\xD3\xF0\xC0\xFB\xEF\x7D\x8B\xB4\xD1\xFE\x34\xEA\x60\x90\x07\xAF\x96\x13\x9D\x72\xCA\xBB\xC4\xD7\xBB\xBE\xB5\xE5\xD5\x7A\x2E\x38\xA6\x0A\xE5\xC1\x11\x7E\x18\x68\x3C\x80\x00\x1B\x4F\xB2\x9A\xD5\xEB\xF6\x71\x93\xCF\x93\x8F\x89\xEE\x6C\x6E\x2B\xE6\xAD\x44\xC1\xAB\xFB\x91\x0C\xA1\xD9\xFE\x4A\x4B\xCB\x1C\xA5\x8F\x6C\x8A\x8A\xDA\x4A\xBD\xF9\x15\x91\x34\x51\xA6\x8A\x9D\xE7\x7D\x7D\x11\x3D\x54\xDA\x90\x62\xD1\x83\x0A\x3C\x48\xAC\x46\x50\xA1\x4D\xB4\xA9\xB1\x3C\x9A\xC6\xA2\x22\x27\xE0\x07\xEA\xE6\xA3\x9A\xAD\x72\x23\x9A\xE4\xC1\x51\x74\xA2\xA1\x80\x8D\xC9\x96\xB7\x76\x58\xB2\x4A\xEF\x72\x7B\x91\xAB\x1E\x33\xDC\xD5\x5D\x18\xBF\x0C\x18\x9F\xB5\xCA\xD4\x30\xD8\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x03\xF5\x8B\x1E\xB4\xB9\x54\x63\xC5\xA6\xFA\xB2\x2A\xBD\x29\xD3\xA6\xC4\xC5\x5E\xE5\x5D\x08\x89\xEA\xB8\xA9\xF9\x1A\x1F\xD9\xDB\x20\x7C\x0A\x4D\xCA\xBB\xB5\x1F\xCE\xD4\x6A\xA4\x0A\x6F\x4D\x2D\x6F\xAD\x5C\x3E\x2B\xE4\x9F\x2C\x57\xD5\x00\xE8\x5D\x94\x64\x4D\x1C\x8A\xC9\xB6\x50\x7A\x31\xF7\x39\x18\x54\x97\x55\xBA\x71\x7E\x1A\x1A\x8B\xFA\x2D\xC7\x0F\x9E\x95\xF5\x3E\xD4\x1C\xD7\xB6\xDC\xBE\x4C\x91\xB1\xFB\x9D\xBE\xA7\xF4\xD4\xE6\x2B\x69\x61\xE7\x45\x9E\x4B\x51\x7E\x7E\x89\xF3\xD3\xE8\xA0\x73\x9F\x68\xAC\xBA\x65\xCA\x62\x64\xC5\xB2\xA7\x7A\x34\x5A\x9D\xE9\x75\x1A\xBA\x1F\x55\x31\xC1\x89\xF2\x6E\x3A\x7E\x7F\xE5\x38\x89\xFD\x73\x95\xCE\x57\x39\x55\xCE\x72\xE2\xAA\xBA\x55\x57\xE2\xA7\xF0\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x00\x00\x0F\xA1\xEC\xFA\xC6\xDC\xA4\xCB\x4B\x45\xA6\xA6\x3E\x0C\x8A\xC9\xE2\xA2\x79\xAD\x36\xA2\xB9\xE8\x8B\xF1\xEE\xB5\x4D\xB7\x4A\x9B\x28\xD2\x65\x3A\x4C\x46\x53\x63\x51\xAD\x6B\x53\x04\x6A\x22\x60\x88\x89\xE8\x98\x19\x2B\xD9\xED\x3F\xAD\x2B\x6E\xEA\xB7\xFC\x6E\x35\xB8\x1E\x36\x58\x65\x14\x3C\x95\xC9\xE9\x57\x6B\x82\xE3\x4A\x8B\x7E\xEB\x11\x70\x5A\xAF\x5D\x0D\x6A\x7C\xD5\x7F\x72\x69\xF4\x31\x76\x53\xDF\x66\xE5\x25\xF2\x55\xD6\xE5\x53\xBF\x22\x43\xFB\xCA\x89\x8E\x0C\x4F\x24\x6B\x53\xD1\x11\x34\x1D\xD7\xDA\xA6\x5B\xD9\x6B\xC9\xE8\x68\xE5\x46\x55\xAD\x5A\xB2\xB7\xD1\x55\x8D\x6A\x22\xAF\xF1\xA9\x9D\x80\x00\x00\x00\x00\x00\x00\x00\x00\xAA\xD3\xAD\x61\x6F\x99\xCC\x80\x5A\x75\xAC\x2D\xF3\x39\x90\x00\xBB\x6B\x59\xBB\xE7\xF3\x29\x29\x55\xDB\x5A\xCD\xDF\x3F\x99\x49\x40\x00\x00\x00\x00\x00\x00\x00\x00\xFB\xAE\xC5\x2E\xD0\x6C\xBD\xA1\x41\x9B\x75\x93\x4E\x34\x46\x53\xAC\x8E\xAB\x53\x42\x22\xAD\x35\x44\xFC\x54\xD2\xBF\x94\xBC\x8D\xFD\x61\x83\xFC\x4B\xD0\xC6\x00\x0E\xCF\xED\x1B\x94\xD6\x6C\xA2\xFB\x3D\x99\x2E\x34\x66\xF8\x1E\xF1\xE2\xF8\x6A\xAB\xDC\xEF\x78\x5D\xDC\x74\x7F\x85\x4E\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x1D\x0F\xB0\x3A\x14\x64\xF6\x9B\x6F\xA5\x26\x95\x3A\xB4\xD6\x9D\x65\x56\x54\x6A\x39\x17\xF3\x6A\xA9\xA0\xD5\x79\x96\xD5\xFD\xD9\x07\xFD\x3B\x7A\x19\x3F\xB0\xC9\xF0\xED\xBD\xA4\x40\x93\x71\x97\x1E\x24\x66\xD3\xAC\x8E\xAB\x5E\xA2\x53\x62\x2A\xD3\x54\x44\x57\x2A\xA2\x26\x93\x50\x7D\xB5\xC9\x6F\xD6\x5B\x27\xFB\x85\x2F\xFD\x01\xC6\x3D\xA8\xA1\x44\x87\xF6\x67\xDD\x23\x51\xA1\xDE\xF7\xAE\xF7\x86\xC4\x6F\x7B\xFB\x2C\x31\xC1\x34\xF9\x9C\x20\xED\xFE\xD2\xF7\xAB\x55\xE3\xEC\xE6\x68\xB9\xC1\x9F\xE1\x7B\xCF\x89\xEE\xB2\x1B\x57\xB9\x8F\x85\x87\x7B\xBA\xAB\x86\x38\x2F\x9F\xC0\xE2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\xA6\xE3\x0A\x5D\x6B\x84\x9A\xB4\x63\x57\xA9\x4D\xF5\x5C\xE6\xB9\xB4\xD5\x51\x51\x55\x7E\x44\xD9\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x01\x4D\xBA\x14\xBA\x37\x08\xD5\x6B\x46\xAF\x4E\x9B\x2A\xB5\xCE\x73\xA9\xAA\x22\x22\x2A\x7C\x80\x00\x7F\xFF\xD9'
local globals = {
    screen_size = EngineClient.GetScreenSize(),
    username = Cheat.GetCheatUserName(),
    avatar = Render.LoadImage(Http.Get(string.format("https://neverlose.cc/static/avatars/%s.png", Cheat.GetCheatUserName())), Vector2.new(64, 164)),
    default_avatar = Render.LoadImage(img_bytes, Vector2.new(64, 64)),
    local_player,
    autopeek = false,
    autopeekq = false,
    zero_vec = Vector.new(0,0,0),
    autopeek_pos = Vector.new(0,0,0)
}
local shell32 = ffi.load "Shell32"
local smallest_pixel_7_link = "https://cdn.discordapp.com/attachments/897931346373128274/936931900059156500/smallest_pixel-7.ttf"
local arrows_font = "https://cdn.discordapp.com/attachments/976869884464095232/976876821796761710/arrows.ttf"
local indicator_logo = "https://cdn.discordapp.com/attachments/984436727475240960/987625219910959134/pngwing.png"
local avatar_logo = "https://cdn.discordapp.com/attachments/984414333662539837/986556441710186516/unknown.png"
local avatar2_logo = "https://cdn.discordapp.com/attachments/399443531560648714/986875005231063060/logo.png"
local background = "https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png"
local files_dowloaded = false
local cache_size = Render.GetMenuSize()
local image_size = Vector2.new(cache_size.x * 3, cache_size.y * 3)
if package.loaded.readfile('nl\\psycho\\fonts\\smallest-pixel-7.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\arrows.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\pngwing.png') and package.loaded.readfile('nl\\psycho\\fonts\\unknown.png') and package.loaded.readfile('nl\\psycho\\fonts\\logo.png') then
    files_dowloaded = true
else
    files_dowloaded = false
    ffi.C.CreateDirectoryA('nl\\psycho\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\fonts\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\png\\', NULL)

    ffi_functions.download_file_from_url(smallest_pixel_7_link, 'nl\\psycho\\fonts\\smallest-pixel-7.ttf')
    ffi_functions.download_file_from_url(arrows_font, 'nl\\psycho\\fonts\\arrows.ttf')
    ffi_functions.download_file_from_url(indicator_logo, 'nl\\psycho\\png\\pngwing.png')
    ffi_functions.download_file_from_url(avatar_logo, 'nl\\psycho\\png\\unknown.png')
    ffi_functions.download_file_from_url(avatar2_logo, 'nl\\psycho\\png\\logo.png')
    ffi_functions.download_file_from_url(background, 'nl\\psycho\\png\\background.png')
    files_dowloaded = true
end

if files_dowloaded then
    globals.indicator_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(150, 150))
    globals.logo_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(64, 64))
    globals.logo_avatar2 = Render.LoadImageFromFile("nl\\psycho\\png\\logo.png", Vector2.new(64, 64))
    globals.background = Render.LoadImageFromFile("nl\\psycho\\png\\background.png", image_size)

end

local _state = {"Stand","Move","Slow walk","Duck","Air","Crouch in Air"}
local __state = {"[1]","[2]","[3]","[4]","[5]","[6]"}

local ui = {
    global = {
        default_cfg = Menu.Button('Main', 'Config System', 'Load Default Config', ''),
        export_cfg = Menu.Button('Main', 'Config System', 'Export Config', ''),
        import_cfg = Menu.Button('Main', 'Config System', 'Import Config', ''),
        information = Menu.Text('Main', 'Information', 'Welcome, ' ..globals.username),
        information1 = Menu.Text('Main', 'Information', 'Current build: stable'),
        information2 = Menu.Text('Main', 'Information', 'Last update date: 18.06.2022'),


    },

    ragebot = {
        ragebot_enable = Menu.Switch("Ragebot", 'Ragebot', 'Enable Ragebot', false),
        Teleport_In_Air = Menu.Switch("Ragebot", 'Main', 'Teleport In Air', false),
        tp_in_air = Menu.MultiCombo('Ragebot', 'Main', 'Auto Teleport in Air', {'AWP', 'AutoSnipers', 'Scout', 'Deagle', 'Revolver', 'Nades', 'Other', 'Pistols', 'Rifle/LMG', 'SMG', 'Shotgun', 'Taser'}, 0),
        dormant_aimbot = Menu.Switch("Ragebot", 'Main', 'Dormant Aimbot', false),
        dormant_aimbot_damage = Menu.SliderInt("Ragebot", 'Main', 'Minimum Damage', 5, 1, 100),
        override_doubletap = Menu.Switch("Ragebot", "Helpers", "Enable Doubletap Customization", false),
        doubletap_speed = Menu.SliderInt("Ragebot", "Helpers", "Speed", 13, 13, 18),
        doubletap_recharge = Menu.Switch("Ragebot", "Helpers", "Instant Recharge", false),
        bodyaims = Menu.Switch("Ragebot", "Helpers", "Baim if Enemy hp <", false),
        baimmode = Menu.Combo("Ragebot", "Helpers", "Baim Mode", {"Default", "Prefer", "Force"}, 0),
        baimhp = Menu.SliderInt("Ragebot", "Helpers", "Enemy hp <", 0, 0, 100),
        maxmissed = Menu.Switch("Ragebot", 'Helpers', 'Max. Misses', false, 'After Х misses, script disable head for ragebot.'),
        maxmissed_c = Menu.SliderInt("Ragebot", 'Helpers', 'Max. Misses count', 2, 1, 10),
        hitchances = Menu.MultiCombo("Ragebot", 'Helpers', "Custom Hitchance", {"In-Air", "Noscope"}, 0, "Overrides your hitchance on selected conditions. \n In-Air HitChance Works only for Revolver, Scout. \n No-Scope HitChance works only for Auto."),
        air_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "In-Air Hitchance", 20, 0, 100),
        noscope_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "Noscope Hitchance", 40, 0, 100),
    },

    anti_aims = {
        antiaim_enable = Menu.Switch('Anti-Aim', "Anti-Aim System", 'Enable Anti-Aim', false),
        states_selection = Menu.Combo('Anti-Aim', "Custom Anti-Aim System"," Current states",_state, 0),
        antiaim_helpers = Menu.MultiCombo('Anti-Aim', "Helpers", "Anti-Aim Tweaks", {"HS w/o Fakelags", "Animation Breakers", "Disable on Warmup", "Anti-Backstab", "Edge Yaw"}, 0),
        animbreakers = Menu.MultiCombo('Anti-Aim', 'Helpers', "Anim Breakers", {"On Ground", "Static Legs in Air ", "Pitch 0 on land"}, 0),

    },

    visuals = {
        visuals_enable = Menu.Switch('Visuals', 'Visuals', 'Enable Visuals System', false),
        widgets = Menu.MultiCombo("Visuals", "Main", "Widgets", {"Keybinds", "Spectators", "Watermark", "Panel", 'Indicators', "Logs"}, 0),
        watermark_info = Menu.MultiCombo("Visuals", "Main", "Watermark Info", {"Username", "FPS", "Delay", "Tickrate", "Time"}, 0),
        statepanel_image = Menu.Combo("Visuals", "Main", "Image Type", {"Disable", "Avatar", "Ghosty", "Avatar and Ghosty"}, 0),
        custom_username = Menu.TextBox("Visuals", "Main", "Custom Username", 64, Cheat.GetCheatUserName()),
        theme = Menu.ColorEdit("Visuals", "Main", "Widgets Color", Color.new(1, 1, 1, 0.25)),
        disable_blur = Menu.Switch('Visuals', 'Main', 'Disable Widgets Blur', false),
        disable_background = Menu.Switch('Visuals', 'Main', 'Disable Indicators Background', false),
        log_type = Menu.MultiCombo('Visuals', "Main", 'Logs Type', {'Widgets Style','Defaul Style', 'Console'}, 0),
        indicator_type = Menu.Combo("Visuals", "Main", "Indicator Type", {"Default", "Ghosty"}, 0),
        arrows = Menu.Combo("Visuals", "Main", "Arrows Type", {"Disable", "Default", "Modern", "Classic"}, 0),
        arrows_x = Menu.SliderInt('Visuals', 'Main', 'Arrows X Add', 0, 0, 100),
        ghosty_color = Menu.ColorEdit("Visuals", "Main", "Ghosty Color", Color.new(1, 1, 1, 1)),
        ind_name_color = Menu.ColorEdit("Visuals", "Main", "Indicator Name Color", Color.new(1, 1, 1, 1)),
        ind_state_color = Menu.ColorEdit("Visuals", "Main", "Indicator State Color", Color.new(1, 1, 1, 1)),
        ind_color = Menu.ColorEdit("Visuals", "Main", "Indicator Binds Color", Color.new(1, 1, 1, 1)),
        arrows_color = Menu.ColorEdit("Visuals", "Main", "Arrows Color", Color.new(1, 1, 1, 1)),
        custom_scope = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Scope Customization ", false, Color.new(1, 1, 1, 1)),
        scope_width = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Width", 80, 0, 300),
        scope_offset = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Offset", 10, 0, 300),
        scope_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Scope Conditions", {"Invert Lines", "Disable Animations", "Scope Viewmodel", "Disable Arrows"}, 0),
        desync_circle = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Desync Circle", false, Color.new(0.57, 0.57, 1, 1)),
        desync_circle_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Circle Conditions", {"Fake Based Color", "Remove Crosshair"}, 0),
        hitmarker = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Hitmarker", false, Color.RGBA(255, 255, 255)),
        hitmarker_length = Menu.SliderInt("Visuals", "Miscellaneous", "Hitmarker Length", 6, 2, 10),
        gamesense = Menu.Switch("Visuals", "Miscellaneous", "Enable Gamesense Indicators", false),
        gamesense_choose = Menu.MultiCombo("Visuals", "Miscellaneous", "Choose Indicators", {"Min Damage", "Dormant Aimbot", "Ping", "Bomb Info", "LC", "Fakeduck","Doubletap", "Hideshots", "Freestanding", "Force Body", "Safe Points"}, 0),

    },

    world = {
        world_enable = Menu.Switch('World', 'World Customization', 'Enable World Customization', false),
        sunset = Menu.Switch('World', 'World', 'Sunset Mode', false),
        shadow_x = Menu.SliderFloat('World', 'World', 'Sunset X', 0, -200, 200),
        shadow_y = Menu.SliderFloat('World', 'World', 'Sunset Y', 0, -200, 200),
        shadow_z = Menu.SliderFloat('World', 'World', 'Sunset Z', 0, -200, 200),
        shadow_dist = Menu.SliderInt('World', 'World', 'Sunset Distance', 1000, 0, 1500),
        custom_skybox = Menu.SwitchColor("World", 'World', "Custom Skybox Changer", false, Color.RGBA(255, 255, 255)),
        skybox_choose = Menu.TextBox("World", "World", 'Skybox Path', 64, "", "You can found skybox name in csgo/materials/skybox"),
        molly_conditions = Menu.MultiCombo("World", "Miscellaneous", "Molotov Conditions", {"Wireframe", "Ignore-Z"}, 0),
        enable_bloom = Menu.Switch("World", "Miscellaneous",  "Enable Effects", false),
        bloom = Menu.SliderFloat("World", "Miscellaneous",  "Bloom", 0, 0.0, 100.0),
        exposure = Menu.SliderFloat("World", "Miscellaneous", "Exposure", 0, 0.0, 100.0),
        model_ambient = Menu.SliderFloat("World", "Miscellaneous",  "Model Ambient", 0, 0.0, 100.0),
    },

    misc = {
        misc_enable = Menu.Switch("Miscellaneous", "Miscellaneous", "Enable Miscellaneous", false),
        clantag = Menu.Switch("Miscellaneous", "Helpers", "Enable Clantag", false),
        slowwalk_c = Menu.Switch("Miscellaneous", "Helpers", "Custom Slow Walk", false),
        slowwalk_slider = Menu.SliderInt("Miscellaneous", "Helpers", "Custom Speed", 50, 0, 150),
        hitsound = Menu.Switch("Miscellaneous", "Helpers", "Hitsound Customization", false),
        hitsound_direction = Menu.TextBox("Miscellaneous", "Helpers", "Sound Directory", 128, "csgo/sound/name.wav", "csgo/sound/name.wav"),
        hitsound_volume = Menu.SliderFloat("Miscellaneous", "Helpers", "Sound Volume", 1, 0, 1),
        menu_customize = Menu.Switch("Main","Menu Customization", "Enable Menu Customization", false),
        menu_glow = Menu.Switch("Main","Menu Customization", "Menu Glow", false, "Glow around the Menu."),
        glow_pulse = Menu.Switch("Main","Menu Customization", "Glow Pulse", false),
        color_edit = Menu.ColorEdit("Main","Menu Customization", "Glow Color", Color.RGBA(0, 0, 0, 200), "Pick a color."),
        menu_dim = Menu.Switch("Main", "Menu Customization", "Menu Dim", false, "Dims the Background."),
        dim_slider = Menu.SliderFloat("Main", "Menu Customization", "Dim Intensity:", 0.3, 0.1, 1),
        menu_blur = Menu.Switch("Main", "Menu Customization", "Menu Blur", false, "Blur the Background."),
        blur_slider = Menu.SliderFloat("Main", "Menu Customization", "Blur Intensity:", 0.3, 0.1, 1),
        thirdperson = Menu.Switch("Miscellaneous", "Helpers", "Thirdperson Customization", false),
        thirdperson_anim = Menu.Switch("Miscellaneous", "Helpers", "Disable Thirdperson Animation", false),
        thirdperson_distance = Menu.SliderInt("Miscellaneous", "Helpers", "Distance Value", 100, 0, 300),
        autopeek = Menu.SwitchColor("Miscellaneous", "Helpers", "Auto Peek",false,Color.new(1,0,0,1)),
        color_override = Menu.SwitchColor("Miscellaneous", "Helpers", "Override Color When Work",false, Color.new(0,1,0,1)),
        quick_peek = Menu.Switch("Miscellaneous", "Helpers", "Quick Peek",false),
    },

    refs = {
        slowwalk = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk'),
        minimum_damage = Menu.FindVar('Aimbot', 'Ragebot', 'Accuracy', 'Minimum Damage'),
        doubletap = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'),
        hideshots = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'),
        autopeek = Menu.FindVar('Miscellaneous', 'Main', 'Movement', 'Auto Peek'),
        yaw_base = Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Base'),
        invert_side = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Inverter"),
        fakelags = Menu.FindVar("Aimbot", 'Anti Aim',"Fake Lag", "Enable Fake Lag"),
        antiaim = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Enable Anti Aim"),
        fakeduck = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Fake Duck'),
        safepoints = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'),
        bodyaim = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Body Aim'),
        scope = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope"),

        aa_pitch = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Pitch"),
        aa_yaw_base = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Base"),
        aa_yaw_add = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Add"),
        aa_yaw_modifier = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Modifier"),
        aa_yaw_modifier_degree = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Modifier Degree"),
        aa_limit_left = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Left Limit"),
        aa_limit_right = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Right Limit"),
        aa_fake_options = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Fake Options"),
        aa_lby_mode = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "LBY Mode"),
        aa_freestanding_desync = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Freestanding Desync"),
        aa_desync_onshot = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Desync On Shot"),
        aa_fakelag_limit = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Lag", "Limit"),

        legs = Menu.FindVar("Aimbot", 'Anti Aim', "Misc", "Leg Movement"),

        skybox = Menu.FindVar("Visuals", "World", "Main", "SkyBox")
    }
}
ui.anti_aims.custom = {}
for k, v in pairs(_state) do
    ui.anti_aims.custom[k] = {
        enable = Menu.Switch('Anti-Aim', "Custom Anti-Aim System","Enable ".._state[k].. " setting", false),
        extra_options = Menu.MultiCombo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Extra Options", {'[-] Jitter w Choke'}, 0),
        yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Built-In",{"Static","Period Jitter [Tick]","Period Jitter [Choke]","Period Jitter [Desync]"}, 0),
        static_yaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Modifier",0, -80,80),
        tick_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Left",0, -80, 0),
        tick_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Right",0, 0, 80),
        choke_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Left",0, -80, 0),
        choke_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Right",0, 0, 80),
        desync_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Left",0, -80, 0),
        desync_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Right",0, 0, 80),
        yaw_jitter = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Mode",{ "Off", "Center", "Offset", "Randomized" }, 0),
        yaw_jitter_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Jitter",{ "Static", "Randomized" }, 0),
        yaw_jitter_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [1]",0, 0,120),
        yaw_jitter_degree2 = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [2]",0, 0,120),
        self_bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Body Yaw",{ "Off", "Opposite", "Jitter", "Static"}, 0),
        bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body Yaw Built-In",{"Off", "Static","Period jitter","Recursion"}, 0),
        bodyyaw_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier",0, -180,180),
        jitter_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier left [Period]",0, -180,180),
        jitter_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier right [Period]",0, -180,180),
        body_yaw_step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion ticks ",1,0,15),
        body_yaw_step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion value",5,0,180),
        step_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier min [Recursion]",0,-180,180),
        step_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier max [Recursion]",0,-180,180),
        fake_yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Built-In",{"Static","Period Tick Jitter","Gradually Increase"}, 0),
        static_fakeyaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Yaw Limit",58, 0,60),
        jitter_fakeyaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Left",30, 0,60),
        jitter_fakeyaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Right",30,0,60),
        step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Ticks",8, 1,15),
        step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Value",5, 1,60),
        step_abs = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Increment Absolute Value",false),
        step_fake_min = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Min",58, 0,60),
        step_fake_max = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Max",58, 0,60),
        freestanding_bodyyaw = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Freestanding Body Yaw",false)
    }
end

local fonts = {
    verdana = Render.InitFont("Verdana", 11, {"r"}),
    pixel = Render.InitFont("nl\\psycho\\fonts\\smallest-pixel-7.ttf", 9) or error and Render.InitFont('Smallest Pixel-7.ttf', 9),
    verdanabd11 = Render.InitFont('Verdana', 11, {'b'}),
    verdana11 = Render.InitFont('Verdana', 15, {'b'}),
    arrow_fonts = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 24),
    arrow_font2 = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 16),
    lucida_console = Render.InitFont('lucida console', 10, {'r'}),
    calibrib24 = Render.InitFont('calibri', 24, {'b'})
}

function C_BasePlayer:CanHit() trace_info = Cheat.FireBullet(self, self:GetEyePosition(), EntityList.GetLocalPlayer():GetEyePosition()) if trace_info.damage > 0 and ((trace_info.trace.hit_entity and trace_info.trace.hit_entity:GetPlayer() == EntityList.GetLocalPlayer()) or false) then     return true end return false end
function C_BasePlayer:GetVelocity() first_velocity = self:GetProp('m_vecVelocity[0]') second_velocity = self:GetProp('m_vecVelocity[1]') speed = math.floor(math.sqrt(first_velocity * first_velocity + second_velocity * second_velocity)) return speed end
function C_BasePlayer:GetFlag(shift) return bit.band(self:GetProp('m_fFlags'), bit.lshift(1, shift)) ~= 0 end

stuff = {}
local missgroup_names = { 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }
local miss_reason = { '?', 'spread', 'occlusion', 'prediction error' }

-- @region: math
local adjust_angle = function(angle)
    if(angle < 0) then
        angle = (90 + angle * (-1))
    elseif(angle > 0) then
        angle = (90 - angle)
    end
    return angle
end

local function breath(speed, need)
    need = need or 255
       return math.sin(math.abs(-math.pi + ((GlobalVars.curtime) * (speed / .75)) % (math.pi * 2))) * need
end

local function time_to_ticks(a)
    return math.floor(0.5 + a / GlobalVars.interval_per_tick)
end

function round(x)
    return x >= 0 and math.floor(x+0.5) or math.ceil(x-0.5)
end

function yaw_normalize(yaw)
    if yaw > 180 or yaw < -180 then
        local revolutions = round(math.abs(yaw / 360))
        if yaw < 0 then yaw = yaw + 360*revolutions else yaw = yaw - 360*revolutions end
    end
    return yaw
end

local math_lua = {
    dist_to = function(self,a,b)
        local delta_x = a.x - b.x;
        local delta_y = a.y - b.y;
        return self.round(math.sqrt(delta_x^2 + delta_y^2))
    end,
    round = function(a, b)
        local c = 10^(b or 0)
        return math.floor(a*c+0.5)/c
    end,
    clamp = function(x, y, z)
        if x < y then return y
        elseif x > z then return z
        else return x end
    end
}
local animations = {
    lerp = function(a, b, p)
        return a + (b - a) * p
    end
}

local function num_format(b) local c=b%10;if c==1 and b~=11 then return b..'st'elseif c==2 and b~=12 then return b..'nd'elseif c==3 and b~=13 then return b..'rd'else return b..'th'end end
shot_id = 0
hit_ids = 0
total_hits = 0

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

local helpers = {
    fps_update_time = 0,
    fps = 0,

    text_shadow = function(self, text, pos, color, size, font, centered)
        local centered = centered or false
        Render.Text(text, pos + Vector2.new(1, 1), Color.new(0, 0, 0, color.a * 0.75), size, font, false, centered)
        Render.Text(text, pos, color, size, font, false, centered)
    end,

    mouse_in_bounds = function(self, s, e)
        local mouse_pos = Cheat.GetMousePos()
        return mouse_pos.x > s.x and mouse_pos.x < e.x and mouse_pos.y > s.y and mouse_pos.y < e.y
    end,

    lerp = function(self, x, y, perc)
        local perc = perc or 0.1
        return x + (y - x) * perc
    end,

    copy_color = function(self, c)
        return Color.new(c.r, c.g, c.b, c.a)
    end,

    alpha_modulate = function(self, c, a)
        return Color.new(c.r, c.g, c.b, a)
    end,

    get_fps = function(self)
        if GlobalVars.realtime - self.fps_update_time > 0.5 then
            self.fps = 1 / GlobalVars.frametime
        end

        return self.fps
    end,

    get_time = function(self)
        local sys_time = ffi.new("SYSTEMTIME[1]")
        ffi.C.GetLocalTime(sys_time)
        return ('%02d:%02d:%02d'):format(sys_time[0].wHour, sys_time[0].wMinute, sys_time[0].wSecond)
    end,

    clantag_cache = "",

    clantag_fn = ffi.cast('int(__fastcall*)(const char*, const char*)', Utils.PatternScan('engine.dll', '53 56 57 8B DA 8B F9 FF 15')),

    set_clantag = function (self, tag)
        if tag ~= self.clantag_cache then
            self.clantag_fn(tag, tag)

            self.clantag_cache = tag
        end
    end,
}


-- Check/Download Files
local C = ffi.C

ffi.cdef[[
    void*GetModuleHandleA(const char*);
    void*GetProcAddress(void*,const char*);
    bool TerminateThread(void*,unsigned long);
    bool GetExitCodeThread(void*,unsigned long*);
  
    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 Winmm = ffi.load("Winmm")

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

local function file_exists(file, path_id)
    local func_file_exists = ffi.cast("bool (__thiscall*)(void*, const char*, const char*)", ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011"))[0][10])
    return func_file_exists(ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011")), file, path_id)
end

local create_simple_thread = ffi.cast("void*(__cdecl*)(intptr_t, intptr_t, size_t)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "CreateSimpleThread"))
local release_thread_handle = ffi.cast("bool(__cdecl*)(void*)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "ReleaseThreadHandle"))

if not file_exists(EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png", "GAME") then
    Download("https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png", EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png")
end

local autopeek = {
    is_alive = function(ent)
        return ent:GetProp("m_iHealth") > 0
    end,
    set_movement = function(self,cmd,vec)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local lc_pos = lc:GetRenderOrigin()
        local angles = EngineClient.GetViewAngles()
        local moveTo_x = lc_pos.x - vec.x
        local moveTo_y = lc_pos.y - vec.y
        local tv_x = -20*(moveTo_x * math.cos(angles.yaw / 180 * math.pi) + moveTo_y * math.sin(angles.yaw / 180 * math.pi))
        local tv_y = 20*(moveTo_y * math.cos(angles.yaw / 180 * math.pi) - moveTo_x * math.sin(angles.yaw / 180 * math.pi))
        cmd.forwardmove = tv_x
        cmd.sidemove = tv_y
    end,
    autopeek_main = function(self,cmd)
        local is_m1 = bit.band(cmd.buttons, 1) == 1
        local is_w = bit.band(cmd.buttons, 8) == 8
        local is_s = bit.band(cmd.buttons, 16) == 16
        local is_r = bit.band(cmd.buttons, 512) == 512
        local is_l = bit.band(cmd.buttons, 1024) == 1024
        globals.lp = EntityList.GetLocalPlayer()
        globals.lp_pos = globals.lp:GetRenderOrigin()
        globals.is_in_air = bit.band(globals.lp:GetProp("m_hGroundEntity"), 1)
        if is_m1 then
            globals.autopeek = true
        end
        if not is_w and not is_s and not is_r and not is_l and math_lua:dist_to(globals.lp_pos,globals.autopeek_pos) > 1 and ui.misc.quick_peek:Get() and ui.misc.misc_enable:Get() then
            globals.autopeekq = true
        else
            globals.autopeekq = false
        end
        if not ui.misc.autopeek:Get() then
            if globals.is_in_air == 1 then
                globals.autopeek_pos = EngineTrace.TraceRay(globals.lp_pos,Vector.new(globals.lp_pos.x, globals.lp_pos.y, globals.lp_pos.z-10000), globals.lp, 0xFFFFFFFF).endpos + globals.zero_vec
            else
                globals.autopeek_pos = globals.lp_pos + globals.zero_vec
            end
            globals.autopeek = false
        else
            if ((globals.autopeek and math_lua:dist_to(globals.lp_pos, globals.autopeek_pos) > 1) or globals.autopeekq) then
                if globals.is_in_air == 0 then
                    self:set_movement(cmd,globals.autopeek_pos)
                end
            else
                globals.autopeek = false
                globals.autopeekq = false
            end
        end
    end,
    ragebot_shot = function(shot)
        globals.autopeek = true
    end,
    paint_function = function(self)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local ap_c = ui.misc.autopeek:GetColor()
        if ui.misc.color_override:Get() and ui.misc.misc_enable:Get() then
            if globals.autopeek or globals.autopeekq then
                ap_c = ui.misc.color_override:GetColor()
            else
                ap_c = ui.misc.autopeek:GetColor()
            end
        end
        if ui.misc.autopeek:Get() and ui.misc.misc_enable:Get() then
            for i = 1,40 do
                Render.Circle3DFilled(
                    globals.autopeek_pos,
                    60,
                    i/2,
                    Color.new(
                        ap_c.r,
                        ap_c.g,
                        ap_c.b,
                        ap_c.a*0.03),
                    false)
            end
        end
    end
}

-- @region: ragebot
local rage = {}
rage.data = {}

rage.fix_ang = function(angles)
    while angles.pitch < -180.0 do
        angles.pitch = angles.pitch + 360.0
    end
    while angles.pitch > 180.0 do
        angles.pitch = angles.pitch - 360.0
    end

    while angles.yaw < -180.0 do
        angles.yaw = angles.yaw + 360.0
    end
    while angles.yaw > 180.0 do
        angles.yaw = angles.yaw - 360.0
    end

    if angles.pitch > 89.0 then
        angles.pitch = 89.0
    elseif angles.pitch < -89.0 then
        angles.pitch = -89.0
    end
    if angles.yaw > 180.0 then
        angles.yaw = 180.0
    elseif angles.pitch < -180.0 then
        angles.pitch = -180.0
    end

    return angles
end

rage.vec_ang = function(src, dist)
    local forward = dist - src

    if forward.x == 0 and forward.y == 0 then
        local yaw = 0

        if forward.z > 0 then
            pitch = 270
        else
            pitch = 90
        end

    else
        yaw = (math.atan2(forward.y, forward.x) * 180 / math.pi)
        if yaw < 0 then
            yaw = yaw + 360
        end

        tmp = math.sqrt(forward.x * forward.x + forward.y * forward.y)
        pitch = (math.atan2(-forward.z, tmp) * 180 / math.pi)

        if pitch < 0 then
            pitch = pitch + 360
        end

    end

    return rage.fix_ang(QAngle.new(pitch, yaw, 0))
end
rage.modify_velocity = function(cmd, goalspeed)
    local minspeed = math.sqrt((cmd.forwardmove * cmd.forwardmove) + (cmd.sidemove * cmd.sidemove))
    if goalspeed <= 0 or minspeed <= 0 then
        return
    end

    if EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') >= 1 then
        goalspeed = goalspeed * 2.94117647
    end

    if minspeed <= goalspeed then
        return
    end

    local speedfactor = goalspeed / minspeed
    cmd.forwardmove = cmd.forwardmove * speedfactor
    cmd.sidemove = cmd.sidemove * speedfactor
end
rage.roundStarted = 0
rage.player_info_prev = {}
for i = 1, 64 do
    rage.player_info_prev[i] = {
        origin = Vector.new(0, 0, 0),
    }
end


local baim = ui.refs.bodyaim:Get()

rage.baim = function()

    if not ui.ragebot.ragebot_enable:Get() and ui.ragebot.bodyaims:Get() then return end
    local all_players = EntityList.GetEntitiesByName("CCSPlayer")
    for i = 1, #all_players do
        local target = all_players[i]:GetPlayer()
        if target ~= EntityList.GetLocalPlayer() and not target:IsTeamMate() and target:GetProp("m_iHealth") > 0 then

        local me = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        local weap = target:GetActiveWeapon()

        local hp = target:GetProp('m_iHealth')
            if ui.ragebot.baimmode:Get() == 0 then
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 1 then
                ui.refs.bodyaim:SetInt(1)
            else
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 2 then
                ui.refs.bodyaim:SetInt(2)
            else
                ui.refs.bodyaim:SetInt(baim)
            end

        end
    end

end

rage.hitchances = function()

    local accepted_weapons = {
        ["261"] = 1,
        ["242"] = 1,
    }
    local accepted_weapons2 = {
        ["267"] = 1,
        ["46"] = 1,
    }

    local get_enemies = function()
        local ret = {}
        local players = EntityList.GetPlayers()
        for _ , player in pairs(players) do     
            if player:IsTeamMate() or not player:IsAlive() or player:IsDormant() then goto s end

            ret[#ret+1] = player:EntIndex()
            ::s::
        end

        return ret
    end

    if not ui.ragebot.ragebot_enable or ui.ragebot.hitchances == 0 then return end
  
    local i = get_enemies()
    local air_check = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1) == 0 and ui.ragebot.hitchances:Get(1) and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons2[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]
    local wpn_check = ui.ragebot.hitchances:Get(2) and EntityList.GetLocalPlayer():GetProp("m_bIsScoped")==false and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]

    if (not air_check and not wpn_check)  then return end

    for k,v in pairs(i) do
        RageBot.OverrideHitchance(v , (air_check==1 and ui.ragebot.air_hitchance:Get() or ui.ragebot.noscope_hitchance:Get()))
    end
end

rage.ragebot = function(cmd)
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer or not localplayer:IsAlive() then
        return
    end

    if not ui.ragebot.ragebot_enable:Get() or not ui.ragebot.override_doubletap:Get() then return end

    if ui.ragebot.override_doubletap:Get() then
        Exploits.OverrideDoubleTapSpeed(ui.ragebot.doubletap_speed:Get()) 
    end

    if ui.ragebot.doubletap_recharge:Get() then
        Exploits.ForceCharge()
    end

end

rage.dormant_aim = function(cmd)
    if ui.ragebot.dormant_aimbot:GetBool() then
        local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        if lp == nil then return end
        rage.can_hit_i = false
        rage.choke = false
        local ent = lp:GetActiveWeapon()
        if not ent then return end
        local inaccuracy = 1 / ent:GetInaccuracy(ent)
        if inaccuracy == nil then return end
        local tickcount = GlobalVars.tickcount
        local eyepos = lp:GetEyePosition()
        local simtime = lp:GetProp('m_flSimulationTime')
        local weapon = ent:GetWeaponID()
        local scoped = lp:GetProp('m_bIsScoped')
  
        local onground = bit.band(lp:GetProp('m_fFlags'), bit.lshift(1, 0))
        if tickcount < rage.roundStarted then return end -- to prevent shooting at ghost dormant esp @ the beginning of round
        local is_AWP = weapon == 9
        local is_auto = (weapon == 38 or weapon == 11)
        local is_scout = weapon == 40
        if ent:IsKnife() or ent:IsGrenade() or ent:IsReloading() or weapon == 31 then return end
        local hs_fix = ui.refs.hideshots:GetBool() and 0.3 or 0
        if weapon == 64 then -- for some reason can_shoot returns always false with r8 despite all 3 props being true, no idea why
            rage.can_shoot = simtime > ent:GetProp('m_flNextPrimaryAttack') + hs_fix -- doing this fixes it ><
        elseif ent:IsPistol() and not weapon == 64 and not weapon == 1 then
            rage.can_shoot = false
        else
            rage.can_shoot = simtime > math.max(lp:GetProp('m_flNextAttack') + hs_fix, ent:GetProp('m_flNextPrimaryAttack') + hs_fix, ent:GetProp('m_flNextSecondaryAttack'))
        end
  
        -- new player info
        local players = EntityList.GetEntitiesByName('CCSPlayer')
        rage.player_info = {}
        for i = 1, #players do
            local player = players[i]:GetPlayer()
            if EngineClient.IsConnected() and lp:IsAlive() then
                --if plist_get(player, 'Add to whitelist') then goto skip end
                if player:IsDormant() and not player:IsTeamMate() and player:GetProp('m_iHealth') > 0 and player ~= lp then
                    if player:GetRenderOrigin():Length2D() > ent:GetWeaponRange() then return end
                    rage.origin = player:GetProp('m_vecOrigin')
                    rage.alpha_multiplier = player:GetESPAlpha() -- grab alpha of the dormant esp
                    if rage.player_info_prev[i] ~= nil and rage.origin.x ~= 0 and rage.alpha_multiplier > 0 then -- if origin / dormant esp is valid
                        local dormant_accurate = rage.alpha_multiplier > 0.1 -- for debug purposes lower this to 0.1
                        if dormant_accurate then
                            local target_points = {
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 28) or Vector.new(0, 0, 38)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 30) or Vector.new(0, 0, 40)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 32) or Vector.new(0, 0, 42)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 40) or Vector.new(0, 0, 50))
                            }
                      
                            for i = 1, #target_points do
                                local target = target_points[i]
                                local target_pos = rage.vec_ang(eyepos, target)
                                local dmg = Cheat.FireBullet(lp, eyepos, target)
                                if is_AWP then
                                    max_player_speed_alt = 100
                                elseif is_auto then
                                    max_player_speed_alt = 120
                                else
                                    max_player_speed_alt = ent:GetMaxSpeed() * 0.86
                                end
                                rage.can_hit = (dmg.trace.hit_entity == nil or dmg.trace.hit_entity:EntIndex() == player:EntIndex()) and (dmg.damage > ui.ragebot.dormant_aimbot_damage:GetInt()) and (not player:IsVisible(target)) -- added visibility check to mitigate shooting at anomalies?
                              
                                if rage.can_hit then
                                    rage.can_hit_i = true
                                    if rage.can_shoot then
                                        rage.modify_velocity(cmd, (scoped and max_player_speed_alt or ent:GetMaxSpeed())*0.2)
                                        -- autoscope
                                        if not scoped and ent:IsSniper() and onground == 1 then
                                            cmd.buttons = bit.bor(cmd.buttons, 2048)
                                        end
                                    end
                                  
                                    if ui.refs.hideshots:GetBool() then
                                        rage.choke = rage.can_shoot
                                    else
                                        rage.choke = true
                                    end
                                  
                                    if inaccuracy >= 90 and rage.choke == true then
                                        cmd.viewangles.pitch = target_pos.pitch
                                        cmd.viewangles.yaw = target_pos.yaw
                                        cmd.viewangles.roll = 0
                                        cmd.buttons = bit.bor(cmd.buttons, 1)
                                        -- dont shoot again
                                        rage.can_shoot = false
                                    end
                                end
                            end
                        end
                    end
                    rage.player_info[i] = {rage.origin, rage.alpha_multiplier, rage.can_hit_i}
                end
            end
        end
        rage.player_info_prev = rage.player_info
    end
end

rage.resetter = function(event)
    if not ui.ragebot.dormant_aimbot:Get() then return end
    if event:GetName() ~= 'round_prestart' then return end
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
    if lp == nil then return end
    freezetime = (CVar.FindVar('mp_freezetime'):GetFloat()+1) / GlobalVars.interval_per_tick -- get freezetime plus 1 second and disable dormantbob for that amount of ticks
    rage.roundStarted = GlobalVars.tickcount + freezetime
    rage.origin = nil
    rage.player_info_prev = {}
    for i = 1, 64 do
        rage.player_info_prev[i] = {
            origin = Vector.new(0, 0, 0),
        }
    end
    rage.player_info = {}
end

rage.on_registered_shot = function(shot)
    if shot.reason ~= 1 then return end
  
    if not rage.data[shot.target_index] then
        rage.data[shot.target_index] = {
            esp_bool = false,
            shots = 0,
        }
    end

    rage.data[shot.target_index].shots = rage.data[shot.target_index].shots + 1
end

rage.on_prediction = function()
    if not ui.ragebot.maxmissed:Get() and ui.ragebot.ragebot_enable:Get() then return end
  
    for player_index, data in pairs(rage.data) do
        if data.shots >= ui.ragebot.maxmissed_c:Get() then
            data.esp_bool = true

            RageBot.EnableHitbox(player_index, 0, false)
        end
    end
end

rage.reset_data = function(event)
    if event:GetName() ~= 'round_start' then return end
  
    rage.data = {}
end

-- @endregion

-- @region: misc
local misc = {}
misc.slowwalk = function(cmd)
    if not ui.misc.slowwalk_c:GetBool() then return end
        if cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.forwardmove < 0 and -cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = -ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove < 0 and -cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = -ui.misc.slowwalk_slider:GetInt() end
end

local clantag_restore = false
-- clantag
misc.clantag = function()
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer then return end

    if ui.misc.clantag:Get() and ui.misc.misc_enable:Get() then
        local tag =
        {
            "ps",
            "psy",
            "psyc",
            "psych ",
            "psycho",
            "psycho ",
            "psych",
            "psyc",
            "psy",
            "ps",
            "p",
            "",

        }

        local netchann_info = EngineClient.GetNetChannelInfo()

        if netchann_info == nil then
            return
        end

        local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
        local tickcount_pred = GlobalVars.tickcount + latency
        local iter = math.floor(math.fmod(tickcount_pred / 32, #tag) + 1)
      
        helpers:set_clantag(tag[iter])
        clantag_restore = false

    elseif not clantag_restore then
        helpers:set_clantag("") 
    end
end

local t = {}
misc.removeimpact = function()
    if #t == nil then
        return
    end

    if not EngineClient.IsConnected() then
        table.remove(t, #t)
        return
    end

    for i = 1, #t do
        if t[i] == nil then
            return
        end

        if t[i].ctime + 4 > math.floor(GlobalVars.curtime) then
            return
        end

        t[i].a = t[i].a - math.floor(GlobalVars.frametime * 300)

        if t[i].a < 0 then
            table.remove(t, i)
        end
    end
end
-- @endregion

-- @region: anti-aims
local anti_aims = {}
local flag_status = 0

AntiAim.jitter = {}
AntiAim.jitter.c_var = {
    choke = 0,
    yaw_v = 0,
    yaw_r = 1,
    byaw_v = 0,
    byaw_r = 1,
    fyaw_v = 0,
    fyaw_r = 0
}

AntiAim.c_var = {
    c = 1,
    ground_ticks = 0,
    step_ticks = 0,
    min = 0,
    max = 0,
    step = 0,
    return_value = 0,
    bodystep_ticks = 0,
    bodystep_min = 0,
    bodystep_max = 0,
    bodystep_step = 0,
    bodystep_return_value = 0
}

AntiAim.save_antiaims = {
    pitch = "Off",
    yaw_base = "Local view",
    yaw_1 = "Off",
    yaw_2 = 0,
    yaw_jitter_1 = "Off",
    yaw_jitter_2 = 0,
    body_yaw_1 = "Off",
    body_yaw_2 = 0,
    fake_yaw_limit = 0,
    freestanding_body_yaw = false
}

function AntiAim.jitter:tick(a,b)
    return GlobalVars.tickcount % 4 >= 2 and a or b
end

function AntiAim.jitter:choke_yaw(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.yaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.yaw_r = AntiAim.jitter.c_var.yaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.yaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
  
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end

function AntiAim.jitter:normalize_yaw(p)
    while p > 180 do
        p = p - 360
    end
    while p < -180 do
        p = p + 360
    end
    return p
end

function AntiAim.jitter:choke_body_yaw(a,b)
    local inverted = AntiAim.GetInverterState()
    local invert = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return invert and a or b
    end
end

function AntiAim.jitter:choke_fake(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.fyaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.fyaw_r = AntiAim.jitter.c_var.fyaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.fyaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
  
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end
local start_time = GlobalVars.curtime

local function get_tick()
    local end_time = GlobalVars.curtime
    local get_time = math.abs(math.floor((start_time - end_time) * 100)) % 2
    return get_time
end

function AntiAim.jitter:desync(a,b)
    local inverted = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return inverted and a or b
    end
end

clamp = function(value, minimum, maximum)
    if minimum > maximum then
        return math.min(math.max(value, maximum), minimum)
    else
        return math.min(math.max(value, minimum), maximum)
    end
end

AntiAim.side = 1
AntiAim.override_yaw = function(cmd, yaw_add, jitter_value, jitter_type)
    if FakeLag.SentPackets() ~= 0 then
        AntiAim.side = AntiAim.side * -1
    end
  
    local yaw_modifier = yaw_add
  
    if jitter_type == 1 then
        yaw_modifier = yaw_modifier+(jitter_value/2)*AntiAim.side
    elseif jitter_type == 2 then
        yaw_modifier = yaw_modifier+jitter_value*((AntiAim.side+1)/2)
    elseif jitter_type == 3 then
        yaw_modifier = math.random(-jitter_value,jitter_value)
    elseif jitter_type == 4 then
        yaw_modifier = yaw_modifier-(GlobalVars.tickcount*3)%jitter_value
    end

    return yaw_modifier
end

function AntiAim:run_custom(cmd)
    if EntityList.GetLocalPlayer() == nil or not ui.anti_aims.antiaim_enable:GetBool() then
        return
    end
    local p_duck = EntityList.GetLocalPlayer():GetProp("m_flDuckAmount")
    local inair = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags" ), 1 ) == 0
    local on_ground = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1)
    local vx, vy, vz = EntityList.GetLocalPlayer():GetProp("m_vecVelocity").x, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").y, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").z
    local p_still = math.sqrt(vx ^ 2 + vy ^ 2)
    local p_slow = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk')

    AntiAim.jitter.c_var.choke = ClientState.m_choked_commands
    local m = ui.anti_aims.custom
    AntiAim.save_antiaims.yaw_1 = "180"

    if on_ground == 1 then
        AntiAim.c_var.ground_ticks = AntiAim.c_var.ground_ticks + 1
    else
        AntiAim.c_var.ground_ticks = 0
    end
    if m[3].enable:Get() and p_slow then
        AntiAim.c_var.c = 3
    elseif inair and m[6].enable:Get() and EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') > 0.7 then
        AntiAim.c_var.c = 6
    elseif inair and m[5].enable:Get() then
        AntiAim.c_var.c = 5
    elseif p_duck > 0.8 and not inair and AntiAim.c_var.ground_ticks > 8 and m[4].enable:Get() then
        AntiAim.c_var.c = 4
    elseif p_still > 70 and AntiAim.c_var.ground_ticks > 8 and m[2].enable:Get() then
        AntiAim.c_var.c = 2
    elseif p_still < 2 and  AntiAim.c_var.ground_ticks > 8 and m[1].enable:Get() then
        AntiAim.c_var.c = 1
    else
        AntiAim.c_var.c = 5
    end
    AntiAim.save_antiaims.yaw_base = "At targets"
    AntiAim.save_antiaims.yaw_1 = "180"
    AntiAim.save_antiaims.pitch = 1

    if AntiAim.c_var.c == 1 and m[1].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 2 and m[2].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 3 and m[3].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 24
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 4 and m[4].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 35
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 5 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 15
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 6 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 17
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    else
        AntiAim.c_var.max = m[AntiAim.c_var.c].step_fake_max:Get()
        AntiAim.c_var.min = m[AntiAim.c_var.c].step_fake_min:Get()
        AntiAim.c_var.step = m[AntiAim.c_var.c].step_value:Get()
        AntiAim.c_var.step_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].step_ticks:Get()

        if m[AntiAim.c_var.c].step_fake_min:Get() >= m[AntiAim.c_var.c].step_fake_max:Get()then
            m[AntiAim.c_var.c].step_fake_min:Set(m[AntiAim.c_var.c].step_fake_max:Get())
        end

        if AntiAim.c_var.step_ticks == m[AntiAim.c_var.c].step_ticks:Get() - 1 then
            if AntiAim.c_var.return_value < AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.return_value + m[AntiAim.c_var.c].step_value:Get()
            elseif AntiAim.c_var.return_value >= AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.min
            end
        end

        AntiAim.c_var.bodystep_max = m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get()
        AntiAim.c_var.bodystep_min = m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get()
        AntiAim.c_var.bodystep_step = m[AntiAim.c_var.c].body_yaw_step_value:Get()
        AntiAim.c_var.bodystep_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].body_yaw_step_ticks:Get()

        if m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get() >= m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get() then
            m[AntiAim.c_var.c].step_bodyyaw_degree_left:Set(m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get())
          
        end
        if AntiAim.c_var.bodystep_ticks == m[AntiAim.c_var.c].body_yaw_step_ticks:Get() - 1 then
            if AntiAim.c_var.bodystep_return_value < AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_return_value + AntiAim.c_var.bodystep_step
            elseif AntiAim.c_var.bodystep_return_value >= AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_min
            end
        end

        if m[AntiAim.c_var.c].yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.yaw_2 = m[AntiAim.c_var.c].static_yaw:Get()
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:tick(m[AntiAim.c_var.c].tick_yaw_left:Get(),m[AntiAim.c_var.c].tick_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 2 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:choke_yaw(m[AntiAim.c_var.c].choke_yaw_left:Get(),m[AntiAim.c_var.c].choke_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 3 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:desync(m[AntiAim.c_var.c].desync_yaw_left:Get(),m[AntiAim.c_var.c].desync_yaw_right:Get())
        end

        if m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 1 then
            if m[AntiAim.c_var.c].yaw_jitter_degree:Get() >= m[AntiAim.c_var.c].yaw_jitter_degree2:Get() then
                m[AntiAim.c_var.c].yaw_jitter_degree:Set(m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
            end
        end

        AntiAim.save_antiaims.yaw_jitter_1 = m[AntiAim.c_var.c].yaw_jitter:Get()
        AntiAim.save_antiaims.yaw_jitter_2 = m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 0 and m[AntiAim.c_var.c].yaw_jitter_degree:Get() or math.random(m[AntiAim.c_var.c].yaw_jitter_degree:Get(), m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
        AntiAim.save_antiaims.body_yaw_1 = m[AntiAim.c_var.c].self_bodyyaw_mode:Get()

        if m[AntiAim.c_var.c].bodyyaw_mode:Get() == 1 then
            AntiAim.save_antiaims.body_yaw_2 = m[AntiAim.c_var.c].bodyyaw_degree:Get()
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 2 then
            AntiAim.save_antiaims.body_yaw_2 = AntiAim.jitter:choke_body_yaw(m[AntiAim.c_var.c].jitter_bodyyaw_degree_left:Get(), m[AntiAim.c_var.c].jitter_bodyyaw_degree_right:Get())
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 3 then
            AntiAim.save_antiaims.body_yaw_2 = clamp(AntiAim.c_var.bodystep_return_value, AntiAim.c_var.bodystep_min, AntiAim.c_var.bodystep_max)
        end

        if m[AntiAim.c_var.c].fake_yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.fake_yaw_limit = m[AntiAim.c_var.c].static_fakeyaw:Get()
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.fake_yaw_limit = AntiAim.jitter:choke_fake(m[AntiAim.c_var.c].jitter_fakeyaw_left:Get(),m[AntiAim.c_var.c].jitter_fakeyaw_right:Get())
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 2 then
            if m[AntiAim.c_var.c].step_abs:Get() then
                AntiAim.save_antiaims.fake_yaw_limit = math.abs(clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max))
            else
                AntiAim.save_antiaims.fake_yaw_limit = clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max)
            end
        end
        AntiAim.save_antiaims.freestanding_body_yaw = m[AntiAim.c_var.c].freestanding_bodyyaw:Get()
    end
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Pitch'):Set(AntiAim.save_antiaims.pitch)

    AntiAim.OverrideYawOffset(AntiAim.override_yaw(cmd, AntiAim.save_antiaims.yaw_2, AntiAim.save_antiaims.yaw_jitter_2, AntiAim.save_antiaims.yaw_jitter_1))
    AntiAim.OverrideLimit(AntiAim.save_antiaims.fake_yaw_limit)

    if AntiAim.save_antiaims.body_yaw_1 == 0 then -- off
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 1 then -- opposite
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 2 then -- jitter
        AntiAim.OverrideInverter(AntiAim.side ~= 1)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
    else -- static
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Set(2, false)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
    end
  
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Add'):Set(0)
  
    Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Freestanding Desync'):Set(AntiAim.save_antiaims.freestanding_body_yaw and 1 or 0)
end

vector_lerp = function(vecSource, vecDestination, flPercentage) return vecSource + (vecDestination - vecSource) * flPercentage end
anti_aims.vecnew = Vector.new()
anti_aims.edge_yaw = function()
    if not ui.anti_aims.antiaim_enable:Get() then return end
    if ui.anti_aims.antiaim_helpers:Get(5) then
        local local_player = EntityList.GetLocalPlayer()
        if local_player == nil then return end
        local flag = EntityList.GetLocalPlayer():GetProp("m_fFlags")
        if (flag == 256 or flag == 262) then -- air
            return
        end
        --if local_player:GetState() == 'Air' then return end
        if ClientState.m_choked_commands == 0 then
            anti_aims.vecnew = local_player:GetEyePosition()
        end
        local trace_end = {}
        local ang_view_angles = EngineClient.GetViewAngles()
        for yaww = 18, 360, 18 do
            local yaww = normalize_yaw(yaww)
            local edge_angle = QAngle.new(0, yaww, 0)
            local vec_trace_end = anti_aims.vecnew + Cheat.AngleToForward(edge_angle) * 0x60
            local traceInfo = EngineTrace.TraceRay(anti_aims.vecnew, vec_trace_end, local_player, 0x200400B)
            if traceInfo.hit_entity and traceInfo.hit_entity:GetClassName() == 'CWorld' and traceInfo.fraction < 0.3 then
                trace_end[#trace_end + 1] = {
                    vec_trace_end = traceInfo.endpos,
                    yaww = yaww
                }
            end
        end
        table.sort(trace_end, function(a, b)
            return a.yaww < b.yaww
        end)
        local edge_angle
        if #trace_end >= 2 then
            local vec_trace_center = vector_lerp(trace_end[1].vec_trace_end, trace_end[#trace_end].vec_trace_end, 0.5)
            edge_angle = Cheat.VectorToAngle(anti_aims.vecnew - vec_trace_center)
        end

        if edge_angle then
            local yaww = ang_view_angles.yaw
            local edgee_yaw = edge_angle.yaw
            local difff = normalize_yaw(edgee_yaw - yaww)
            if math.abs(difff) < 90 then
                difff = 0
                yaww = normalize_yaw(edgee_yaw + 180)
            end
            local new_yaw = -yaww
            new_yaw = normalize_yaw(new_yaw + edgee_yaw + 180)
            new_yaw = normalize_yaw(new_yaw + difff)
            AntiAim.OverrideYawOffset(new_yaw)
        end
    end
end

anti_aims.avoid_backstab = function()
    if ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(4) then
        local all_players = EntityList.GetEntitiesByName('CCSPlayer')
        for i = 1, #all_players do
            local enemy = all_players[i]:GetPlayer()
            if enemy ~= EntityList.GetLocalPlayer() and not enemy:IsTeamMate() and not enemy:IsDormant() and enemy:IsAlive() and enemy:GetActiveWeapon() ~= nil and enemy:GetActiveWeapon():IsKnife() then
                if EntityList.GetLocalPlayer():GetRenderOrigin():DistTo(enemy:GetProp('m_vecOrigin')) <= 300 then
                    AntiAim.OverrideYawOffset(180)
                end
            end
        end
    end
end

anti_aims.antiaim_helpers = function()

    if not ui.anti_aims.antiaim_enable:Get() then return end

        if ui.anti_aims.antiaim_helpers:Get(1) then

            if ui.refs.hideshots:Get() then
                    ui.refs.fakelags:Set(false)
                else
                    ui.refs.fakelags:Set(true)
            end
        end
end

anti_aims.disable_aa_warmup = function()

    local warmup_period = EntityList.GetGameRules():GetProp("m_bWarmupPeriod")

    if  ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(3) then

        if warmup_period == true then
            ui.refs.antiaim:Set(false)
        else
            ui.refs.antiaim:Set(true)
        end

    end

end

anti_aims.exploit_teleport = function()
    if ui.ragebot.tp_in_air:Get() ~= 0 and ui.anti_aims.antiaim_enable:Get() and ui.refs.doubletap:Get() and ui.ragebot.Teleport_In_Air:Get() then
        local allow_teleport = false
        local enable_teleport = false

        local active_weapon = EntityList.GetLocalPlayer():GetActiveWeapon()
        if active_weapon == nil then return end
        local weapon_id = active_weapon:GetWeaponID()

        local guns = {
            is_AWP = weapon_id == 9,
            is_auto = (weapon_id == 38 or weapon_id == 11),
            is_scout = weapon_id == 40,
            is_deagle = weapon_id == 1,
            is_r8 = weapon_id == 64,
            is_nades = active_weapon:IsGrenade(),
            is_pistols = active_weapon:IsPistol() and not is_deagle and not is_r8,
            is_smg = (weapon_id == 34 or weapon_id == 23 or weapon_id == 24 or weapon_id == 19 or weapon_id == 26 or weapon_id == 33 or weapon_id == 17),
            is_shotguns = (weapon_id == 35 or weapon_id == 25 or weapon_id == 27 or weapon_id == 29),
            is_rifle = active_weapon:IsRifle() and not is_smg and not is_shotguns,
            is_taser = weapon_id == 31,
        }
      
        for _, weapons in pairs({
            {Value = 1, active_weapon = guns.is_AWP},
            {Value = 2, active_weapon = guns.is_auto},
            {Value = 3, active_weapon = guns.is_scout},
            {Value = 4, active_weapon = guns.is_deagle},
            {Value = 5, active_weapon = guns.is_r8},
            {Value = 6, active_weapon = guns.is_nades},
            {Value = 7, active_weapon = not (guns.is_AWP or guns.is_auto or guns.is_scout or guns.is_deagle or guns.is_r8 or guns.is_nades or guns.is_pistols or guns.is_rifle or guns.is_smg or guns.is_shotguns or guns.is_taser)},
            {Value = 8, active_weapon = guns.is_pistols},
            {Value = 9, active_weapon = guns.is_rifle},
            {Value = 10, active_weapon = guns.is_smg},
            {Value = 11, active_weapon = guns.is_shotguns},
            {Value = 12, active_weapon = guns.is_taser}
        }) do
            if ui.ragebot.tp_in_air:Get(weapons.Value) and weapons.active_weapon then
                allow_teleport = true
            end
        end

        if allow_teleport then
            all_players = EntityList.GetEntitiesByName('CCSPlayer')
            for i = 1, #all_players do
                enemy = all_players[i]:GetPlayer()
                if not enemy:IsTeamMate() and enemy:IsAlive() and not enemy:IsDormant() and enemy:CanHit() then
                    enable_teleport = true
                end
            end
        end
      
        if enable_teleport and not EntityList.GetLocalPlayer():GetFlag(0) and EntityList.GetLocalPlayer():GetVelocity() > 25 then
            Exploits.ForceTeleport()
        end
    end
end

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

ffi_functions.get_entity_address = function(entity_index)
    local addr = ffi_functions.GET_CLIENT_ENTITY_FN(ffi_functions.ENTITY_LIST_POINTER, entity_index)
    return addr
end

ffi_functions.hook = {hooks = {}}
ffi_functions.hook.new = function(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(ffi_functions.hook.hooks, new_hook)
    return setmetatable(new_hook, mt)
end

anti_aims.is_jumping = false
anti_aims.ground_ticks, anti_aims.end_time = 1, 0
anti_aims.updateCSA_hk = function(thisptr, edx)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if localplayer == nil then return anti_aims.updateCSA_fn(thisptr, edx) end
    local lp_ptr = ffi_functions.get_entity_address(EngineClient.GetLocalPlayer())

    if ui.anti_aims.animbreakers:Get(1) then ui.refs.legs:Set(1) end

    if ui.anti_aims.animbreakers:Get() == 0 or not ui.anti_aims.antiaim_enable:Get() then anti_aims.updateCSA_fn(thisptr, edx) return end

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end

    if ui.anti_aims.animbreakers:Get(2) then
        ffi.cast('float*' , lp_ptr+10104)[0] = 1
    end

    if ui.anti_aims.animbreakers:Get(3) then
        ffi.cast('float*' , lp_ptr+10104)[12] = 0
    end

    anti_aims.updateCSA_fn(thisptr, edx)

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end
  
    if ui.anti_aims.animbreakers:Get(3) then
        if bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), 1) == 1 then
            anti_aims.ground_ticks = anti_aims.ground_ticks + 1
        else
            anti_aims.ground_ticks = 0
            anti_aims.end_time = GlobalVars.curtime + 1
        end
        if not anti_aims.is_jumping and anti_aims.ground_ticks > 1 and anti_aims.end_time > GlobalVars.curtime then
            ffi.cast('float*' , lp_ptr+10104)[12] = 0.5
        end
    end
end

Cheat.RegisterCallback('destroy', function()
    for i, v in ipairs(ffi_functions.hook.hooks) do
        if v.status then
            v.stop()
        end
    end
end)

anti_aims.updateCSA_fn = ffi_functions.hook.new('void(__fastcall*)(void*, void*)', anti_aims.updateCSA_hk, ffi.cast('uintptr_t', Utils.PatternScan('client.dll', '8B F1 80 BE ? ? ? ? ? 74 36', -5))) or error("updateCSA_fn can't hook")
-- @endregion

local draggable = {}
function draggable:new(name, size, init_pos)
    local drag = {}
    local init_pos = init_pos or Vector2.new(100, 100)
    drag.size = size
    drag.x = Menu.SliderInt('Visuals', "draggable elements", name .. "_x", init_pos.x, 0, globals.screen_size.x)
    drag.y = Menu.SliderInt('Visuals', "draggable elements", name .. "_y", init_pos.y, 0, globals.screen_size.y)
    drag.x:SetVisible(false)
    drag.y:SetVisible(false)
    drag.captured = false
    drag.clicked = false
    drag.mouse_offset = Vector2.new(0, 0)

    setmetatable(drag, self)
    self.__index = self
  
    return drag
end

function draggable:get()
    return Vector2.new(self.x:Get(), self.y:Get())
end

function draggable:update()
    if not Cheat.IsMenuVisible() then
        return
    end

    local mouse_pos = Cheat.GetMousePos()
    local mouse_hold = Cheat.IsKeyDown(1)

    if not self.clicked and mouse_hold then
        self.clicked = true
        if not self.captured and mouse_hold and helpers:mouse_in_bounds(self:get(), self:get() + self.size) then
            self.captured = true
            self.mouse_offset = mouse_pos - self:get()
        end
    end

    if not mouse_hold then
        self.captured = false
        self.clicked = false
    end

    if self.captured then
        self.x:Set(mouse_pos.x - self.mouse_offset.x)
        self.y:Set(mouse_pos.y - self.mouse_offset.y)
    end
end

function draggable:set_size(size)
    self.size = size
end

-- @region: widgets
local indicators = {}
indicators.on_plant_time, indicators.fill, indicators.planting_site, indicators.planting = 0, 0, '', false
indicators.Render_Shadow = function(start_pos, endpos, color)
    Render.GradientBoxFilled(start_pos, Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), endpos.y), Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color)
    Render.GradientBoxFilled(Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), start_pos.y), endpos, color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0))
end

indicators.contains = function(table, val)
    for i=1, #table do
        if table[i] == val then
            return true
        end
    end
    return false
end

indicators.clear_planting_info = function()
    planting = false
    fill = 0
    on_plant_time = 0
    planting_site = ''
end

indicators.bomb = function(event)
    typese = {
        'bomb_abortplant', 'bomb_defused', 'bomb_planted', 'round_prestart'
    }
  
    if indicators.contains(typese, event:GetName()) then indicators.clear_planting_info() end
  
    if event:GetName() == 'bomb_beginplant' then
        on_plant_time = GlobalVars.curtime
        planting = true
        bombsite = event:GetInt('site');
        APlants = (454 or 372 or 102 or 276 or 174 or 121 or 301 or 142 or 408 or 97 or 213 or 216)
        if bombsite == APlants then
            planting_site = 'Bombsite A'
        else
            planting_site = 'Bombsite B'
        end
    end
end

indicators.Render_Indicator = function(text, col, cur)
    local position = Vector2.new(20, (globals.screen_size.y / 1.55) + (39 * cur))
    local positionS = Vector2.new(21, (globals.screen_size.y / 1.55 + 1) + (39 * cur))
    local textsize = Render.CalcTextSize(text, 24, fonts.calibrib24)

    indicators.Render_Shadow(Vector2.new(position.x - 10, position.y - 7), Vector2.new(position.x + textsize.x - 10, position.y + textsize.y + 2), Color.RGBA(0, 0, 0, 56 * col.a))

    Render.Text(text, positionS, Color.RGBA(33, 33, 33, 127 * col.a), 24, fonts.calibrib24)
    Render.Text(text, position, col, 24, fonts.calibrib24)
end

widgets = {
    create_window = function(self, s, e, alpha)
        local color = helpers:copy_color(ui.visuals.theme:Get())
        local background_color = Color.new(0, 0, 0, alpha * ui.visuals.theme:Get().a)
        local border_color1 = helpers:alpha_modulate(color, alpha)
        local border_color2 = helpers:alpha_modulate(color, alpha * 0.4)

        Render.Blur(s, e, Color.new(1 - background_color.a, 1 - background_color.a, 1 - background_color.a, alpha), 5)

        if not ui.visuals.disable_blur:Get() then
        Render.Box(s - Vector2.new(6, 6), e + Vector2.new(6, 6), helpers:alpha_modulate(border_color1, alpha * 0.02), 5)
        Render.Box(s - Vector2.new(5, 5), e + Vector2.new(5, 5), helpers:alpha_modulate(border_color1, alpha * 0.03), 5)
        Render.Box(s - Vector2.new(4, 4), e + Vector2.new(4, 4), helpers:alpha_modulate(border_color1, alpha * 0.04), 5)
        Render.Box(s - Vector2.new(3, 3), e + Vector2.new(3, 3), helpers:alpha_modulate(border_color1, alpha * 0.08), 5)
        Render.Box(s - Vector2.new(2, 2), e + Vector2.new(2, 2), helpers:alpha_modulate(border_color1, alpha * 0.13), 5)
        Render.Box(s - Vector2.new(1, 1), e + Vector2.new(1, 1), helpers:alpha_modulate(border_color1, alpha * 0.20), 5)
        end
      
        Render.BoxFilled(s + Vector2.new(5, 0), Vector2.new(e.x - 5, s.y + 1), border_color1)
        Render.BoxFilled(Vector2.new(s.x + 5, e.y - 1), e - Vector2.new(5, 0), border_color2)
        Render.GradientBoxFilled(Vector2.new(s.x, s.y + 5), Vector2.new(s.x + 1, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.GradientBoxFilled(Vector2.new(e.x - 1, s.y + 5), Vector2.new(e.x, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.Circle(s + Vector2.new(5, 5), 5, 8, border_color1, 1, -90, -180)
        Render.Circle(Vector2.new(s.x + 5, e.y - 5), 5, 8, border_color2, 1, 90, 180)
        Render.Circle(e - Vector2.new(5, 5), 5, 8, border_color2, 1, 0, 90)
        Render.Circle(Vector2.new(e.x - 5, s.y + 5), 5, 8, border_color1, 1, -90, 0)
    end,

    keybinds = {
        anims = {},
        drag = draggable:new("keybinds", Vector2.new(150, 20)),
        size = 100,
        alpha = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(1) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local bind_list = Cheat.GetBinds()
            local render_list = {}
            local opened = Cheat.IsMenuVisible()
            local render_offset = 0
            local raw_size = 100

            for _, bind in pairs(bind_list) do
                local bind_name = bind:GetName()
                if not self.anims[bind_name] then
                    self.anims[bind_name] = 0
                end

                self.anims[bind_name] = helpers:lerp(self.anims[bind_name], bind:IsActive() and 1 or 0)

                if bind:IsActive() then
                    opened = true
                end

                if self.anims[bind_name] > 0.01 then
                    local r_bind = {}

                    r_bind.name = bind_name:lower():gsub("^%l", string.upper)
                    r_bind.value = string.format("[%s]", bind:GetValue())
                    r_bind.alpha = self.anims[bind_name]
                    r_bind.offset = render_offset

                    if r_bind.value == "[on]" or r_bind.value == "[off]" then
                        r_bind.value = bind:GetMode() == 0 and "[toggled]" or "[hold]"
                    end

                    local name_size = Render.CalcTextSize(r_bind.name, 11, fonts.verdana).x + Render.CalcTextSize(r_bind.value, 11, fonts.verdana).x + 15

                    render_offset = render_offset + r_bind.alpha * 16
                    raw_size = math.max(raw_size, name_size)

                    table.insert(render_list, r_bind)
                end
            end

            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)
            self.size = helpers:lerp(self.size, raw_size)

            if self.alpha < 0.01 then
                return
            end
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
            helpers:text_shadow("keybinds", pos + Vector2.new(self.size, 20) / 2, Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)

            for _, r in pairs(render_list) do
                helpers:text_shadow(r.name, pos + Vector2.new(5, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
                helpers:text_shadow(r.value, pos + Vector2.new(self.size - 5 - Render.CalcTextSize(r.value, 11, fonts.verdana).x, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
            end
        end
    },
  
    spectators = {
        data = {},
        drag = draggable:new("spectators", Vector2.new(120, 20)),
        size = 100,
        alpha = 0,
        getsteamid64 = function(self, steamid)
            return string.sub(tostring(ffi.new("uint64_t", 76561197960265728) + ffi.new("uint64_t", steamid)), 1, -4)
        end,
        get_list = function(self)
            if not EntityList.GetLocalPlayer() then
                return {}, Cheat.IsMenuVisible()
            end

            local observe_target = EntityList.GetLocalPlayer()

            if EntityList.GetLocalPlayer():GetProp("m_iObserverMode") ~= 0 then
                local ent = EntityList.GetClientEntityFromHandle(EntityList.GetLocalPlayer():GetProp("m_hObserverTarget"))

                if ent and ent:IsPlayer() then
                    observe_target = ent:GetPlayer()
                end
            end

            if not observe_target then
                return {}, Cheat.IsMenuVisible()
            end

            local players = EntityList.GetPlayers()
            local rtn_list = {}
            local opened = Cheat.IsMenuVisible()

            for _, pl in pairs(players) do 
                if pl ~= EntityList.GetLocalPlayer() then
                    local name = pl:GetName()
                    local info = pl:GetPlayerInfo()
                    local steamid = self:getsteamid64(info.iSteamID)

                    if not self.data[steamid] then
                        if not info.fakeplayer then
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                            }

                            local player_data = self.data[steamid]

                            player_data.callback1 = function(content)
                                local parsed = json.parse(content).response
                                if not parsed then
                                    return
                                end
                                parsed = parsed.players[0]
                                if not parsed then
                                    return
                                end
                                Http.GetAsync(parsed.avatar, player_data.callback2)
                            end

                            player_data.callback2 = function(content)
                                player_data.avatar = Render.LoadImage(content, Vector2.new(32, 32))
                            end

                            Http.GetAsync("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=E8A1E59F9C119FA9BFB73F29C2A8A109&steamids=" .. steamid, player_data.callback1)
                        else
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                                avatar = globals.default_avatar,
                            }
                        end
                    end

                    local data = self.data[steamid]
                    local observer = EntityList.GetClientEntityFromHandle(pl:GetProp("m_hObserverTarget"))
                    local is_observer = (observer and observer:IsPlayer() and observer:GetPlayer() == observe_target)
              
                    if is_observer then
                        opened = true
                    end

                    data.alpha = helpers:lerp(data.alpha, is_observer and 1 or 0)

                    if data.alpha > 0.01 then
                        table.insert(rtn_list, data)
                    end
                end
            end

            return rtn_list, opened
        end,
        draw = function(self)
            if not ui.visuals.widgets:Get(2) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local render_offset = 0
            local raw_size = 100

            local list, opened = self:get_list()

            for _, data in pairs(list) do
                local reneder_pos = pos + Vector2.new(5, 23 + render_offset)

                if not data.avatar then return end
                Render.Image(data.avatar, reneder_pos, Vector2.new(16, 16), Color.new(1, 1, 1, data.alpha))
                helpers:text_shadow(data.name, reneder_pos + Vector2.new(21, 2), Color.new(1, 1, 1, data.alpha), 11, fonts.verdana)

                local size = 30 + Render.CalcTextSize(data.name, 11, fonts.verdana).x

                if size > raw_size then
                    raw_size = size
                end

                render_offset = render_offset + 18 * data.alpha
            end

            self.size = helpers:lerp(self.size, raw_size)
            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)

            if self.alpha > 0.01 then
                widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
                helpers:text_shadow("spectators", pos + Vector2.new(self.size / 2, 10), Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)
            end
        end,
    },

    watermark = {
        size = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(3) then
                return
            end

            local full_text = ""

            if ui.visuals.watermark_info:Get(1) then
                full_text = full_text .. " | " .. ui.visuals.custom_username:Get()
            end

            if ui.visuals.watermark_info:Get(2) then
                full_text = full_text .. " | " .. tostring(math.floor(helpers:get_fps())) .. " fps"
            end

            if ui.visuals.watermark_info:Get(3) then
                local net_channel = EngineClient.GetNetChannelInfo()
                local ping = 0

                if net_channel then
                    ping = net_channel:GetAvgLatency(0)
                end

                full_text = full_text .. " | delay: " .. tostring(math.floor(ping * 1000)) .. "ms"
            end

            if ui.visuals.watermark_info:Get(4) then
                full_text = full_text .. " | " .. tostring(math.floor(1 / GlobalVars.interval_per_tick + 0.5)) .. "tick"
            end

            if ui.visuals.watermark_info:Get(5) then
                full_text = full_text .. " | " .. helpers:get_time()
            end

            local size = Render.CalcTextSize("psycho" .. full_text, 11, fonts.verdana).x + 54
            self.size = helpers:lerp(self.size, size)

            local pos = Vector2.new(globals.screen_size.x - 10 - self.size, 10)
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), 1)
            pos = pos + Vector2.new(6, 3)

            helpers:text_shadow("psy", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("psy", 11, fonts.verdana).x
            helpers:text_shadow("cho", pos, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("cho", 11, fonts.verdana).x
            helpers:text_shadow(" [stable]", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize(" [stable]", 11, fonts.verdana).x
            helpers:text_shadow(full_text, pos, Color.new(1, 1, 1), 11, fonts.verdana)

        end
    },

    lua_panel = {
        drag = draggable:new("lua_panel", Vector2.new(170, 45), Vector2.new(100, globals.screen_size.y / 2 - 23)),
        draw = function(self)
            if not ui.visuals.widgets:Get(4) then
                return
            end

            self.drag:update()

            local pos = self.drag:get()

            widgets:create_window(pos, pos + Vector2.new(170, 45), 1)

            local cursor = pos + Vector2.new(5, 4)

            helpers:text_shadow("» psycho anti-aim", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» psycho anti-aim ", 11, fonts.verdana).x
            helpers:text_shadow("technology", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» user:", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» user: ", 11, fonts.verdana).x
            helpers:text_shadow(globals.username, cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» build: ", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» build: ", 11, fonts.verdana).x
            helpers:text_shadow("stable", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)

            if ui.visuals.statepanel_image:Get() == 1 then
                Render.Image(globals.avatar, pos + Vector2.new(145, 20), Vector2.new(20, 20))
            elseif ui.visuals.statepanel_image:Get() == 2 then
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
            else
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
                Render.Image(globals.avatar, pos + Vector2.new(105, 19), Vector2.new(22, 22))
            end

        end
    },

    gamesense = {

        draw = function(self)

            local local_player = EntityList.GetLocalPlayer()
            if not local_player then return end

            if not local_player:IsAlive() then return end
            local cur_dmg = ui.refs.minimum_damage:GetInt()
            if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
            local isDmg = false
            local isPing = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
                if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                    isPing = true
                end
            end
            local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
            local crouch = local_player:GetProp('m_flDuckAmount')
            local isDmg = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                local bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
            end

            if ui.visuals.gamesense:Get() then
                local current_pos = 1
              
                if ui.visuals.gamesense_choose:Get(1) and isDmg then
                    indicators.Render_Indicator('DMG: '..tostring(cur_dmg), Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
      
                if ui.visuals.gamesense_choose:Get(2) and ui.ragebot.dormant_aimbot:GetBool() then
                    local colors = Color.RGBA(132,196,20,255)
                    for k, v in pairs(rage.player_info_prev) do
                        if k ~= nil then
                            if v[3] == true then
                                colors = Color.RGBA(252,222,30,255)
                                break
                            end
                        end
                    end
                    indicators.Render_Indicator('DA', colors, current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(3) and isPing then
                    local net_channel = EngineClient.GetNetChannelInfo()
                    local outgoing, incoming = net_channel:GetLatency(0), net_channel:GetLatency(1)
                    local ping = math.max(0, (incoming-outgoing)*1000)
                    indicators.Render_Indicator('PING', Color.RGBA(math.floor(255 - ((ping / 189 * 60) * 1.90)), math.floor((ping / 189 * 60) * 3.05), math.floor((ping / 189 * 60) * 0.32), 255), current_pos); current_pos = current_pos - 1;
                end
                local c4 = EntityList.GetEntitiesByClassID(129)[1];
                if ui.visuals.gamesense_choose:Get(4) and c4 ~= nil then
                    local time = c4:GetProp('m_flC4Blow') - GlobalVars.curtime
                    local timer = string.format('%.1f', time)
                    local defused = c4:GetProp('m_bBombDefused')
                    if math.floor(timer) > 0 and not defused then
                        local defusestart = c4:GetProp('m_hBombDefuser') ~= 4294967295
                        local defuselength = c4:GetProp('m_flDefuseLength')
                        local defusetimer = defusestart and (c4:GetProp('m_flDefuseCountDown') - GlobalVars.curtime) / 1 or -1
                        if defusetimer > 0 then
                            local color = math.floor(timer) > defusetimer and Color.RGBA(75, 230, 64, 80) or Color.RGBA(255, 0, 0, 80)
                      
                            local barlength = ((globals.screen_size.y - 50) / defuselength) * (defusetimer)
                            Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                            Render.Box(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                          
                            Render.BoxFilled(Vector2.new(0, globals.screen_size.y - barlength), Vector2.new(19, globals.screen_size.y), color)
                        end
                      
                        local bombsite = c4:GetProp('m_nBombSite') == 0 and 'A' or 'B'
                        local health = EntityList.GetLocalPlayer():GetProp('m_iHealth')
                        local armor = EntityList.GetLocalPlayer():GetProp('m_ArmorValue')
                        local willKill = false
                        local eLoc = c4:GetRenderOrigin()
                        local lLoc = EntityList.GetLocalPlayer():GetRenderOrigin()
                        local distance = eLoc:DistTo(lLoc)
                        local a = 450.7
                        local b = 75.68
                        local c = 789.2
                        local d = (distance - b) / c;
      
                        local damage = a * math.exp(-d * d)
                        if armor > 0 then
                            newDmg = damage * 0.5;
          
                            armorDmg = (damage - newDmg) * 0.5
                            if armorDmg > armor then
                                armor = armor * (1 / .5)
                                newDmg = damage - armorDmg
                            end
                            damage = newDmg;
                        end
                        local dmg = math.ceil(damage)
                        if dmg >= health then
                            willKill = true
                        else
                            willKill = false
                        end
                        indicators.Render_Indicator(bombsite..' - '..string.format('%.1f', timer)..'s', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                        if EntityList.GetLocalPlayer() then
                            if willKill == true then
                                indicators.Render_Indicator('FATAL', Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                            elseif damage > 0.5 then
                                indicators.Render_Indicator('-'..dmg..' HP', Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                            end
                        end
                    end
                end
                if ui.visuals.gamesense_choose:Get(4) and planting then
                    indicators.Render_Indicator(planting_site, Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                    local fill = 3.125 - (3.125 + on_plant_time - GlobalVars.curtime)
                    if fill > 3.125 then
                        fill = 3.125
                    end
                    local ts = Render.CalcTextSize(planting_site, 24, fonts.calibrib24)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(0, 0, 0, 200), 5)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(213, 213, 214, 255), 3, -1, (fill/3.3)*375)
                end

                if ui.visuals.gamesense_choose:Get(5) and bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), bit.lshift(1,0)) == 0 then
                    indicators.Render_Indicator('LC', EntityList.GetLocalPlayer():GetVelocity() > 260 and Color.RGBA(132, 196, 20, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(6) and ui.refs.fakeduck:Get() then
                    indicators.Render_Indicator('DUCK', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if  ui.visuals.gamesense_choose:Get(7) and ui.refs.doubletap:Get() then
                    indicators.Render_Indicator('DT', Exploits.GetCharge() == 1 and Color.RGBA(213, 213, 214, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(8) and ui.refs.hideshots:Get() then
                    indicators.Render_Indicator('ONSHOT', Color.RGBA(132, 196, 20, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(9) and ui.refs.yaw_base:Get() == 5 then
                    indicators.Render_Indicator('FS', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
      
                if ui.visuals.gamesense_choose:Get(10) and ui.refs.bodyaim:Get() == 2 then
                    indicators.Render_Indicator('BODY', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(11) and ui.refs.safepoints:Get() == 2 then
                    indicators.Render_Indicator('SAFE', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
            end
        end
    },

    indicators = {
        x_add = 0,
        -----------------------
        draw = function(self)
            if not ui.visuals.widgets:Get(5) then return end
                local local_player = EntityList.GetLocalPlayer()
                if not local_player then return end

                if not local_player:IsAlive() then return end
                local cur_dmg = ui.refs.minimum_damage:GetInt()
                if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
                local isDmg = false
                local isPing = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                    if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                        isPing = true
                    end
                end
                local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
                local crouch = local_player:GetProp('m_flDuckAmount')
                local isDmg = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    local bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                end
                local scope = local_player:GetProp('m_bIsScoped')
                self.x_add = helpers:lerp(self.x_add, scope and 35 or 0, GlobalVars.frametime * 8)

                local alpha = 0
                local y = 0

                if scope then
                    alpha = 0.5
                else
                    alpha = 1
                end
                if globals.indicator_avatar == nil then return end
                if globals.logo_avatar2 == nil then return end
                if fonts.pixel == nil then return end
                if fonts.arrow_fonts == nil then return end
                if fonts.arrow_font2 == nil then return end

                if ui.visuals.indicator_type:Get() == 1 then
                  
                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 2), Vector2.new(100, 75), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, breath(2, ui.visuals.ghosty_color:GetColor().a * 100 / 235)))
                    end

                    Render.Image(globals.logo_avatar2, Vector2.new(globals.screen_size.x/2 - 20 +self.x_add, globals.screen_size.y/2 + 17), Vector2.new(40, 40), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, alpha))
                end
                --if ui.visuals.indicator_type:Get() == 1 then
                --Render.Image(globals.logo_avatar, Vector2.new(globals.screen_size.x/2 - 21 +self.x_add, globals.screen_size.y/2 + 20), Vector2.new(35, 35), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, alpha))
                --end

                if ui.visuals.indicator_type:Get() == 0 then

                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 8), Vector2.new(100, 75), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, breath(2, ui.visuals.ind_name_color:GetColor().a * 100 / 235)))
                    end

                    Render.Text('psycho', Vector2.new(globals.screen_size.x/2-17+self.x_add, globals.screen_size.y/2+16), Color.new(0, 0, 0, 0.5), 11, fonts.verdanabd11)
                    Render.Text('psy', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+15), AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
                    Render.Text('cho', Vector2.new(globals.screen_size.x/2-1+self.x_add, globals.screen_size.y/2+15), not AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
              
                    if ground then
                        state = 'AIR'
                    elseif crouch >= 1 then
                        state = 'CROUCHING'
                    elseif ui.refs.slowwalk:Get() then
                        state = 'SLOWWALKING'
                    elseif local_player:GetVelocity() > 5 then
                        state = 'MOVING'
                    else
                        state = 'STANDING'
                    end
                    local text_sizes = Render.CalcTextSize(state, 9, fonts.pixel)
                    Render.Text(state, Vector2.new(globals.screen_size.x/2+1-text_sizes.x/2+self.x_add, globals.screen_size.y/2+28), Color.new(ui.visuals.ind_state_color:GetColor().r, ui.visuals.ind_state_color:GetColor().g, ui.visuals.ind_state_color:GetColor().b, 1), 9, fonts.pixel, true)

                    Render.Text('OS', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+37), ui.refs.hideshots:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('DT', Vector2.new(globals.screen_size.x/2-4+self.x_add, globals.screen_size.y/2+37), ui.refs.doubletap:Get() and (Exploits.GetCharge() >= 0.9 and Color.new(0, 1, 0, 1) or Color.new(1, 0, 0, 1)) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('AP', Vector2.new(globals.screen_size.x/2+9+self.x_add, globals.screen_size.y/2+37), ui.refs.autopeek:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                        if isDmg then
                            local text_size = Render.CalcTextSize(('DMG: %s'):format(ui.refs.minimum_damage:Get()), 9, fonts.pixel)
                            Render.Text(('DMG: %s'):format(ui.refs.minimum_damage:Get()), Vector2.new(globals.screen_size.x/2-text_size.x/2+1+self.x_add, globals.screen_size.y/2+46), Color.new(1, 1, 1, 1), 9, fonts.pixel, true)
                        end
                    end
                scope = EntityList.GetLocalPlayer():GetProp("m_bIsScoped")
                alpha = 0.7
      
                if ui.visuals.scope_conditions:Get(4) and scope then
                    alpha = 0
                else
                    if ui.visuals.arrows:GetInt() == 1 then
                        Render.Text('<', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                        Render.Text('>', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                    end

                    if ui.visuals.arrows:GetInt() == 2 then
                        Render.Text('X', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('Z', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end

                    if ui.visuals.arrows:GetInt() == 3 then
                        Render.Text('w', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('x', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end
                end
            end
        }
}
-- @endregion

-- @region: visuals
local visuals = {}
local scope_anim = 0
visuals.scope = function()
    -- vars
    x,y,w,o = globals.screen_size.x / 2, globals.screen_size.y / 2, ui.visuals.scope_width:GetInt(), ui.visuals.scope_offset:GetInt()
    -- проверки
    local fov_cs_debug = CVar.FindVar("fov_cs_debug")

    if not EngineClient.IsConnected() then return end
    if not EntityList.GetLocalPlayer() then return end
    if not EntityList.GetLocalPlayer():GetProp("m_bIsScoped") then return end
    if ui.visuals.custom_scope:GetBool() then
        ui.refs.scope:SetInt(2)
      
        if scope_anim > 0 then scope_anim = scope_anim - 5
            else scope_anim = 0
        end
        if ui.visuals.scope_conditions:Get(2) then scope_anim = 255 else if scope_anim < 255 then scope_anim = scope_anim + 5 else scope_anim = 255 end end
        if ui.visuals.custom_scope and ui.visuals.scope_conditions:Get(3) and fov_cs_debug:GetInt()~=90 then fov_cs_debug:SetInt(90) end

        if ui.visuals.scope_conditions:Get(1) then
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
        else
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
        end

        Render.GradientBoxFilled(Vector2.new(x - w - o, y), Vector2.new(x - o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x + w + o, y), Vector2.new(x + o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x, y - o - w), Vector2.new(x + 1, y - o), color1, color1, color2, color2)
        Render.GradientBoxFilled(Vector2.new(x, y + o + w), Vector2.new(x + 1, y + o), color1, color1, color2, color2)
    else
        ui.refs.scope:SetInt(1)
    end
end

visuals.circle_desync = function() 
  
    local local_player = EntityList.GetLocalPlayer()
    if not local_player then return end

     if not local_player:IsAlive() then return end
    if ui.visuals.desync_circle_conditions:Get(2) and ui.visuals.desync_circle:GetBool() then
        CVar.FindVar('crosshair'):SetInt(0)
    else
        CVar.FindVar('crosshair'):SetInt(1)
    end

    if ui.visuals.desync_circle:Get() then

        local color = Color.new(ui.visuals.desync_circle:GetColor().r, ui.visuals.desync_circle:GetColor().g, ui.visuals.desync_circle:GetColor().b, 1)
        local view_angles = EngineClient.GetViewAngles()
        local real_yaw = AntiAim.GetCurrentRealRotation()
        local view_yaw = view_angles.yaw - 180;
        local fake = adjust_angle(real_yaw - view_yaw);
        local delta = math.abs(normalize_yaw(AntiAim.GetCurrentRealRotation() % 360 - AntiAim.GetFakeRotation() % 360)) / 2
        local fake_color = Color.RGBA(math.floor(255 - (delta * 2.29824561404)), math.floor(delta * 3.42105263158), math.floor(delta * 0.22807017543), 255)

        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, Color.new(0, 0, 0, 1), 4, 0, 360)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, 90, ui.refs.invert_side == false and -90 or 270)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 15, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, fake+30, fake-30)
    end
end

visuals.hitmarker = function()
    if not EngineClient.IsConnected() then return end
    if not ui.visuals.hitmarker:Get() then return end

    misc.removeimpact()
    local color = ui.visuals.hitmarker:GetColor()
    local r = color.r local g = color.g local b = color.b local l = ui.visuals.hitmarker_length:Get()

    for i = 1, #t do

        local screen_pos = Render.WorldToScreen(Vector.new(t[i].x, t[i].y, t[i].z))
        local sx,sy = screen_pos.x, screen_pos.y

        Render.BoxFilled(Vector2.new(sx, sy - l), Vector2.new(sx, sy + l), Color.new(r, g, b, (t[i].a / 255)), 1.0)
        Render.BoxFilled(Vector2.new(sx - l, sy), Vector2.new(sx + l, sy), Color.new(r, g, b, (t[i].a / 255)), 1.0)
    end
end

visuals.thirdperson = function()
    if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
        Menu.FindVar("Visuals", "View", "Thirdperson", "Distance"):Set(ui.misc.thirdperson_distance:Get())
    end
        if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
            Cheat.SetThirdPersonAnim(not ui.misc.thirdperson_anim:Get())
        else
            Cheat.SetThirdPersonAnim(true)
        end
end
visuals._verification = function(shot)
    local text = ''

    local hg_diff = hgroup ~= aimed_hgroup
    local dmg_diff = shot.damage ~= shot.wanted_damage

    if hg_diff or dmg_diff then
        text = string.format(
            ' | mismatch: [ %s ]', (function()
                local addr = ''

                if dmg_diff then addr = 'dmg: ' .. shot.wanted_damage .. (hg_diff and ' | ' or '') end
                if hg_diff then addr = addr .. (hg_diff and 'hitgroup: ' .. aimed_hgroup or '') end

                return addr
            end)()
        )
    end

    return text
end

local size_changed = false

local text = ''

visuals.glowmenu = function()
    if not ui.misc.menu_customize:Get() then return end
    local menu_pos = Render.GetMenuPos()
    local menu_sz = Render.GetMenuSize()
  
    function force_update()    image_size = Vector2.new(menu_sz.x * 3, menu_sz.y * 3)    end
    if menu_sz.x ~= cache_size.x then force_update() size_changed = true end
    if size_changed == true and cache_size.x == menu_sz.x then force_update() end
    if not Cheat.IsMenuVisible() then return end
  
    if ui.misc.menu_dim:Get() then
        Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(0, 0, 0, ui.misc.dim_slider:GetFloat()))
    end

    if ui.misc.menu_blur:Get() then

        Render.Blur(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(1, 1, 1, ui.misc.blur_slider:GetFloat()))
    end
  
    if ui.misc.menu_glow:Get() then
        local alpha = 0
        if ui.misc.glow_pulse:Get() then
                alpha = breath(2, ui.misc.color_edit:GetColor().a * 175 / 235)
            else
                alpha = ui.misc.color_edit:GetColor().a
        end

        Render.Image(globals.background, Vector2.new(menu_pos.x - menu_sz.x, menu_pos.y - menu_sz.y), image_size, Color.new(ui.misc.color_edit:GetColor().r, ui.misc.color_edit:GetColor().g, ui.misc.color_edit:GetColor().b, alpha ))
    end
end

visuals.events = function(event)

    local name = event:GetName()
    if name == "player_hurt" then
        local attacker = event:GetInt("attacker")

        if EntityList.GetPlayerForUserID(attacker) == globals.local_player then
      
            if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(1) then
                local player = EntityList.GetPlayerForUserID(event:GetInt("userid"))

                if not player then
                    return
                end

                local hitgroup_names = {
                    [0] = "generic",
                    [1] = "head",
                    [2] = "chest",
                    [3] = "stomach",
                    [4] = "left arm",
                    [5] = "right arm",
                    [6] = "left leg",
                    [7] = "right leg",
                    [10] = "gear"
                }

                logs:add(string.format("Hit %s in the %s for %d damage (%d health remaining)", player:GetName(), hitgroup_names[event:GetInt("hitgroup")] or "?", event:GetInt("dmg_health"), event:GetInt("health")))
            end
        end
    end

    if name == "bullet_impact" then
        local fire_plr = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        local localplayer = EntityList.GetLocalPlayer()
            if fire_plr ~= localplayer then
                return
            end
         table.insert(t, {
            x = event:GetInt("x"),
            y = event:GetInt("y"),
            z = event:GetInt("z"),
            a = 255,
            ctime = GlobalVars.curtime,
         })
    end

    if name == 'player_connect_full' then
        t = {}
    end

    if name == "player_hurt" then
        local localplayer = EntityList.GetLocalPlayer()
        local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker"))
        if ui.misc.hitsound:Get() and ui.misc.misc_enable:Get() then
            if attacker == localplayer then
                EngineClient.ExecuteClientCmd(string.format("playvol %s %s", ui.misc.hitsound_direction:Get(), ui.misc.hitsound_volume:Get()))
            end
        end
    end

    if name == 'player_hurt' then
        local weapon = event:GetString('weapon', '');
        if (weapon == 'hegrenade' or weapon == 'inferno' or weapon == 'knife') then
            if event:GetInt('userid') == nil then return end
            if event:GetInt('attacker') == nil then return end
            local attacker_id = EntityList.GetPlayerForUserID(event:GetInt('attacker'))
            if attacker_id == nil or attacker_id ~= EntityList.GetLocalPlayer() then
                return
            end
          
            local hittype = 'Hit'
            if weapon == 'hegrenade' then
                hittype = 'Naded';
            elseif weapon == 'inferno' then
                hittype = 'Burned';
            elseif weapon == 'knife' then
                hittype = 'Knifed';
            end
            local server_damage = event:GetInt('dmg_health')
            local target_id = EntityList.GetPlayerForUserID(event:GetInt('userid'))
            if target_id == nil then return end
            local target_name = string.lower(target_id:GetName())
            local health = target_id:GetProp('m_iHealth')-server_damage
            if health < 0 then health = 0 end
            text = string.format('%s %s for %i damage (%i remaining)', hittype, target_name, server_damage, health)
            if ui.visuals.log_type:Get(3) then
                ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
                ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), text..'\n')

                table.insert(hitlogs, {text = text, time = GlobalVars.realtime})

            end
        end
    end

end
local hitgroup_names1 = { 'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }

visuals.ragebot_shot = function(shot)
    miss_hitbox = missgroup_names[shot.hitgroup] or '?'
end

visuals.registered_shot = function(shot)

    hit_id = hit_id + 1
    shot_id = num_format((hit_id % 15) + 1)
    local safety = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'):Get()
    local name = string.lower(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetName())
    if name == nil then return end
    local hgroup = hitgroup_names1[shot.hitgroup + 1] or '?'
    local hit_chance = tostring(math.floor(shot.hitchance + 0.5))
    local backtrack = shot.backtrack
    local m_iHealth = EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_iHealth')
    if m_iHealth == nil then return end
    local health = m_iHealth - shot.damage
    if health < 0 then health = 0 end
    local aimed_hgroup = hitgroup_names1[shot.wanted_hitgroup + 1] or '?'
  
    local feet_yaw = math.min(58, math.max(yaw_normalize(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter')[12] * 120 - 60), -58))
    if EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter') == nil then return end
    if feet_yaw == nil then return end
    local ping = EngineClient.GetNetChannelInfo():GetLatency(0)*1000
    local avg_ping = EngineClient.GetNetChannelInfo():GetAvgLatency(0)*1000
    --if shot.reason == nil or hit_id == nil or aimed_hgroup == nil or shot_id == nil or feet_yaw == nil or safety == nil or name == nil or hit_chance == nil or ping == nil or avg_ping == nil then return end
    local netChannelInfo = ffi.cast('void***', getNetChannelInfo(I_EngineClientPtr)) or error('netchaninfo is nil')
    local netChannel = GetNetChannel(netChannelInfo)
    local net_state = string.format(
        'delay: %d:%.2f | dropped: %.0f',
        avg_ping, math.abs(avg_ping-ping), (netChannel.AvgLoss*100)
    )
  
    local uflags = {
        math.abs(avg_ping-ping) < 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction'):GetInt() == 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction_force_server_tick') == 999 and 0 or 1
    }

    local pflags = {
        ClientState.m_choked_commands > 1 and 1 or 0,
        EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier') < 1.00 and 1 or 0,
        (EntityList.GetLocalPlayer():GetRenderOrigin().z <= EntityList.GetClientEntity(shot.target_index):GetPlayer():GetRenderOrigin().z) and 1 or 0
    }

    local correction = Menu.FindVar('Aimbot', 'Ragebot', 'Main', 'Override Resolver'):GetBool()
  
    if shot.reason == 0 then
        text = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s%% | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
        textc = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance .. '%%', safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
    elseif shot.reason == 1 then
        shot_reason = (shot.reason == 1 and total_hits ~= EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')) and 'damage rejection' or string.format('unknown [angle: %.2f° | %d:%d°]', shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw)
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to %s ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot_reason, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 2 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to spread [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 3 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to occlusion [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 4 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to prediction error [%s] [vel_modifier: %.1f | history(Δ): %d | error: %s]',
        shot_id, name, miss_hitbox, hit_chance, net_state, EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier'), backtrack, table.concat(uflags))
    end
    if ui.visuals.log_type:Get(3) then

        if shot.reason == 0 then
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), textc..'\n')
        else
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 200), text1..'\n')
        end

        table.insert(hitlogs, {text = text, time = GlobalVars.realtime})
    end

end

-- @endregion

-- @region: world
local world = {}
world.sun_set = function()
    if not ui.world.world_enable:GetBool() then return end
    local CCascadeLights = EntityList.GetEntitiesByName('CCascadeLight')
    if not CCascadeLights == nil then return end
    for i=1, #CCascadeLights do
        local CCascadeLight = CCascadeLights[i]
        if ui.world.sunset:GetBool() then
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
            end
            if CCascadeLight:GetProp('m_flMaxShadowDist') ~= ui.world.shadow_dist:Get() then
                CCascadeLight:SetProp('m_flMaxShadowDist', ui.world.shadow_dist:Get())
            end
        else
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(0, 0, 0) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(0, 0, 0))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(0, 0, 0))
            end
        end
    end
end

local materials = {
    "particle/fire_burning_character/fire_env_fire_depthblend_oriented", "particle/fire_burning_character/fire_burning_character", "particle/fire_explosion_1/fire_explosion_1_oriented", "particle/fire_explosion_1/fire_explosion_1_bright", "particle/fire_burning_character/fire_burning_character_depthblend", "particle/fire_burning_character/fire_env_fire_depthblend",
}

world.molotov = function()
    for _, v in pairs(materials) do
        local material = MatSystem.FindMaterial(v, "")

        if material ~= nil then
            material:SetMaterialVarFlag(bit.lshift(1, 28), ui.world.molly_conditions:Get(1) and ui.world.world_enable:GetBool())
            material:SetMaterialVarFlag(bit.lshift(1, 15), ui.world.molly_conditions:Get(2) and ui.world.world_enable:GetBool())
        end
    end

end

-- effects
world.effects = function()
    if not ui.world.enable_bloom:Get() and ui.world.world_enable:Get() then return end
    if not EntityList.GetLocalPlayer() then
        return
    end

        local ambient = CVar.FindVar('r_modelAmbientMin')

        local CETC = EntityList.GetEntitiesByName('CEnvTonemapController')

        for idx, entity in pairs(CETC) do
            entity:SetProp('m_bUseCustomAutoExposureMin', true)
            entity:SetProp('m_bUseCustomAutoExposureMax', true)
            entity:SetProp('m_bUseCustomBloomScale', true)
            entity:SetProp('m_flCustomAutoExposureMin', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomAutoExposureMax', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomBloomScale', ui.world.bloom:GetFloat() / 10);
        end

        ambient:SetFloat(ui.world.model_ambient:GetFloat() / 10)

end

world.custom_skybox = function()
    if ui.world.custom_skybox:GetBool() and ui.world.world_enable:GetBool() then
        skybox_color = ui.world.custom_skybox:GetColor()
        skyboxname = ui.world.skybox_choose:GetString()
        cvar = CVar.FindVar("sv_skyname")
        ui.refs.skybox:SetInt(0)
        ui.refs.skybox:SetColor(skybox_color)
        cvar:SetString(skyboxname)
    else
        return 
    end
end
-- @endregion

logs = {
    logs = {},
    draw = function(self)
        local draw_offset = 50

        for _, log in pairs(self.logs) do
            local expired = log.expire_time < GlobalVars.realtime

            if expired then
                log.alpha = helpers:lerp(log.alpha, 0)
                log.pos = helpers:lerp(log.pos, 0)
            else
                log.alpha = helpers:lerp(log.alpha, 1)
                log.pos = helpers:lerp(log.pos, draw_offset)
                draw_offset = draw_offset + 30
            end

            if log.alpha < 0.01 and expired then
                table.remove(self.logs, _)
            else
                local size = Render.CalcTextSize(log.text, 11, fonts.verdana).x
                local pos = Vector2.new((globals.screen_size.x - size) * 0.5 - 5, globals.screen_size.y - log.pos)
                widgets:create_window(pos, pos + Vector2.new(size + 10, 20), log.alpha)
                Render.Text(log.text, pos + Vector2.new(5, 4), Color.new(1, 1, 1, log.alpha), 11, fonts.verdana)
            end
        end
    end,
    add = function(self, text)
        local log = {
            text = text,
            expire_time = GlobalVars.realtime + 5,
            pos = 0,
            alpha = 0,
        }

        table.insert(self.logs, log)
    end
}

-- @region: config system
ffi_functions.VGUI_System = ffi.cast(ffi.typeof('void***'), Utils.CreateInterface('vgui2.dll', 'VGUI_System010'))
ffi_functions.get_clipboard_text_length = ffi.cast('get_clipboard_text_length', ffi_functions.VGUI_System[0][7])
ffi_functions.get_clipboard_text = ffi.cast('get_clipboard_text', ffi_functions.VGUI_System[0][11])
ffi_functions.set_clipboard_text = ffi.cast('set_clipboard_text', ffi_functions.VGUI_System[0][9])

cfg_system.set_clipboard = function(text)
    ffi_functions.set_clipboard_text(ffi_functions.VGUI_System, text, #text)
end

cfg_system.get_clipboard = function()
    local clipboard_text_length = ffi_functions.get_clipboard_text_length(ffi_functions.VGUI_System)

    if (clipboard_text_length > 0) then
        local buffer = ffi.new('char[?]', clipboard_text_length)

        ffi_functions.get_clipboard_text(ffi_functions.VGUI_System, 0, buffer, clipboard_text_length * ffi.sizeof('char[?]', clipboard_text_length))
        return ffi.string(buffer, clipboard_text_length - 1)
    end

    return ''
end

cfg_system.cfg_data = {
    bools = {
        ui.anti_aims.custom[1].enable, ui.anti_aims.custom[2].enable, ui.anti_aims.custom[3].enable, ui.anti_aims.custom[4].enable, ui.anti_aims.custom[5].enable, ui.anti_aims.custom[6].enable,
        ui.anti_aims.custom[1].freestanding_bodyyaw, ui.anti_aims.custom[2].freestanding_bodyyaw, ui.anti_aims.custom[3].freestanding_bodyyaw, ui.anti_aims.custom[4].freestanding_bodyyaw, ui.anti_aims.custom[5].freestanding_bodyyaw, ui.anti_aims.custom[6].freestanding_bodyyaw,
        ui.anti_aims.custom[1].step_abs, ui.anti_aims.custom[2].step_abs, ui.anti_aims.custom[3].step_abs, ui.anti_aims.custom[4].step_abs, ui.anti_aims.custom[5].step_abs, ui.anti_aims.custom[6].step_abs,
        ui.misc.misc_enable,
        ui.misc.slowwalk_c,
        ui.misc.hitsound,
        ui.world.custom_skybox,
        ui.world.world_enable,
        ui.world.sunset,
        ui.visuals.visuals_enable,
        ui.visuals.disable_blur,
        ui.visuals.disable_background,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.anti_aims.antiaim_enable,
        ui.misc.menu_glow,
        ui.misc.glow_pulse,
        ui.misc.menu_dim,
        ui.misc.menu_blur,
        ui.misc.menu_customize,
        ui.misc.thirdperson,
        ui.ragebot.maxmissed,
        ui.misc.thirdperson_anim,
        ui.world.enable_bloom,
        ui.misc.clantag,
        ui.ragebot.dormant_aimbot,
        ui.ragebot.doubletap_recharge,
        ui.ragebot.override_doubletap,
        ui.ragebot.Teleport_In_Air,
        ui.visuals.gamesense,
        ui.ragebot.bodyaims,
        ui.misc.color_override,
        ui.misc.autopeek,
        ui.misc.quick_peek

    },
    ints = {
        ui.anti_aims.custom[1].yaw_mode, ui.anti_aims.custom[2].yaw_mode, ui.anti_aims.custom[3].yaw_mode, ui.anti_aims.custom[4].yaw_mode, ui.anti_aims.custom[5].yaw_mode, ui.anti_aims.custom[6].yaw_mode,
        ui.anti_aims.custom[1].static_yaw, ui.anti_aims.custom[2].static_yaw, ui.anti_aims.custom[3].static_yaw, ui.anti_aims.custom[4].static_yaw, ui.anti_aims.custom[5].static_yaw, ui.anti_aims.custom[6].static_yaw,
        ui.anti_aims.custom[1].tick_yaw_left, ui.anti_aims.custom[2].tick_yaw_left, ui.anti_aims.custom[3].tick_yaw_left, ui.anti_aims.custom[4].tick_yaw_left, ui.anti_aims.custom[5].tick_yaw_left, ui.anti_aims.custom[6].tick_yaw_left,
        ui.anti_aims.custom[1].tick_yaw_right, ui.anti_aims.custom[2].tick_yaw_right, ui.anti_aims.custom[3].tick_yaw_right, ui.anti_aims.custom[4].tick_yaw_right, ui.anti_aims.custom[5].tick_yaw_right, ui.anti_aims.custom[6].tick_yaw_right,
        ui.anti_aims.custom[1].choke_yaw_left, ui.anti_aims.custom[2].choke_yaw_left, ui.anti_aims.custom[3].choke_yaw_left, ui.anti_aims.custom[4].choke_yaw_left, ui.anti_aims.custom[5].choke_yaw_left, ui.anti_aims.custom[6].choke_yaw_left,
        ui.anti_aims.custom[1].choke_yaw_right, ui.anti_aims.custom[2].choke_yaw_right, ui.anti_aims.custom[3].choke_yaw_right, ui.anti_aims.custom[4].choke_yaw_right, ui.anti_aims.custom[5].choke_yaw_right, ui.anti_aims.custom[6].choke_yaw_right,
        ui.anti_aims.custom[1].desync_yaw_left, ui.anti_aims.custom[2].desync_yaw_left, ui.anti_aims.custom[3].desync_yaw_left, ui.anti_aims.custom[4].desync_yaw_left, ui.anti_aims.custom[5].desync_yaw_left, ui.anti_aims.custom[6].desync_yaw_left,
        ui.anti_aims.custom[1].desync_yaw_right, ui.anti_aims.custom[2].desync_yaw_right, ui.anti_aims.custom[3].desync_yaw_right, ui.anti_aims.custom[4].desync_yaw_right, ui.anti_aims.custom[5].desync_yaw_right, ui.anti_aims.custom[6].desync_yaw_right,
        ui.anti_aims.custom[1].yaw_jitter, ui.anti_aims.custom[2].yaw_jitter, ui.anti_aims.custom[3].yaw_jitter, ui.anti_aims.custom[4].yaw_jitter, ui.anti_aims.custom[5].yaw_jitter, ui.anti_aims.custom[6].yaw_jitter,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree, ui.anti_aims.custom[3].yaw_jitter_degree, ui.anti_aims.custom[4].yaw_jitter_degree, ui.anti_aims.custom[5].yaw_jitter_degree, ui.anti_aims.custom[6].yaw_jitter_degree,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree2, ui.anti_aims.custom[3].yaw_jitter_degree2, ui.anti_aims.custom[4].yaw_jitter_degree2, ui.anti_aims.custom[5].yaw_jitter_degree2, ui.anti_aims.custom[6].yaw_jitter_degree2,
    
        ui.anti_aims.custom[1].self_bodyyaw_mode, ui.anti_aims.custom[2].self_bodyyaw_mode, ui.anti_aims.custom[3].self_bodyyaw_mode, ui.anti_aims.custom[4].self_bodyyaw_mode, ui.anti_aims.custom[5].self_bodyyaw_mode, ui.anti_aims.custom[6].self_bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_mode, ui.anti_aims.custom[2].bodyyaw_mode, ui.anti_aims.custom[3].bodyyaw_mode, ui.anti_aims.custom[4].bodyyaw_mode, ui.anti_aims.custom[5].bodyyaw_mode, ui.anti_aims.custom[6].bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_degree, ui.anti_aims.custom[2].bodyyaw_degree, ui.anti_aims.custom[3].bodyyaw_degree, ui.anti_aims.custom[4].bodyyaw_degree, ui.anti_aims.custom[5].bodyyaw_degree, ui.anti_aims.custom[6].bodyyaw_degree,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_left, ui.anti_aims.custom[2].jitter_bodyyaw_degree_left, ui.anti_aims.custom[3].jitter_bodyyaw_degree_left, ui.anti_aims.custom[4].jitter_bodyyaw_degree_left, ui.anti_aims.custom[5].jitter_bodyyaw_degree_left, ui.anti_aims.custom[6].jitter_bodyyaw_degree_left,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_right, ui.anti_aims.custom[2].jitter_bodyyaw_degree_right, ui.anti_aims.custom[3].jitter_bodyyaw_degree_right, ui.anti_aims.custom[4].jitter_bodyyaw_degree_right, ui.anti_aims.custom[5].jitter_bodyyaw_degree_right, ui.anti_aims.custom[6].jitter_bodyyaw_degree_right,
        ui.anti_aims.custom[1].step_bodyyaw_degree_left, ui.anti_aims.custom[2].step_bodyyaw_degree_left, ui.anti_aims.custom[3].step_bodyyaw_degree_left, ui.anti_aims.custom[4].step_bodyyaw_degree_left, ui.anti_aims.custom[5].step_bodyyaw_degree_left, ui.anti_aims.custom[6].step_bodyyaw_degree_left,
        ui.anti_aims.custom[1].step_bodyyaw_degree_right, ui.anti_aims.custom[2].step_bodyyaw_degree_right, ui.anti_aims.custom[3].step_bodyyaw_degree_right, ui.anti_aims.custom[4].step_bodyyaw_degree_right, ui.anti_aims.custom[5].step_bodyyaw_degree_right, ui.anti_aims.custom[6].step_bodyyaw_degree_right,
        ui.anti_aims.custom[1].body_yaw_step_ticks, ui.anti_aims.custom[2].body_yaw_step_ticks, ui.anti_aims.custom[3].body_yaw_step_ticks, ui.anti_aims.custom[4].body_yaw_step_ticks, ui.anti_aims.custom[5].body_yaw_step_ticks, ui.anti_aims.custom[6].body_yaw_step_ticks,
        ui.anti_aims.custom[1].body_yaw_step_value, ui.anti_aims.custom[2].body_yaw_step_value, ui.anti_aims.custom[3].body_yaw_step_value, ui.anti_aims.custom[4].body_yaw_step_value, ui.anti_aims.custom[5].body_yaw_step_value, ui.anti_aims.custom[6].body_yaw_step_value,

        ui.anti_aims.custom[1].fake_yaw_mode, ui.anti_aims.custom[2].fake_yaw_mode, ui.anti_aims.custom[3].fake_yaw_mode, ui.anti_aims.custom[4].fake_yaw_mode, ui.anti_aims.custom[5].fake_yaw_mode, ui.anti_aims.custom[6].fake_yaw_mode,
        ui.anti_aims.custom[1].static_fakeyaw, ui.anti_aims.custom[2].static_fakeyaw, ui.anti_aims.custom[3].static_fakeyaw, ui.anti_aims.custom[4].static_fakeyaw, ui.anti_aims.custom[5].static_fakeyaw, ui.anti_aims.custom[6].static_fakeyaw,
        ui.anti_aims.custom[1].jitter_fakeyaw_left, ui.anti_aims.custom[2].jitter_fakeyaw_left, ui.anti_aims.custom[3].jitter_fakeyaw_left, ui.anti_aims.custom[4].jitter_fakeyaw_left, ui.anti_aims.custom[5].jitter_fakeyaw_left, ui.anti_aims.custom[6].jitter_fakeyaw_left,
        ui.anti_aims.custom[1].jitter_fakeyaw_right, ui.anti_aims.custom[2].jitter_fakeyaw_right, ui.anti_aims.custom[3].jitter_fakeyaw_right, ui.anti_aims.custom[4].jitter_fakeyaw_right, ui.anti_aims.custom[5].jitter_fakeyaw_right, ui.anti_aims.custom[6].jitter_fakeyaw_right,
        ui.anti_aims.custom[1].step_ticks, ui.anti_aims.custom[2].step_ticks, ui.anti_aims.custom[3].step_ticks, ui.anti_aims.custom[4].step_ticks, ui.anti_aims.custom[5].step_ticks, ui.anti_aims.custom[6].step_ticks,
        ui.anti_aims.custom[1].step_value, ui.anti_aims.custom[2].step_value, ui.anti_aims.custom[3].step_value, ui.anti_aims.custom[4].step_value, ui.anti_aims.custom[5].step_value, ui.anti_aims.custom[6].step_value,
        ui.anti_aims.custom[1].step_fake_min, ui.anti_aims.custom[2].step_fake_min, ui.anti_aims.custom[3].step_fake_min, ui.anti_aims.custom[4].step_fake_min, ui.anti_aims.custom[5].step_fake_min, ui.anti_aims.custom[6].step_fake_min,
        ui.anti_aims.custom[1].step_fake_max, ui.anti_aims.custom[2].step_fake_max, ui.anti_aims.custom[3].step_fake_max, ui.anti_aims.custom[4].step_fake_max, ui.anti_aims.custom[5].step_fake_max, ui.anti_aims.custom[6].step_fake_max,
        ui.anti_aims.custom[1].extra_options, ui.anti_aims.custom[2].extra_options, ui.anti_aims.custom[3].extra_options, ui.anti_aims.custom[4].extra_options, ui.anti_aims.custom[5].extra_options, ui.anti_aims.custom[6].extra_options,
        ui.misc.slowwalk_slider,
        ui.world.shadow_dist,
        ui.world.molly_conditions,
        ui.visuals.widgets,
        ui.visuals.watermark_info,
        ui.visuals.statepanel_image,
        ui.visuals.log_type,
        ui.visuals.indicator_type,
        ui.visuals.arrows,
        ui.visuals.arrows_x,
        ui.visuals.scope_width,
        ui.visuals.scope_offset,
        ui.visuals.scope_conditions,
        ui.visuals.desync_circle_conditions,
        ui.visuals.hitmarker_length,
      
        ui.anti_aims.antiaim_helpers,
        ui.ragebot.tp_in_air,
        ui.anti_aims.animbreakers,
        ui.misc.thirdperson_distance,
        ui.ragebot.maxmissed_c,
        ui.ragebot.dormant_aimbot_damage,
        ui.ragebot.doubletap_speed,
        ui.visuals.gamesense_choose,
        ui.ragebot.baimhp,
        ui.ragebot.baimmode,
        ui.ragebot.hitchances,
        ui.ragebot.air_hitchance,
        ui.ragebot.noscope_hitchance,

    },

    floats = {
        ui.misc.hitsound_volume,
        ui.world.shadow_x,
        ui.world.shadow_y,
        ui.world.shadow_z,
        ui.misc.blur_slider,
        ui.misc.dim_slider,
        ui.world.exposure,
        ui.world.bloom,
        ui.world.model_ambient,

    },

    strings = {
        ui.misc.hitsound_direction,
        ui.world.skybox_choose,
        ui.visuals.custom_username
    },

    colors = {
        ui.visuals.ghosty_color,
        ui.visuals.ind_name_color,
        ui.visuals.ind_state_color,
        ui.visuals.ind_color,
        ui.visuals.arrows_color,
        ui.visuals.theme,
        ui.world.custom_skybox,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.misc.color_edit,
        ui.misc.color_override,
        ui.misc.autopeek
    }
}

de_en_coding = 'pl3KmT/U1Djka4d7xA9WHXfNvngIbe56PSRFZGLOwrq2Ms8QEytVYhBJoC0i+czu'

cfg_system.encode = function(data)
    return ((data:gsub('.', function(x)
        local r,de_en_coding= '', x:byte()
        for i=8,1,-1 do r=r..(de_en_coding%2^i-de_en_coding%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 de_en_coding:sub(c+1,c+1)
    end)..({ '', '==', '=' })[#data%3+1])
end

cfg_system.decode = function(data)
    data = string.gsub(data, '[^'..de_en_coding..'=]', '')
    return (data:gsub('.', function(x)
        if (x == '=') then return '' end
        local r,f='',(de_en_coding: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
ui.global.export_cfg:RegisterCallback(function()
    local code = {{}, {}, {}, {}, {}}

    for _, bools in pairs(cfg_system.cfg_data.bools) do
        table.insert(code[1], bools:GetBool())
    end

    for _, ints in pairs(cfg_system.cfg_data.ints) do
        table.insert(code[2], ints:GetInt())
    end

    for _, floats in pairs(cfg_system.cfg_data.floats) do
        table.insert(code[3], floats:GetFloat())
    end

    for _, strings in pairs(cfg_system.cfg_data.strings) do
        table.insert(code[4], strings:GetString())
    end

    for _, colors in pairs(cfg_system.cfg_data.colors) do
        local clr = colors:GetColor()
        table.insert(code[5], string.format('%02X%02X%02X%02X', math.floor(clr.r * 255), math.floor(clr.g * 255), math.floor(clr.b * 255), math.floor(clr.a * 255)))
    end
  
    cfg_system.set_clipboard(cfg_system.encode(json.stringify(code)))
    logs:add('Config exported to clipboard.')
end)

cfg_system.config_load = function(text)
    local decode_cfg = json.parse(cfg_system.decode(text))
    if decode_cfg == nil then
        logs:add('Failed to load config.')
    else
        for k, v in pairs(decode_cfg) do
            k = ({[1] = 'bools', [2] = 'ints', [3] = 'floats', [4] = 'strings', [5] = 'colors'})[k]

            for k2, v2 in pairs(v) do
                if (k == 'bools') then
                    cfg_system.cfg_data[k][k2]:SetBool(v2)
                end

                if (k == 'ints') then
                    cfg_system.cfg_data[k][k2]:SetInt(v2)
                end

                if (k == 'floats') then
                    cfg_system.cfg_data[k][k2]:SetFloat(v2)
                end

                if (k == 'strings') then
                    cfg_system.cfg_data[k][k2]:SetString(v2)
                end

                if (k == 'colors') then
                    cfg_system.cfg_data[k][k2]:SetColor(Color.new(tonumber('0x'..v2:sub(1, 2))/255, tonumber('0x'..v2:sub(3, 4))/255, tonumber('0x'..v2:sub(5, 6))/255, tonumber('0x'..v2:sub(7, 8))/255))
                end
            end
        end
      
        logs:add("Applied imported config.")
    end
end
ui.global.import_cfg:RegisterCallback(function()
    cfg_system.config_load(cfg_system.get_clipboard())
end)

ui.global.default_cfg:RegisterCallback(function()
    cfg_system.config_load("5t1y1Fri1FmRdOAtefHM1F1RdOAtefHM1FaRdLnSIU4Gk31Y1FrYbOXGk31h1FrYbOXGk31B1FrYbOXGk31J1FrYbOXGk31o1FrLvfyVn9ERd910eUDhn9ERaWpRdOAtefHM1Fmy1FrLvfyVn9ERaW1RdLnSIU4Gk31yat10nLTMbBHM1FmY1FrLvfyVn9ERaWHRdLnSIU4Gk31y4R10nLTMbBHM1FmJ1FrLvfyVn9ERaWPRdLnSIU4Gk31yd910eUDhn9ERaFpRdLnSIU4Gk31ta910eUDhn9ERaF1RdOAtefHM1F1V1FrYbOXGk31t4310eUDhn9ERaFHRdOAtefHM1F1B1FrLvfyVn9ERaFbRdLnSIU4Gk31td310eUDhn9ERaFZRdOAtefHM1FaE1FrYbOXGk31Va910eUDhn9ERaV1RdOAtefHM1FaV1FrYbOXGk31V4310eUDhn9ERaVHRdLnSIU4Gk31V4R10eUDhn9ERaVbRdOAtefHM1Fao1FrYbOXGk31Vd910eUDhn9ER4KpRdLnSIU4Gk31Ya910eUDhn9ER4K1RdOAtefHM1FxV1FrLvfyVn9ER4KxRdOAtefHM1Fxh1FrYbOXGk31Y4R10eUDhnNYM1F1RdOMRa910a9ERaR10aRERat10a3ER4310a3ER4910a9ER4R10aRER4t10a3ERd310a3ERd910a3ERaWpRdFpM1Fmy1Fwoa3ERaW1RdFpM1FmV1FwsaRERaWxRdFpM1Fmh1FwEk31y4R10a3ERaWbRdRYtk31yd310a3ERaWZRdF1M1F1E1FwEk31ta910a3ERaF1RdFpM1F1V1Fwtk31t4310a3ERaFHRdFpM1F1B1FwsaRERaFbRdFpM1F1o1FwEk31td910a3ERaVpRdRYtk31Va910a3ERaV1RdF1M1FaV1FwEk31V4310a3ERaVHRdFpM1FaB1Fwtk31V4t10a3ERaVPRdFpM1FaC1FwEk31Ya310a3ER4KmRdFpM1Fxt1FwEk31Yat10a3ER4KxRdFpM1Fxh1FwEk31Y4R10a3ER4KbRdFpM1Fxo1FwEk31Yd910a9ER4WpRdFmM1FHy1Fwyk31haR10a9ER4WaRdFmM1FHY1Fwyk31h49104FvM1FHB1FwJa9ER4WbRdFbJk31hd310aW1M1FHC1FwBa9ER4FpRdFvtk31Ba9104FvM1Fvt1FwJatER4FaRdFPyk31B4310a3ER4FHRdFvhk31B4R104FbM1FvJ1Fwtk31Bd310aRER4FZRdF1M1FbE1FwVk31Ja910aRER4V1RdF1M1FbV1Fwtk31J4310aRER4VHRdFpM1FbB1FwEk31J4t10a9ER4VPRdF1M1FbC1Fwhd3ERdKpRdFHok31oa9104FpM1FPt1FwBa3ERdKaRdFHok31o43104WPM1FPh1FwVa3ERdKvRdFaEk31o4t10aVpM1FPo1FwVa3ERdKZRdFHtk31Ca310aVpM1FZy1FwVa3ERdW1RdFaEk31Cat10aVpM1FZY1FwVa3ERdWHRdFvEk31C4R10aVpM1FZJ1FwYk31Cd31049ERdWZRdFPM1FmEa310d3ERaWpy1Fwok31yaK1RdFxM1FmEat10aRERaWpY1Fwtk31yaKHRdFHM1FmE4R1049ERaWpJ1Fwhk31yaKPRdFmM1FmEd9104WpM1Fmya3104WpM1Fmya9104WPM1FmyaR104WPM1Fmyat104WPM1Fmy43104WpM1Fmy49104FpM1Fmy4R104FpM1Fmy4t104WPM1Fmyd3104WPM1Fmyd9104WPM1Fmta3104FpM1Fmta910a3ERaW1t1FwEk31yaFaRdFpM1Fmt4310a3ERaW1h1FwEk31yaFvRdFpM1Fmt4t104WpM1Fmtd310aWpEa3ERaW1C1FwVk31yaVpRdFvVk31yaVmRdF1Ck31yaV1RdFaM1FmVat1049ERaWaY1Fwyk31yaVHRdF1M1FmV4R10a3ERaWaJ1Fwod9ERaWao1FwtaRERaWaC1Fwy43ERaWxE1Fwtk31y4KmRdFvM1FmYaR10aWmM1FmYat1043ERaWxY1FwJk31y4KHRdFvhk31y4KvRdF1M1FmY4t10a9ERaWxo1Fwy4tERaWxC1FwtaKxJ69ERat105t1y1Fwyk31t1FwBa3ERat104FpM1FxRdFmEa3ER4910a9ER4R10a3oVaKpEaKpEaWmCaFpCaFPC4RER4t10a3ERd310a3ERd910aUYM1FxRdOMRa9101O4EvND2I/H8eBTB1RERaR101G4Evf4GAfCOgfCGkYCGvOXMvX+E431M1FaRdRDEgfCO5LXYn9Dck31h1Fri1FmRdRD3xHmYAZnKd31M1F1RdRD/AZn/AZn/AR1M1FaRdRD/AZn/AZn/AR1M1FxRdRD/AZn/AZn/AR1M1FHRdRD3xFG3AZnKd31M1FvRdRD34KS3AZvEa31M1FbRdRD/AZnTAZX/AR1M1FPRdRD3AWG3AZnKd31M1FZRdRDlaVZyAZn/AR1M1FmE1FwRdWPJAZHoxVPRk31ya9101FPB4ZD/AFxY1Ohc")
end)
-- @endregion

function ui_set_visible(vis, bool)
    vis:SetVisible(bool)
end

local function ui_callbacks()
    --ragebot
    ui.ragebot.maxmissed:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.maxmissed_c:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.maxmissed:GetBool())
    ui.ragebot.dormant_aimbot:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.dormant_aimbot_damage:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.dormant_aimbot:GetBool())
    ui.ragebot.override_doubletap:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.doubletap_speed:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.doubletap_recharge:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.Teleport_In_Air:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.tp_in_air:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.Teleport_In_Air:Get())
    ui.ragebot.bodyaims:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.baimmode:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.baimhp:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.hitchances:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.air_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(1))
    ui.ragebot.noscope_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(2))


    --widgets
    ui.visuals.widgets:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.watermark_info:SetVisible(ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.statepanel_image:SetVisible(ui.visuals.widgets:Get(4) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.custom_username:SetVisible(ui.visuals.watermark_info:Get(1) and ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.theme:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_blur:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_background:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.indicator_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.arrows:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_x:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.ghosty_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 1)
    ui.visuals.ind_name_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_state_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)

    --visuals micellaneous
    ui.visuals.custom_scope:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_width:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_offset:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_conditions:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle_conditions:SetVisible(ui.visuals.desync_circle:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker_length:SetVisible(ui.visuals.hitmarker:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.log_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(6))
    ui.visuals.gamesense:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.gamesense_choose:SetVisible(ui.visuals.gamesense:GetBool() and ui.visuals.visuals_enable:GetBool())
    -- world
    ui.world.sunset:SetVisible(ui.world.world_enable:GetBool())
    ui.world.shadow_x:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_y:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_z:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_dist:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.molly_conditions:SetVisible(ui.world.world_enable:GetBool())
    ui.world.custom_skybox:SetVisible(ui.world.world_enable:GetBool())
    ui.world.skybox_choose:SetVisible(ui.world.world_enable:GetBool() and ui.world.custom_skybox:GetBool())
    ui.world.enable_bloom:SetVisible(ui.world.world_enable:GetBool())
    ui.world.model_ambient:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.bloom:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.exposure:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())

    --antiaim
    ui.anti_aims.antiaim_helpers:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
    ui.anti_aims.animbreakers:SetVisible(ui.anti_aims.antiaim_enable:GetBool() and ui.anti_aims.antiaim_helpers:Get(2))

    --misc
    ui.misc.slowwalk_c:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.slowwalk_slider:SetVisible(ui.misc.slowwalk_c:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_direction:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_volume:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson_distance:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.thirdperson_anim:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.clantag:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.autopeek:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.color_override:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())
    ui.misc.quick_peek:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())

    --main
    ui.misc.menu_glow:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.glow_pulse:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.color_edit:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.menu_dim:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.dim_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_dim:Get())
    ui.misc.menu_blur:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.blur_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_blur:Get())

    --aa buider
  
    local m = ui.anti_aims
    for i = 1,#_state do
        local selects = ui.anti_aims.states_selection:Get()+1
        local cswitch = m.custom[i].enable:Get()
        local show = selects == i and cswitch and ui.anti_aims.antiaim_enable:GetBool()
        ui.anti_aims.states_selection:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].enable:SetVisible(selects == i and ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].extra_options:SetVisible(show)
        ui_set_visible(m.custom[i].yaw_mode,show)
        ---- {"Static","Period jitter \aC08A8AFF[Tick]","Period jitter \aC08A8AFF[Choke]","Period jitter \aC08A8AFF[Desync]"}
        ui_set_visible(m.custom[i].static_yaw,show and m.custom[i].yaw_mode:Get() == 0)
        ui_set_visible(m.custom[i].tick_yaw_left,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].tick_yaw_right,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].choke_yaw_left,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].choke_yaw_right,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].desync_yaw_left,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].desync_yaw_right,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].yaw_jitter,show)
        ui_set_visible(m.custom[i].yaw_jitter_mode,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree2,show and m.custom[i].yaw_jitter:Get() ~= 0 and m.custom[i].yaw_jitter_mode:Get() == 1)

        ui_set_visible(m.custom[i].self_bodyyaw_mode,show)
        ui_set_visible(m.custom[i].bodyyaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)   
        ui_set_visible(m.custom[i].bodyyaw_degree,show and m.custom[i].bodyyaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1 )
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_ticks,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_value,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)

        ui_set_visible(m.custom[i].fake_yaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].static_fakeyaw,show and m.custom[i].fake_yaw_mode:Get() == 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_left,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_right,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_value,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
--
        ui_set_visible(m.custom[i].step_abs,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_fake_min,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_fake_max,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].freestanding_bodyyaw,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
    end

end
local time_to_ticks = function(t) return math.floor(0.5 + (t / GlobalVars.interval_per_tick)) end
local callbacks = {

    on_draw = function()
        if Cheat.IsMenuVisible() then
            ui_callbacks()
        end

        globals.local_player = EntityList.GetLocalPlayer()

        visuals.glowmenu()
      
        misc.clantag()
        autopeek:paint_function()
      if ui.visuals.visuals_enable:Get() then
        widgets.lua_panel:draw()
        widgets.indicators:draw()
        widgets.watermark:draw()
        widgets.keybinds:draw()
        widgets.spectators:draw()
        widgets.gamesense:draw()
        visuals.scope()
        visuals.hitmarker()
        visuals.circle_desync()
        logs:draw()

        local x, y = 5, 5
        if(ui.visuals.log_type:Get(2)) then
            for i, hitlog in ipairs(hitlogs) do
                    Render.Text(hitlog.text, Vector2.new(x+1, y+1), Color.RGBA(0, 0, 0, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)-105), 10, fonts.lucida_console)
                    Render.Text(hitlog.text, Vector2.new(x, y), Color.RGBA(255, 255, 255, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)), 10, fonts.lucida_console)
                y = y + 15
                if #hitlogs > 15 then table.remove(hitlogs,1) end
                if hitlog.time + 10 < GlobalVars.realtime then table.remove(hitlogs, i) end
            end
        end
      end

        world.sun_set()
        world.molotov()
        world.custom_skybox()
        world.effects()
        visuals.thirdperson()
    end,

    on_player_connect_full = function()
        t = {}
    end,

    on_prediction = function(cmd)
        anti_aims.avoid_backstab()
        anti_aims.exploit_teleport()
        anti_aims.disable_aa_warmup()
        rage.ragebot(cmd)
        anti_aims.antiaim_helpers()
        AntiAim.run_custom(cmd)
        anti_aims.edge_yaw()
        misc.slowwalk(cmd)
        rage.on_prediction()
        rage.dormant_aim(cmd)
        autopeek:autopeek_main(cmd)
    end,

    on_createmove = function(cmd)
        rage.baim()
    end,

    on_ragebot_shot = function(shot)
        if EntityList.GetLocalPlayer() == nil then return end
        total_hits = EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')
        if total_hits == nil then return end
        miss_hitbox = missgroup_names[shot.hitgroup] or '?'
        self_choke = ClientState.m_choked_commands
        choke = time_to_ticks(GlobalVars.curtime - EntityList.GetClientEntity(shot.index):GetPlayer():GetProp('m_flSimulationTime')) + 1;
        if choke < 0 then
            choke = 0
        elseif choke > 14 then
            choke = 14
        end
        visuals.ragebot_shot(shot)
        autopeek.ragebot_shot(shot)
    end,

    on_pre_prediction = function(cmd)
        rage.hitchances()
    end,

    registered_shot = function(shot)
        rage.on_registered_shot(shot)
        visuals.registered_shot(shot)

        if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(2) and shot.reason ~= 0 then
            local name = EntityList.GetPlayer(shot.target_index):GetName()
            local hitgroup_names = {
                [0] = "generic",
                [1] = "head",
                [2] = "chest",
                [3] = "stomach",
                [4] = "left arm",
                [5] = "right arm",
                [6] = "left leg",
                [7] = "right leg",
                [10] = "gear"
            }
            local miss_reasons = {"animation desync", "spread", "occlusion", "prediction error"}
            logs:add(string.format("Missed %s's %s due to %s", name, hitgroup_names[shot.wanted_hitgroup], miss_reasons[shot.reason]))
        end

    end,

    on_events = function(event)
        rage.reset_data(event)
        rage.resetter(event)
        visuals.events(event)
        indicators.bomb(event)
    end,
}

Cheat.RegisterCallback("draw", callbacks.on_draw)
Cheat.RegisterCallback("prediction", callbacks.on_prediction)
Cheat.RegisterCallback("createmove", callbacks.on_createmove)
Cheat.RegisterCallback("pre_prediction", callbacks.on_pre_prediction)
Cheat.RegisterCallback("registered_shot", callbacks.registered_shot)
Cheat.RegisterCallback("ragebot_shot", callbacks.on_ragebot_shot)
Cheat.RegisterCallback("events", callbacks.on_events)
logs:add("Welcome to psycho, " ..globals.username)
Ещё один
 
блять
1659895061187.png
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ну и что тебе тут не понравилось
ну во первых "Ragebot", "Helpers", "Baim if Enemy hp <" , думаю очевидно, что поставив например значение 91, чит не будет стрелять на большой дистанции ввиду того, что такой дамаг выбить нельзя

local math_lua = { dist_to = function
зачем несколько раз прописывать одно и то же, если в самом чите в апи уже есть все нужное
 
ну во первых "Ragebot", "Helpers", "Baim if Enemy hp <" , думаю очевидно, что поставив например значение 91, чит не будет стрелять на большой дистанции ввиду того, что такой дамаг выбить нельзя

local math_lua = { dist_to = function
зачем несколько раз прописывать одно и то же, если в самом чите в апи уже есть все нужное
хорошо, а теперь посмотри кого я цитировал
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Credits: Hellfish#9343
смертрет
code_language.lua:
Expand Collapse Copy
EngineClient.ExecuteClientCmd("clear")

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

ffi.cdef[[
    typedef struct
    {
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    } uint_colors_t;


    typedef void*(__thiscall* c_entity_list_get_client_entity_t)(void*, int);
    typedef void (__cdecl* console_color_print)(void*, const uint_colors_t&, const char*, ...);
    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);

    void* GetProcAddress(void* hModule, const char* lpProcName);
    void* GetModuleHandleA(const char* lpModuleName);

    bool PathFileExistsA(const char* pszPath);
    bool CreateDirectoryA(const char* lpPathName, void* lpSecurityAttributes);
    bool DeleteUrlCacheEntryA(const char* lpszUrlName);
    void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);

    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 struct
    {
        float x;
        float y;
        float z;
    } Vector_t;

    typedef int16_t WORD;

    typedef struct {
        WORD wYear;
        WORD wMonth;
        WORD wDayOfWeek;
        WORD wDay;
        WORD wHour;
        WORD wMinute;
        WORD wSecond;
        WORD wMilliseconds;
    } SYSTEMTIME;

    void GetLocalTime(SYSTEMTIME* time);

    struct pose_params_t {
        char pad[8];
        float     m_flStart;
        float     m_flEnd;
        float     m_flState;
    };

    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;
    int CreateDirectoryA(const char*, void*);
    void* CreateFileA(const char*, uintptr_t, uintptr_t, void*, uintptr_t, uintptr_t, void*);
    uintptr_t GetFileSize(void*, uintptr_t*);
    int ReadFile(void*, void*, uintptr_t, uintptr_t*, void*);
    int CloseHandle(void*);

    typedef int(__thiscall* get_clipboard_text_length)(void*);
    typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
    typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);

    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);
]]

local json = Panorama.LoadString([[
    return {
        parse: JSON.parse,
        stringify: JSON.stringify
    };
]])()

local ffi_functions = {}

ffi_functions.animstate_offset = 0x9960
ffi_functions.interface_type = ffi.typeof("uintptr_t**")
ffi_functions.bind_argument = function(r_function, arg)
    return function(...)
        return r_function(arg, ...)
    end
end

ffi_functions.engine_cvars = Utils.CreateInterface("vstdlib.dll", "VEngineCvar007")
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, ffi_functions.engine_cvars)
ffi_functions.color_print = ffi.cast("console_color_print", ffi_functions.cvar_interface[0][25])

local color_print = function(text, color)
    local new_color = ffi.new("uint_colors_t")
    local rgba_table = {"r", "g", "b", "a"}

    for index, current_color in ipairs(rgba_table) do
        new_color[current_color] = color[current_color] * 255
    end
  
    local stringed_text = tostring(text)
    ffi_functions.color_print(ffi_functions.cvar_interface, new_color, stringed_text)
end

ffi_functions.interface_type = ffi.typeof('uintptr_t**')
ffi_functions.cvar_interface = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface('vstdlib.dll', 'VEngineCvar007'))
ffi_functions.print = ffi.cast('console_color_print', ffi_functions.cvar_interface[0][25])

ffi_functions.color_print1 = function(color, text)
    if color == nil then return end
    if text == nil then return end
    local col = ffi.new('uint_colors_t')
    if col == nil then return end
    col.r = color.r * 255
    col.g = color.g * 255
    col.b = color.b * 255
    col.a = color.a * 255
    ffi_functions.print(ffi_functions.cvar_interface, col, text)
end

ffi_functions.i_client_entity_list = ffi.cast(ffi_functions.interface_type, Utils.CreateInterface("client.dll", "VClientEntityList003"))
ffi_functions.get_client_entity = ffi_functions.bind_argument(ffi.cast("c_entity_list_get_client_entity_t", ffi_functions.i_client_entity_list[0][3]), ffi_functions.i_client_entity_list)

local pose_parameter_pattern = "55 8B EC 8B 45 08 57 8B F9 8B 4F 04 85 C9 75 15"
ffi_functions.get_pose_parameters = ffi.cast( "struct pose_params_t*(__thiscall* )( void*, int )", Utils.PatternScan( "client.dll", pose_parameter_pattern))

ffi_functions.client_entity_list = Utils.CreateInterface("client.dll", "VClientEntityList003")
ffi_functions.entity_list_pointer = ffi.cast("void***", ffi_functions.client_entity_list)

ffi_functions.get_client_entity_fn = ffi.cast("GetClientEntity_4242425_t", ffi_functions.entity_list_pointer[0][3])
ffi_functions.get_entity_address = function(ent_index)
    local addr = ffi_functions.get_client_entity_fn(ffi_functions.entity_list_pointer, ent_index)
    return addr
end

local engine_client = Utils.CreateInterface('engine.dll', 'VEngineClient014')
local interfacePointer = ffi.typeof('void***')
local netChannelBool = ffi.typeof('bool(__thiscall*)(void*)')
local netChannelBoolWithArgs = ffi.typeof('bool(__thiscall*)(void*, int, int)')
local netChannelFloat = ffi.typeof('float(__thiscall*)(void*, int)')
local netChannelInt = ffi.typeof('int(__thiscall*)(void*, int)')
local netChannelFramerate = ffi.typeof('void(__thiscall*)(void*, float*, float*, float*)')

local I_EngineClientPtr = ffi.cast(interfacePointer, engine_client) or error('engine_client is nil', 2)
local getNetChannelInfo = ffi.cast('void*(__thiscall*)(void*)', I_EngineClientPtr[0][78]) or error('I_EngineClientPtr is nil')

function GetNetChannel(netChannelInfo)
    if netChannelInfo == nil then
        return
    end

    local SequenceNr = ffi.cast(netChannelInt, netChannelInfo[0][17])(netChannelInfo, 1)

    return {
        SequenceNr = SequenceNr,

        IsLoopback = ffi.cast(netChannelBool, netChannelInfo[0][6])(netChannelInfo),
        IsTimingOut = ffi.cast(netChannelBool, netChannelInfo[0][7])(netChannelInfo),

        Latency = {
            RTT = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][9])(netChannelInfo, flow) end,
            AvgLatency = function(flow) return ffi.cast(netChannelFloat, netChannelInfo[0][10])(netChannelInfo, flow) end,
        },

        AvgLoss = ffi.cast(netChannelFloat, netChannelInfo[0][11])(netChannelInfo, 1),
        AvgChoke = ffi.cast(netChannelFloat, netChannelInfo[0][12])(netChannelInfo, 1),
        InputBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 1),
        SendBytes = ffi.cast(netChannelFloat, netChannelInfo[0][13])(netChannelInfo, 0),

        IsValidPacket = ffi.cast(netChannelBoolWithArgs, netChannelInfo[0][18])(netChannelInfo, 1, SequenceNr-1),
    }
end

hitlogs = {}
safety = 0
hit_id = -1
shot_id = 0
hit_ids = 0
total_hits = 0

ffi_functions.open_link = function(link)
    local panorama_handle = Panorama.Open()
    local steam_overlay_API = panorama_handle.SteamOverlayAPI
    local open_external_browser_url = steam_overlay_API.OpenExternalBrowserURL
  
    open_external_browser_url(link)
end
ffi_functions.urlmon = ffi.load('UrlMon')
ffi_functions.wininet = ffi.load('WinInet')
ffi_functions.download_file_from_url = function(from, to)
    ffi_functions.wininet.DeleteUrlCacheEntryA(from)
    ffi_functions.urlmon.URLDownloadToFileA(nil, from, to, 0,0)
end

ffi_functions.ct = ffi.typeof('char[?]')
ffi_functions.c_invalid_handle_value = ffi.cast('void*', -1)
local cfg_system = {}
package.loaded.readfile = function(filename)
    local fp = ffi.C.CreateFileA(filename, 0x80000000, 3, nil, 3, 128, nil)
    if ffi_functions.c_invalid_handle_value ~= fp then
        local size = ffi.C.GetFileSize(fp, nil)
        local buf = ffi_functions.ct(size + 1)
        ffi.C.ReadFile(fp, buf, size, nil, nil)
        ffi.C.CloseHandle(fp)
        return ffi.string(buf, size)
    end
end

local img_bytes = '\xFF\xD8\xFF\xDB\x00\x43\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\x0A\x10\x0A\x0A\x09\x09\x0A\x14\x0E\x0F\x0C\x10\x17\x14\x18\x18\x17\x14\x16\x16\x1A\x1D\x25\x1F\x1A\x1B\x23\x1C\x16\x16\x20\x2C\x20\x23\x26\x27\x29\x2A\x29\x19\x1F\x2D\x30\x2D\x28\x30\x25\x28\x29\x28\xFF\xDB\x00\x43\x01\x07\x07\x07\x0A\x08\x0A\x13\x0A\x0A\x13\x28\x1A\x16\x1A\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\x28\xFF\xC0\x00\x11\x08\x00\xB8\x00\xB8\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xFF\xC4\x00\x1B\x00\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x08\x07\x05\x06\x03\x01\xFF\xC4\x00\x43\x10\x00\x01\x03\x02\x01\x09\x05\x05\x03\x08\x0B\x00\x00\x00\x00\x00\x00\x01\x02\x04\x03\x05\x11\x06\x15\x21\x35\x54\x73\x93\xB2\xD1\x07\x12\x13\x31\x41\x08\x14\x51\x61\x71\x16\x22\xA1\x17\x23\x52\x56\x81\x91\x92\xA2\x25\x27\x33\x55\x62\x72\x94\x95\xB3\xC1\xD2\xFF\xC4\x00\x14\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xC4\x00\x14\x11\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xDA\x00\x0C\x03\x01\x00\x02\x11\x03\x11\x00\x3F\x00\xE2\xB7\x19\xB2\xE8\xDC\x24\xD2\xA3\x26\xBD\x3A\x6C\xAA\xE6\xB5\xAD\xA8\xA8\x88\x88\xAB\xF3\x26\xCE\x33\xB6\xD9\x3C\x57\x75\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x2A\xCE\x33\xB6\xD9\x3C\x57\x75\x19\xC6\x76\xDB\x27\x8A\xEE\xA4\xA0\x0A\xB3\x8C\xED\xB6\x4F\x15\xDD\x46\x71\x9D\xB6\xC9\xE2\xBB\xA9\x28\x02\xAC\xE3\x3B\x6D\x93\xC5\x77\x51\x9C\x67\x6D\xB2\x78\xAE\xEA\x4A\x00\xAB\x38\xCE\xDB\x64\xF1\x5D\xD4\x67\x19\xDB\x6C\x9E\x2B\xBA\x92\x80\x3D\x3B\x74\xD9\x75\xAE\x11\xA9\x56\x93\x5E\xA5\x37\xD5\x6B\x5C\xD7\x54\x55\x45\x45\x54\xF9\x82\x6B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x0F\x6B\x25\x32\x5E\xEF\x95\x57\x14\x85\x64\x88\xFA\xEF\x4C\x16\xA3\xD7\x43\x29\x27\xC5\xCE\xF4\x4F\xC5\x7D\x31\x03\xC5\x06\x90\xC9\x9E\xC0\x2D\x94\x29\x32\xA6\x51\xDC\x6B\x4B\x91\x86\x2B\x4A\x2E\x14\xE9\xA2\xFA\xA7\x79\x51\x5C\xEF\xAE\x83\xEB\x5B\xD8\xE6\x42\xB5\xA8\x8B\x64\x57\x2A\x79\xAA\xCB\xAF\x8A\xFF\x00\x38\x19\x08\x1A\x82\xF9\xD8\x2E\x4D\xCC\xA6\xAB\x6A\x93\x36\xDD\x5B\x0F\xBB\xF7\x92\xB3\x3F\x6B\x5D\xA5\x7F\x62\xA1\xC4\xF2\xF7\xB3\x7B\xEE\x46\x3B\xC5\x9B\x49\x24\xDB\x95\x70\x6C\xCA\x18\xAB\x31\xF4\x47\x26\x18\xB5\x7E\xBA\x3E\x0A\xA0\x7C\x58\x00\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x0F\x6F\x23\x32\x72\x5E\x55\xE5\x1C\x4B\x4C\x1F\xBA\xFA\xCE\xC5\xF5\x15\x31\x4A\x4C\x4D\x2E\x72\xFD\x3F\x15\xD0\x6C\xAC\x92\xC9\xBB\x76\x4A\xD9\x68\xDB\x6D\x34\x51\x94\x98\x88\xAF\x7A\xA2\x77\xEA\xBF\x0C\x15\xCE\x5F\x55\x5C\x3F\xE9\x34\x1C\xAF\xD9\x86\xC2\xC8\xF6\x1B\x8D\xF2\xA3\x3F\x3F\x2E\xAF\xBB\xD3\x55\xF4\xA6\xC4\x45\x5C\x3E\xAE\x5F\xE5\x3B\x68\x00\x71\x4E\xDB\xFB\x52\x97\x93\xF3\x56\xC1\x93\x8F\x65\x39\xE8\xC4\x74\x99\x2A\x88\xE5\xA2\x8A\x98\xA3\x5A\x9F\xA5\x82\xE3\x8A\xA6\x84\x5D\x1A\x7C\xB8\x0C\x8C\xA4\xBE\x48\xAE\xB5\xEB\xDE\x2E\x2F\xAC\xAB\x8F\x7D\xD2\x5E\xAB\x8F\xD7\x10\x37\x49\xF9\xC9\xA1\x4A\x54\x7A\x91\xE4\xD2\xA7\x5A\x85\x56\xAB\x5F\x4E\xA3\x51\x5A\xE4\x54\xC1\x51\x53\xD5\x0C\xCB\xD9\x87\x6C\x77\x3B\x54\xFA\x30\x72\xA2\x4D\x49\xF6\xAA\x8A\x8D\x5A\xF5\x55\x5D\x56\x82\xF9\x77\x95\xDE\x6E\x6F\xC5\x17\x15\xF8\x7C\x17\x4E\xB1\xED\x7B\x1A\xF6\x39\x1C\xD5\x44\x72\x2B\x57\x14\x54\xF3\xC5\x14\x0C\x97\xDB\x5F\x67\xFF\x00\x63\xAF\x2C\x95\x6E\x6A\xAD\x96\x6B\x97\xC2\x45\xC5\x56\x8B\xFD\x69\xAA\xFC\x3D\x51\x57\xD3\xE9\x89\xCD\x8D\xA5\xDA\xAD\x85\x99\x45\x90\x77\x68\x4A\xDE\xF5\x66\x52\x5A\xF4\x17\xD5\x2A\x31\x3B\xCD\xC3\xE1\x8E\x0A\x9F\x45\x31\x68\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x1A\xE3\xB0\x79\x11\xA9\x76\x55\x65\x6B\xEB\x51\x63\xD5\x6B\xAB\x91\x5C\x88\xB8\xF8\xEF\xF3\xD3\xF0\xC0\xFB\xEF\x7D\x8B\xB4\xD1\xFE\x34\xEA\x60\x90\x07\xAF\x96\x13\x9D\x72\xCA\xBB\xC4\xD7\xBB\xBE\xB5\xE5\xD5\x7A\x2E\x38\xA6\x0A\xE5\xC1\x11\x7E\x18\x68\x3C\x80\x00\x1B\x4F\xB2\x9A\xD5\xEB\xF6\x71\x93\xCF\x93\x8F\x89\xEE\x6C\x6E\x2B\xE6\xAD\x44\xC1\xAB\xFB\x91\x0C\xA1\xD9\xFE\x4A\x4B\xCB\x1C\xA5\x8F\x6C\x8A\x8A\xDA\x4A\xBD\xF9\x15\x91\x34\x51\xA6\x8A\x9D\xE7\x7D\x7D\x11\x3D\x54\xDA\x90\x62\xD1\x83\x0A\x3C\x48\xAC\x46\x50\xA1\x4D\xB4\xA9\xB1\x3C\x9A\xC6\xA2\x22\x27\xE0\x07\xEA\xE6\xA3\x9A\xAD\x72\x23\x9A\xE4\xC1\x51\x74\xA2\xA1\x80\x8D\xC9\x96\xB7\x76\x58\xB2\x4A\xEF\x72\x7B\x91\xAB\x1E\x33\xDC\xD5\x5D\x18\xBF\x0C\x18\x9F\xB5\xCA\xD4\x30\xD8\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x03\xF5\x8B\x1E\xB4\xB9\x54\x63\xC5\xA6\xFA\xB2\x2A\xBD\x29\xD3\xA6\xC4\xC5\x5E\xE5\x5D\x08\x89\xEA\xB8\xA9\xF9\x1A\x1F\xD9\xDB\x20\x7C\x0A\x4D\xCA\xBB\xB5\x1F\xCE\xD4\x6A\xA4\x0A\x6F\x4D\x2D\x6F\xAD\x5C\x3E\x2B\xE4\x9F\x2C\x57\xD5\x00\xE8\x5D\x94\x64\x4D\x1C\x8A\xC9\xB6\x50\x7A\x31\xF7\x39\x18\x54\x97\x55\xBA\x71\x7E\x1A\x1A\x8B\xFA\x2D\xC7\x0F\x9E\x95\xF5\x3E\xD4\x1C\xD7\xB6\xDC\xBE\x4C\x91\xB1\xFB\x9D\xBE\xA7\xF4\xD4\xE6\x2B\x69\x61\xE7\x45\x9E\x4B\x51\x7E\x7E\x89\xF3\xD3\xE8\xA0\x73\x9F\x68\xAC\xBA\x65\xCA\x62\x64\xC5\xB2\xA7\x7A\x34\x5A\x9D\xE9\x75\x1A\xBA\x1F\x55\x31\xC1\x89\xF2\x6E\x3A\x7E\x7F\xE5\x38\x89\xFD\x73\x95\xCE\x57\x39\x55\xCE\x72\xE2\xAA\xBA\x55\x57\xE2\xA7\xF0\x00\x00\x00\x00\x00\x00\x0A\xAD\x3A\xD6\x16\xF9\x9C\xC8\x05\xA7\x5A\xC2\xDF\x33\x99\x00\x0B\xB6\xB5\x9B\xBE\x7F\x32\x92\x95\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\x00\x00\x00\x00\x00\x00\x00\x00\x0F\xA1\xEC\xFA\xC6\xDC\xA4\xCB\x4B\x45\xA6\xA6\x3E\x0C\x8A\xC9\xE2\xA2\x79\xAD\x36\xA2\xB9\xE8\x8B\xF1\xEE\xB5\x4D\xB7\x4A\x9B\x28\xD2\x65\x3A\x4C\x46\x53\x63\x51\xAD\x6B\x53\x04\x6A\x22\x60\x88\x89\xE8\x98\x19\x2B\xD9\xED\x3F\xAD\x2B\x6E\xEA\xB7\xFC\x6E\x35\xB8\x1E\x36\x58\x65\x14\x3C\x95\xC9\xE9\x57\x6B\x82\xE3\x4A\x8B\x7E\xEB\x11\x70\x5A\xAF\x5D\x0D\x6A\x7C\xD5\x7F\x72\x69\xF4\x31\x76\x53\xDF\x66\xE5\x25\xF2\x55\xD6\xE5\x53\xBF\x22\x43\xFB\xCA\x89\x8E\x0C\x4F\x24\x6B\x53\xD1\x11\x34\x1D\xD7\xDA\xA6\x5B\xD9\x6B\xC9\xE8\x68\xE5\x46\x55\xAD\x5A\xB2\xB7\xD1\x55\x8D\x6A\x22\xAF\xF1\xA9\x9D\x80\x00\x00\x00\x00\x00\x00\x00\x00\xAA\xD3\xAD\x61\x6F\x99\xCC\x80\x5A\x75\xAC\x2D\xF3\x39\x90\x00\xBB\x6B\x59\xBB\xE7\xF3\x29\x29\x55\xDB\x5A\xCD\xDF\x3F\x99\x49\x40\x00\x00\x00\x00\x00\x00\x00\x00\xFB\xAE\xC5\x2E\xD0\x6C\xBD\xA1\x41\x9B\x75\x93\x4E\x34\x46\x53\xAC\x8E\xAB\x53\x42\x22\xAD\x35\x44\xFC\x54\xD2\xBF\x94\xBC\x8D\xFD\x61\x83\xFC\x4B\xD0\xC6\x00\x0E\xCF\xED\x1B\x94\xD6\x6C\xA2\xFB\x3D\x99\x2E\x34\x66\xF8\x1E\xF1\xE2\xF8\x6A\xAB\xDC\xEF\x78\x5D\xDC\x74\x7F\x85\x4E\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x5A\x75\xAC\x2D\xF3\x39\x90\x0B\x4E\xB5\x85\xBE\x67\x32\x00\x17\x6D\x6B\x37\x7C\xFE\x65\x25\x2A\xBB\x6B\x59\xBB\xE7\xF3\x29\x28\x00\x00\x00\x00\x00\x00\x00\x00\x1D\x0F\xB0\x3A\x14\x64\xF6\x9B\x6F\xA5\x26\x95\x3A\xB4\xD6\x9D\x65\x56\x54\x6A\x39\x17\xF3\x6A\xA9\xA0\xD5\x79\x96\xD5\xFD\xD9\x07\xFD\x3B\x7A\x19\x3F\xB0\xC9\xF0\xED\xBD\xA4\x40\x93\x71\x97\x1E\x24\x66\xD3\xAC\x8E\xAB\x5E\xA2\x53\x62\x2A\xD3\x54\x44\x57\x2A\xA2\x26\x93\x50\x7D\xB5\xC9\x6F\xD6\x5B\x27\xFB\x85\x2F\xFD\x01\xC6\x3D\xA8\xA1\x44\x87\xF6\x67\xDD\x23\x51\xA1\xDE\xF7\xAE\xF7\x86\xC4\x6F\x7B\xFB\x2C\x31\xC1\x34\xF9\x9C\x20\xED\xFE\xD2\xF7\xAB\x55\xE3\xEC\xE6\x68\xB9\xC1\x9F\xE1\x7B\xCF\x89\xEE\xB2\x1B\x57\xB9\x8F\x85\x87\x7B\xBA\xAB\x86\x38\x2F\x9F\xC0\xE2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\x5D\xB5\xAC\xDD\xF3\xF9\x94\x94\xAA\xED\xAD\x66\xEF\x9F\xCC\xA4\xA0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\x69\xD6\xB0\xB7\xCC\xE6\x40\x2D\x3A\xD6\x16\xF9\x9C\xC8\x00\xA6\xE3\x0A\x5D\x6B\x84\x9A\xB4\x63\x57\xA9\x4D\xF5\x5C\xE6\xB9\xB4\xD5\x51\x51\x55\x7E\x44\xD9\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x00\xCD\xD3\xB6\x29\x3C\x27\x74\x19\xBA\x76\xC5\x27\x84\xEE\x80\x01\x4D\xBA\x14\xBA\x37\x08\xD5\x6B\x46\xAF\x4E\x9B\x2A\xB5\xCE\x73\xA9\xAA\x22\x22\x2A\x7C\x80\x00\x7F\xFF\xD9'
local globals = {
    screen_size = EngineClient.GetScreenSize(),
    username = Cheat.GetCheatUserName(),
    avatar = Render.LoadImage(Http.Get(string.format("https://neverlose.cc/static/avatars/%s.png", Cheat.GetCheatUserName())), Vector2.new(64, 164)),
    default_avatar = Render.LoadImage(img_bytes, Vector2.new(64, 64)),
    local_player,
    autopeek = false,
    autopeekq = false,
    zero_vec = Vector.new(0,0,0),
    autopeek_pos = Vector.new(0,0,0)
}
local shell32 = ffi.load "Shell32"
local smallest_pixel_7_link = "https://cdn.discordapp.com/attachments/897931346373128274/936931900059156500/smallest_pixel-7.ttf"
local arrows_font = "https://cdn.discordapp.com/attachments/976869884464095232/976876821796761710/arrows.ttf"
local indicator_logo = "https://cdn.discordapp.com/attachments/984436727475240960/987625219910959134/pngwing.png"
local avatar_logo = "https://cdn.discordapp.com/attachments/984414333662539837/986556441710186516/unknown.png"
local avatar2_logo = "https://cdn.discordapp.com/attachments/399443531560648714/986875005231063060/logo.png"
local background = "https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png"
local files_dowloaded = false
local cache_size = Render.GetMenuSize()
local image_size = Vector2.new(cache_size.x * 3, cache_size.y * 3)
if package.loaded.readfile('nl\\psycho\\fonts\\smallest-pixel-7.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\arrows.ttf') and package.loaded.readfile('nl\\psycho\\fonts\\pngwing.png') and package.loaded.readfile('nl\\psycho\\fonts\\unknown.png') and package.loaded.readfile('nl\\psycho\\fonts\\logo.png') then
    files_dowloaded = true
else
    files_dowloaded = false
    ffi.C.CreateDirectoryA('nl\\psycho\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\fonts\\', NULL)
    ffi.C.CreateDirectoryA('nl\\psycho\\png\\', NULL)

    ffi_functions.download_file_from_url(smallest_pixel_7_link, 'nl\\psycho\\fonts\\smallest-pixel-7.ttf')
    ffi_functions.download_file_from_url(arrows_font, 'nl\\psycho\\fonts\\arrows.ttf')
    ffi_functions.download_file_from_url(indicator_logo, 'nl\\psycho\\png\\pngwing.png')
    ffi_functions.download_file_from_url(avatar_logo, 'nl\\psycho\\png\\unknown.png')
    ffi_functions.download_file_from_url(avatar2_logo, 'nl\\psycho\\png\\logo.png')
    ffi_functions.download_file_from_url(background, 'nl\\psycho\\png\\background.png')
    files_dowloaded = true
end

if files_dowloaded then
    globals.indicator_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(150, 150))
    globals.logo_avatar = Render.LoadImageFromFile("nl\\psycho\\png\\pngwing.png", Vector2.new(64, 64))
    globals.logo_avatar2 = Render.LoadImageFromFile("nl\\psycho\\png\\logo.png", Vector2.new(64, 64))
    globals.background = Render.LoadImageFromFile("nl\\psycho\\png\\background.png", image_size)

end

local _state = {"Stand","Move","Slow walk","Duck","Air","Crouch in Air"}
local __state = {"[1]","[2]","[3]","[4]","[5]","[6]"}

local ui = {
    global = {
        default_cfg = Menu.Button('Main', 'Config System', 'Load Default Config', ''),
        export_cfg = Menu.Button('Main', 'Config System', 'Export Config', ''),
        import_cfg = Menu.Button('Main', 'Config System', 'Import Config', ''),
        information = Menu.Text('Main', 'Information', 'Welcome, ' ..globals.username),
        information1 = Menu.Text('Main', 'Information', 'Current build: stable'),
        information2 = Menu.Text('Main', 'Information', 'Last update date: 18.06.2022'),


    },

    ragebot = {
        ragebot_enable = Menu.Switch("Ragebot", 'Ragebot', 'Enable Ragebot', false),
        Teleport_In_Air = Menu.Switch("Ragebot", 'Main', 'Teleport In Air', false),
        tp_in_air = Menu.MultiCombo('Ragebot', 'Main', 'Auto Teleport in Air', {'AWP', 'AutoSnipers', 'Scout', 'Deagle', 'Revolver', 'Nades', 'Other', 'Pistols', 'Rifle/LMG', 'SMG', 'Shotgun', 'Taser'}, 0),
        dormant_aimbot = Menu.Switch("Ragebot", 'Main', 'Dormant Aimbot', false),
        dormant_aimbot_damage = Menu.SliderInt("Ragebot", 'Main', 'Minimum Damage', 5, 1, 100),
        override_doubletap = Menu.Switch("Ragebot", "Helpers", "Enable Doubletap Customization", false),
        doubletap_speed = Menu.SliderInt("Ragebot", "Helpers", "Speed", 13, 13, 18),
        doubletap_recharge = Menu.Switch("Ragebot", "Helpers", "Instant Recharge", false),
        bodyaims = Menu.Switch("Ragebot", "Helpers", "Baim if Enemy hp <", false),
        baimmode = Menu.Combo("Ragebot", "Helpers", "Baim Mode", {"Default", "Prefer", "Force"}, 0),
        baimhp = Menu.SliderInt("Ragebot", "Helpers", "Enemy hp <", 0, 0, 100),
        maxmissed = Menu.Switch("Ragebot", 'Helpers', 'Max. Misses', false, 'After Х misses, script disable head for ragebot.'),
        maxmissed_c = Menu.SliderInt("Ragebot", 'Helpers', 'Max. Misses count', 2, 1, 10),
        hitchances = Menu.MultiCombo("Ragebot", 'Helpers', "Custom Hitchance", {"In-Air", "Noscope"}, 0, "Overrides your hitchance on selected conditions. \n In-Air HitChance Works only for Revolver, Scout. \n No-Scope HitChance works only for Auto."),
        air_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "In-Air Hitchance", 20, 0, 100),
        noscope_hitchance = Menu.SliderInt("Ragebot", 'Helpers', "Noscope Hitchance", 40, 0, 100),
    },

    anti_aims = {
        antiaim_enable = Menu.Switch('Anti-Aim', "Anti-Aim System", 'Enable Anti-Aim', false),
        states_selection = Menu.Combo('Anti-Aim', "Custom Anti-Aim System"," Current states",_state, 0),
        antiaim_helpers = Menu.MultiCombo('Anti-Aim', "Helpers", "Anti-Aim Tweaks", {"HS w/o Fakelags", "Animation Breakers", "Disable on Warmup", "Anti-Backstab", "Edge Yaw"}, 0),
        animbreakers = Menu.MultiCombo('Anti-Aim', 'Helpers', "Anim Breakers", {"On Ground", "Static Legs in Air ", "Pitch 0 on land"}, 0),

    },

    visuals = {
        visuals_enable = Menu.Switch('Visuals', 'Visuals', 'Enable Visuals System', false),
        widgets = Menu.MultiCombo("Visuals", "Main", "Widgets", {"Keybinds", "Spectators", "Watermark", "Panel", 'Indicators', "Logs"}, 0),
        watermark_info = Menu.MultiCombo("Visuals", "Main", "Watermark Info", {"Username", "FPS", "Delay", "Tickrate", "Time"}, 0),
        statepanel_image = Menu.Combo("Visuals", "Main", "Image Type", {"Disable", "Avatar", "Ghosty", "Avatar and Ghosty"}, 0),
        custom_username = Menu.TextBox("Visuals", "Main", "Custom Username", 64, Cheat.GetCheatUserName()),
        theme = Menu.ColorEdit("Visuals", "Main", "Widgets Color", Color.new(1, 1, 1, 0.25)),
        disable_blur = Menu.Switch('Visuals', 'Main', 'Disable Widgets Blur', false),
        disable_background = Menu.Switch('Visuals', 'Main', 'Disable Indicators Background', false),
        log_type = Menu.MultiCombo('Visuals', "Main", 'Logs Type', {'Widgets Style','Defaul Style', 'Console'}, 0),
        indicator_type = Menu.Combo("Visuals", "Main", "Indicator Type", {"Default", "Ghosty"}, 0),
        arrows = Menu.Combo("Visuals", "Main", "Arrows Type", {"Disable", "Default", "Modern", "Classic"}, 0),
        arrows_x = Menu.SliderInt('Visuals', 'Main', 'Arrows X Add', 0, 0, 100),
        ghosty_color = Menu.ColorEdit("Visuals", "Main", "Ghosty Color", Color.new(1, 1, 1, 1)),
        ind_name_color = Menu.ColorEdit("Visuals", "Main", "Indicator Name Color", Color.new(1, 1, 1, 1)),
        ind_state_color = Menu.ColorEdit("Visuals", "Main", "Indicator State Color", Color.new(1, 1, 1, 1)),
        ind_color = Menu.ColorEdit("Visuals", "Main", "Indicator Binds Color", Color.new(1, 1, 1, 1)),
        arrows_color = Menu.ColorEdit("Visuals", "Main", "Arrows Color", Color.new(1, 1, 1, 1)),
        custom_scope = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Scope Customization ", false, Color.new(1, 1, 1, 1)),
        scope_width = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Width", 80, 0, 300),
        scope_offset = Menu.SliderInt("Visuals", "Miscellaneous", "Scope Lines Offset", 10, 0, 300),
        scope_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Scope Conditions", {"Invert Lines", "Disable Animations", "Scope Viewmodel", "Disable Arrows"}, 0),
        desync_circle = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Desync Circle", false, Color.new(0.57, 0.57, 1, 1)),
        desync_circle_conditions = Menu.MultiCombo("Visuals", "Miscellaneous", "Circle Conditions", {"Fake Based Color", "Remove Crosshair"}, 0),
        hitmarker = Menu.SwitchColor("Visuals", "Miscellaneous", "Enable Hitmarker", false, Color.RGBA(255, 255, 255)),
        hitmarker_length = Menu.SliderInt("Visuals", "Miscellaneous", "Hitmarker Length", 6, 2, 10),
        gamesense = Menu.Switch("Visuals", "Miscellaneous", "Enable Gamesense Indicators", false),
        gamesense_choose = Menu.MultiCombo("Visuals", "Miscellaneous", "Choose Indicators", {"Min Damage", "Dormant Aimbot", "Ping", "Bomb Info", "LC", "Fakeduck","Doubletap", "Hideshots", "Freestanding", "Force Body", "Safe Points"}, 0),

    },

    world = {
        world_enable = Menu.Switch('World', 'World Customization', 'Enable World Customization', false),
        sunset = Menu.Switch('World', 'World', 'Sunset Mode', false),
        shadow_x = Menu.SliderFloat('World', 'World', 'Sunset X', 0, -200, 200),
        shadow_y = Menu.SliderFloat('World', 'World', 'Sunset Y', 0, -200, 200),
        shadow_z = Menu.SliderFloat('World', 'World', 'Sunset Z', 0, -200, 200),
        shadow_dist = Menu.SliderInt('World', 'World', 'Sunset Distance', 1000, 0, 1500),
        custom_skybox = Menu.SwitchColor("World", 'World', "Custom Skybox Changer", false, Color.RGBA(255, 255, 255)),
        skybox_choose = Menu.TextBox("World", "World", 'Skybox Path', 64, "", "You can found skybox name in csgo/materials/skybox"),
        molly_conditions = Menu.MultiCombo("World", "Miscellaneous", "Molotov Conditions", {"Wireframe", "Ignore-Z"}, 0),
        enable_bloom = Menu.Switch("World", "Miscellaneous",  "Enable Effects", false),
        bloom = Menu.SliderFloat("World", "Miscellaneous",  "Bloom", 0, 0.0, 100.0),
        exposure = Menu.SliderFloat("World", "Miscellaneous", "Exposure", 0, 0.0, 100.0),
        model_ambient = Menu.SliderFloat("World", "Miscellaneous",  "Model Ambient", 0, 0.0, 100.0),
    },

    misc = {
        misc_enable = Menu.Switch("Miscellaneous", "Miscellaneous", "Enable Miscellaneous", false),
        clantag = Menu.Switch("Miscellaneous", "Helpers", "Enable Clantag", false),
        slowwalk_c = Menu.Switch("Miscellaneous", "Helpers", "Custom Slow Walk", false),
        slowwalk_slider = Menu.SliderInt("Miscellaneous", "Helpers", "Custom Speed", 50, 0, 150),
        hitsound = Menu.Switch("Miscellaneous", "Helpers", "Hitsound Customization", false),
        hitsound_direction = Menu.TextBox("Miscellaneous", "Helpers", "Sound Directory", 128, "csgo/sound/name.wav", "csgo/sound/name.wav"),
        hitsound_volume = Menu.SliderFloat("Miscellaneous", "Helpers", "Sound Volume", 1, 0, 1),
        menu_customize = Menu.Switch("Main","Menu Customization", "Enable Menu Customization", false),
        menu_glow = Menu.Switch("Main","Menu Customization", "Menu Glow", false, "Glow around the Menu."),
        glow_pulse = Menu.Switch("Main","Menu Customization", "Glow Pulse", false),
        color_edit = Menu.ColorEdit("Main","Menu Customization", "Glow Color", Color.RGBA(0, 0, 0, 200), "Pick a color."),
        menu_dim = Menu.Switch("Main", "Menu Customization", "Menu Dim", false, "Dims the Background."),
        dim_slider = Menu.SliderFloat("Main", "Menu Customization", "Dim Intensity:", 0.3, 0.1, 1),
        menu_blur = Menu.Switch("Main", "Menu Customization", "Menu Blur", false, "Blur the Background."),
        blur_slider = Menu.SliderFloat("Main", "Menu Customization", "Blur Intensity:", 0.3, 0.1, 1),
        thirdperson = Menu.Switch("Miscellaneous", "Helpers", "Thirdperson Customization", false),
        thirdperson_anim = Menu.Switch("Miscellaneous", "Helpers", "Disable Thirdperson Animation", false),
        thirdperson_distance = Menu.SliderInt("Miscellaneous", "Helpers", "Distance Value", 100, 0, 300),
        autopeek = Menu.SwitchColor("Miscellaneous", "Helpers", "Auto Peek",false,Color.new(1,0,0,1)),
        color_override = Menu.SwitchColor("Miscellaneous", "Helpers", "Override Color When Work",false, Color.new(0,1,0,1)),
        quick_peek = Menu.Switch("Miscellaneous", "Helpers", "Quick Peek",false),
    },

    refs = {
        slowwalk = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk'),
        minimum_damage = Menu.FindVar('Aimbot', 'Ragebot', 'Accuracy', 'Minimum Damage'),
        doubletap = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'),
        hideshots = Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'),
        autopeek = Menu.FindVar('Miscellaneous', 'Main', 'Movement', 'Auto Peek'),
        yaw_base = Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Base'),
        invert_side = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Inverter"),
        fakelags = Menu.FindVar("Aimbot", 'Anti Aim',"Fake Lag", "Enable Fake Lag"),
        antiaim = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Enable Anti Aim"),
        fakeduck = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Fake Duck'),
        safepoints = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'),
        bodyaim = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Body Aim'),
        scope = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope"),

        aa_pitch = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Pitch"),
        aa_yaw_base = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Base"),
        aa_yaw_add = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Add"),
        aa_yaw_modifier = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Yaw Modifier"),
        aa_yaw_modifier_degree = Menu.FindVar("Aimbot", 'Anti Aim', "Main", "Modifier Degree"),
        aa_limit_left = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Left Limit"),
        aa_limit_right = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Right Limit"),
        aa_fake_options = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Fake Options"),
        aa_lby_mode = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "LBY Mode"),
        aa_freestanding_desync = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Freestanding Desync"),
        aa_desync_onshot = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Angle", "Desync On Shot"),
        aa_fakelag_limit = Menu.FindVar("Aimbot", 'Anti Aim', "Fake Lag", "Limit"),

        legs = Menu.FindVar("Aimbot", 'Anti Aim', "Misc", "Leg Movement"),

        skybox = Menu.FindVar("Visuals", "World", "Main", "SkyBox")
    }
}
ui.anti_aims.custom = {}
for k, v in pairs(_state) do
    ui.anti_aims.custom[k] = {
        enable = Menu.Switch('Anti-Aim', "Custom Anti-Aim System","Enable ".._state[k].. " setting", false),
        extra_options = Menu.MultiCombo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Extra Options", {'[-] Jitter w Choke'}, 0),
        yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Built-In",{"Static","Period Jitter [Tick]","Period Jitter [Choke]","Period Jitter [Desync]"}, 0),
        static_yaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Yaw Modifier",0, -80,80),
        tick_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Left",0, -80, 0),
        tick_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Tick Yaw Right",0, 0, 80),
        choke_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Left",0, -80, 0),
        choke_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Choke Yaw Right",0, 0, 80),
        desync_yaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Left",0, -80, 0),
        desync_yaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Yaw Right",0, 0, 80),
        yaw_jitter = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Mode",{ "Off", "Center", "Offset", "Randomized" }, 0),
        yaw_jitter_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Yaw Jitter",{ "Static", "Randomized" }, 0),
        yaw_jitter_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [1]",0, 0,120),
        yaw_jitter_degree2 = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Jitter Degree [2]",0, 0,120),
        self_bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Psycho Body Yaw",{ "Off", "Opposite", "Jitter", "Static"}, 0),
        bodyyaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body Yaw Built-In",{"Off", "Static","Period jitter","Recursion"}, 0),
        bodyyaw_degree = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier",0, -180,180),
        jitter_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier left [Period]",0, -180,180),
        jitter_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier right [Period]",0, -180,180),
        body_yaw_step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion ticks ",1,0,15),
        body_yaw_step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Recursion value",5,0,180),
        step_bodyyaw_degree_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier min [Recursion]",0,-180,180),
        step_bodyyaw_degree_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Body yaw modifier max [Recursion]",0,-180,180),
        fake_yaw_mode = Menu.Combo('Anti-Aim', "Custom Anti-Aim System",__state[k].." Desync Built-In",{"Static","Period Tick Jitter","Gradually Increase"}, 0),
        static_fakeyaw = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Yaw Limit",58, 0,60),
        jitter_fakeyaw_left = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Left",30, 0,60),
        jitter_fakeyaw_right = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Period Limit Right",30,0,60),
        step_ticks = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Ticks",8, 1,15),
        step_value = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Gradually Value",5, 1,60),
        step_abs = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Increment Absolute Value",false),
        step_fake_min = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Min",58, 0,60),
        step_fake_max = Menu.SliderInt('Anti-Aim', "Custom Anti-Aim System",__state[k].." Fake Limit Max",58, 0,60),
        freestanding_bodyyaw = Menu.Switch('Anti-Aim', "Custom Anti-Aim System",__state[k].." Freestanding Body Yaw",false)
    }
end

local fonts = {
    verdana = Render.InitFont("Verdana", 11, {"r"}),
    pixel = Render.InitFont("nl\\psycho\\fonts\\smallest-pixel-7.ttf", 9) or error and Render.InitFont('Smallest Pixel-7.ttf', 9),
    verdanabd11 = Render.InitFont('Verdana', 11, {'b'}),
    verdana11 = Render.InitFont('Verdana', 15, {'b'}),
    arrow_fonts = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 24),
    arrow_font2 = Render.InitFont("nl\\psycho\\fonts\\arrows.ttf", 16),
    lucida_console = Render.InitFont('lucida console', 10, {'r'}),
    calibrib24 = Render.InitFont('calibri', 24, {'b'})
}

function C_BasePlayer:CanHit() trace_info = Cheat.FireBullet(self, self:GetEyePosition(), EntityList.GetLocalPlayer():GetEyePosition()) if trace_info.damage > 0 and ((trace_info.trace.hit_entity and trace_info.trace.hit_entity:GetPlayer() == EntityList.GetLocalPlayer()) or false) then     return true end return false end
function C_BasePlayer:GetVelocity() first_velocity = self:GetProp('m_vecVelocity[0]') second_velocity = self:GetProp('m_vecVelocity[1]') speed = math.floor(math.sqrt(first_velocity * first_velocity + second_velocity * second_velocity)) return speed end
function C_BasePlayer:GetFlag(shift) return bit.band(self:GetProp('m_fFlags'), bit.lshift(1, shift)) ~= 0 end

stuff = {}
local missgroup_names = { 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }
local miss_reason = { '?', 'spread', 'occlusion', 'prediction error' }

-- @region: math
local adjust_angle = function(angle)
    if(angle < 0) then
        angle = (90 + angle * (-1))
    elseif(angle > 0) then
        angle = (90 - angle)
    end
    return angle
end

local function breath(speed, need)
    need = need or 255
       return math.sin(math.abs(-math.pi + ((GlobalVars.curtime) * (speed / .75)) % (math.pi * 2))) * need
end

local function time_to_ticks(a)
    return math.floor(0.5 + a / GlobalVars.interval_per_tick)
end

function round(x)
    return x >= 0 and math.floor(x+0.5) or math.ceil(x-0.5)
end

function yaw_normalize(yaw)
    if yaw > 180 or yaw < -180 then
        local revolutions = round(math.abs(yaw / 360))
        if yaw < 0 then yaw = yaw + 360*revolutions else yaw = yaw - 360*revolutions end
    end
    return yaw
end

local math_lua = {
    dist_to = function(self,a,b)
        local delta_x = a.x - b.x;
        local delta_y = a.y - b.y;
        return self.round(math.sqrt(delta_x^2 + delta_y^2))
    end,
    round = function(a, b)
        local c = 10^(b or 0)
        return math.floor(a*c+0.5)/c
    end,
    clamp = function(x, y, z)
        if x < y then return y
        elseif x > z then return z
        else return x end
    end
}
local animations = {
    lerp = function(a, b, p)
        return a + (b - a) * p
    end
}

local function num_format(b) local c=b%10;if c==1 and b~=11 then return b..'st'elseif c==2 and b~=12 then return b..'nd'elseif c==3 and b~=13 then return b..'rd'else return b..'th'end end
shot_id = 0
hit_ids = 0
total_hits = 0

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

local helpers = {
    fps_update_time = 0,
    fps = 0,

    text_shadow = function(self, text, pos, color, size, font, centered)
        local centered = centered or false
        Render.Text(text, pos + Vector2.new(1, 1), Color.new(0, 0, 0, color.a * 0.75), size, font, false, centered)
        Render.Text(text, pos, color, size, font, false, centered)
    end,

    mouse_in_bounds = function(self, s, e)
        local mouse_pos = Cheat.GetMousePos()
        return mouse_pos.x > s.x and mouse_pos.x < e.x and mouse_pos.y > s.y and mouse_pos.y < e.y
    end,

    lerp = function(self, x, y, perc)
        local perc = perc or 0.1
        return x + (y - x) * perc
    end,

    copy_color = function(self, c)
        return Color.new(c.r, c.g, c.b, c.a)
    end,

    alpha_modulate = function(self, c, a)
        return Color.new(c.r, c.g, c.b, a)
    end,

    get_fps = function(self)
        if GlobalVars.realtime - self.fps_update_time > 0.5 then
            self.fps = 1 / GlobalVars.frametime
        end

        return self.fps
    end,

    get_time = function(self)
        local sys_time = ffi.new("SYSTEMTIME[1]")
        ffi.C.GetLocalTime(sys_time)
        return ('%02d:%02d:%02d'):format(sys_time[0].wHour, sys_time[0].wMinute, sys_time[0].wSecond)
    end,

    clantag_cache = "",

    clantag_fn = ffi.cast('int(__fastcall*)(const char*, const char*)', Utils.PatternScan('engine.dll', '53 56 57 8B DA 8B F9 FF 15')),

    set_clantag = function (self, tag)
        if tag ~= self.clantag_cache then
            self.clantag_fn(tag, tag)

            self.clantag_cache = tag
        end
    end,
}


-- Check/Download Files
local C = ffi.C

ffi.cdef[[
    void*GetModuleHandleA(const char*);
    void*GetProcAddress(void*,const char*);
    bool TerminateThread(void*,unsigned long);
    bool GetExitCodeThread(void*,unsigned long*);
  
    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 Winmm = ffi.load("Winmm")

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

local function file_exists(file, path_id)
    local func_file_exists = ffi.cast("bool (__thiscall*)(void*, const char*, const char*)", ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011"))[0][10])
    return func_file_exists(ffi.cast(ffi.typeof("void***"), Utils.CreateInterface("filesystem_stdio.dll", "VBaseFileSystem011")), file, path_id)
end

local create_simple_thread = ffi.cast("void*(__cdecl*)(intptr_t, intptr_t, size_t)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "CreateSimpleThread"))
local release_thread_handle = ffi.cast("bool(__cdecl*)(void*)", C.GetProcAddress(C.GetModuleHandleA("tier0.dll"), "ReleaseThreadHandle"))

if not file_exists(EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png", "GAME") then
    Download("https://cdn.discordapp.com/attachments/717467105703886908/974324754880299039/background.png", EngineClient.GetGameDirectory() .. "\\resource\\glow_background.png")
end

local autopeek = {
    is_alive = function(ent)
        return ent:GetProp("m_iHealth") > 0
    end,
    set_movement = function(self,cmd,vec)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local lc_pos = lc:GetRenderOrigin()
        local angles = EngineClient.GetViewAngles()
        local moveTo_x = lc_pos.x - vec.x
        local moveTo_y = lc_pos.y - vec.y
        local tv_x = -20*(moveTo_x * math.cos(angles.yaw / 180 * math.pi) + moveTo_y * math.sin(angles.yaw / 180 * math.pi))
        local tv_y = 20*(moveTo_y * math.cos(angles.yaw / 180 * math.pi) - moveTo_x * math.sin(angles.yaw / 180 * math.pi))
        cmd.forwardmove = tv_x
        cmd.sidemove = tv_y
    end,
    autopeek_main = function(self,cmd)
        local is_m1 = bit.band(cmd.buttons, 1) == 1
        local is_w = bit.band(cmd.buttons, 8) == 8
        local is_s = bit.band(cmd.buttons, 16) == 16
        local is_r = bit.band(cmd.buttons, 512) == 512
        local is_l = bit.band(cmd.buttons, 1024) == 1024
        globals.lp = EntityList.GetLocalPlayer()
        globals.lp_pos = globals.lp:GetRenderOrigin()
        globals.is_in_air = bit.band(globals.lp:GetProp("m_hGroundEntity"), 1)
        if is_m1 then
            globals.autopeek = true
        end
        if not is_w and not is_s and not is_r and not is_l and math_lua:dist_to(globals.lp_pos,globals.autopeek_pos) > 1 and ui.misc.quick_peek:Get() and ui.misc.misc_enable:Get() then
            globals.autopeekq = true
        else
            globals.autopeekq = false
        end
        if not ui.misc.autopeek:Get() then
            if globals.is_in_air == 1 then
                globals.autopeek_pos = EngineTrace.TraceRay(globals.lp_pos,Vector.new(globals.lp_pos.x, globals.lp_pos.y, globals.lp_pos.z-10000), globals.lp, 0xFFFFFFFF).endpos + globals.zero_vec
            else
                globals.autopeek_pos = globals.lp_pos + globals.zero_vec
            end
            globals.autopeek = false
        else
            if ((globals.autopeek and math_lua:dist_to(globals.lp_pos, globals.autopeek_pos) > 1) or globals.autopeekq) then
                if globals.is_in_air == 0 then
                    self:set_movement(cmd,globals.autopeek_pos)
                end
            else
                globals.autopeek = false
                globals.autopeekq = false
            end
        end
    end,
    ragebot_shot = function(shot)
        globals.autopeek = true
    end,
    paint_function = function(self)
        local lc = EntityList.GetLocalPlayer()
        if not lc or not self.is_alive(lc) then return end
        local ap_c = ui.misc.autopeek:GetColor()
        if ui.misc.color_override:Get() and ui.misc.misc_enable:Get() then
            if globals.autopeek or globals.autopeekq then
                ap_c = ui.misc.color_override:GetColor()
            else
                ap_c = ui.misc.autopeek:GetColor()
            end
        end
        if ui.misc.autopeek:Get() and ui.misc.misc_enable:Get() then
            for i = 1,40 do
                Render.Circle3DFilled(
                    globals.autopeek_pos,
                    60,
                    i/2,
                    Color.new(
                        ap_c.r,
                        ap_c.g,
                        ap_c.b,
                        ap_c.a*0.03),
                    false)
            end
        end
    end
}

-- @region: ragebot
local rage = {}
rage.data = {}

rage.fix_ang = function(angles)
    while angles.pitch < -180.0 do
        angles.pitch = angles.pitch + 360.0
    end
    while angles.pitch > 180.0 do
        angles.pitch = angles.pitch - 360.0
    end

    while angles.yaw < -180.0 do
        angles.yaw = angles.yaw + 360.0
    end
    while angles.yaw > 180.0 do
        angles.yaw = angles.yaw - 360.0
    end

    if angles.pitch > 89.0 then
        angles.pitch = 89.0
    elseif angles.pitch < -89.0 then
        angles.pitch = -89.0
    end
    if angles.yaw > 180.0 then
        angles.yaw = 180.0
    elseif angles.pitch < -180.0 then
        angles.pitch = -180.0
    end

    return angles
end

rage.vec_ang = function(src, dist)
    local forward = dist - src

    if forward.x == 0 and forward.y == 0 then
        local yaw = 0

        if forward.z > 0 then
            pitch = 270
        else
            pitch = 90
        end

    else
        yaw = (math.atan2(forward.y, forward.x) * 180 / math.pi)
        if yaw < 0 then
            yaw = yaw + 360
        end

        tmp = math.sqrt(forward.x * forward.x + forward.y * forward.y)
        pitch = (math.atan2(-forward.z, tmp) * 180 / math.pi)

        if pitch < 0 then
            pitch = pitch + 360
        end

    end

    return rage.fix_ang(QAngle.new(pitch, yaw, 0))
end
rage.modify_velocity = function(cmd, goalspeed)
    local minspeed = math.sqrt((cmd.forwardmove * cmd.forwardmove) + (cmd.sidemove * cmd.sidemove))
    if goalspeed <= 0 or minspeed <= 0 then
        return
    end

    if EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') >= 1 then
        goalspeed = goalspeed * 2.94117647
    end

    if minspeed <= goalspeed then
        return
    end

    local speedfactor = goalspeed / minspeed
    cmd.forwardmove = cmd.forwardmove * speedfactor
    cmd.sidemove = cmd.sidemove * speedfactor
end
rage.roundStarted = 0
rage.player_info_prev = {}
for i = 1, 64 do
    rage.player_info_prev[i] = {
        origin = Vector.new(0, 0, 0),
    }
end


local baim = ui.refs.bodyaim:Get()

rage.baim = function()

    if not ui.ragebot.ragebot_enable:Get() and ui.ragebot.bodyaims:Get() then return end
    local all_players = EntityList.GetEntitiesByName("CCSPlayer")
    for i = 1, #all_players do
        local target = all_players[i]:GetPlayer()
        if target ~= EntityList.GetLocalPlayer() and not target:IsTeamMate() and target:GetProp("m_iHealth") > 0 then

        local me = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        local weap = target:GetActiveWeapon()

        local hp = target:GetProp('m_iHealth')
            if ui.ragebot.baimmode:Get() == 0 then
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 1 then
                ui.refs.bodyaim:SetInt(1)
            else
                ui.refs.bodyaim:SetInt(baim)
            end
            if weap ~= nil and hp < ui.ragebot.baimhp:GetInt() and ui.ragebot.baimmode:Get() == 2 then
                ui.refs.bodyaim:SetInt(2)
            else
                ui.refs.bodyaim:SetInt(baim)
            end

        end
    end

end

rage.hitchances = function()

    local accepted_weapons = {
        ["261"] = 1,
        ["242"] = 1,
    }
    local accepted_weapons2 = {
        ["267"] = 1,
        ["46"] = 1,
    }

    local get_enemies = function()
        local ret = {}
        local players = EntityList.GetPlayers()
        for _ , player in pairs(players) do     
            if player:IsTeamMate() or not player:IsAlive() or player:IsDormant() then goto s end

            ret[#ret+1] = player:EntIndex()
            ::s::
        end

        return ret
    end

    if not ui.ragebot.ragebot_enable or ui.ragebot.hitchances == 0 then return end
  
    local i = get_enemies()
    local air_check = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1) == 0 and ui.ragebot.hitchances:Get(1) and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons2[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]
    local wpn_check = ui.ragebot.hitchances:Get(2) and EntityList.GetLocalPlayer():GetProp("m_bIsScoped")==false and EntityList.GetLocalPlayer():GetActiveWeapon() and accepted_weapons[""..EntityList.GetLocalPlayer():GetActiveWeapon():GetClassID()]

    if (not air_check and not wpn_check)  then return end

    for k,v in pairs(i) do
        RageBot.OverrideHitchance(v , (air_check==1 and ui.ragebot.air_hitchance:Get() or ui.ragebot.noscope_hitchance:Get()))
    end
end

rage.ragebot = function(cmd)
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer or not localplayer:IsAlive() then
        return
    end

    if not ui.ragebot.ragebot_enable:Get() or not ui.ragebot.override_doubletap:Get() then return end

    if ui.ragebot.override_doubletap:Get() then
        Exploits.OverrideDoubleTapSpeed(ui.ragebot.doubletap_speed:Get()) 
    end

    if ui.ragebot.doubletap_recharge:Get() then
        Exploits.ForceCharge()
    end

end

rage.dormant_aim = function(cmd)
    if ui.ragebot.dormant_aimbot:GetBool() then
        local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
        if lp == nil then return end
        rage.can_hit_i = false
        rage.choke = false
        local ent = lp:GetActiveWeapon()
        if not ent then return end
        local inaccuracy = 1 / ent:GetInaccuracy(ent)
        if inaccuracy == nil then return end
        local tickcount = GlobalVars.tickcount
        local eyepos = lp:GetEyePosition()
        local simtime = lp:GetProp('m_flSimulationTime')
        local weapon = ent:GetWeaponID()
        local scoped = lp:GetProp('m_bIsScoped')
  
        local onground = bit.band(lp:GetProp('m_fFlags'), bit.lshift(1, 0))
        if tickcount < rage.roundStarted then return end -- to prevent shooting at ghost dormant esp @ the beginning of round
        local is_AWP = weapon == 9
        local is_auto = (weapon == 38 or weapon == 11)
        local is_scout = weapon == 40
        if ent:IsKnife() or ent:IsGrenade() or ent:IsReloading() or weapon == 31 then return end
        local hs_fix = ui.refs.hideshots:GetBool() and 0.3 or 0
        if weapon == 64 then -- for some reason can_shoot returns always false with r8 despite all 3 props being true, no idea why
            rage.can_shoot = simtime > ent:GetProp('m_flNextPrimaryAttack') + hs_fix -- doing this fixes it ><
        elseif ent:IsPistol() and not weapon == 64 and not weapon == 1 then
            rage.can_shoot = false
        else
            rage.can_shoot = simtime > math.max(lp:GetProp('m_flNextAttack') + hs_fix, ent:GetProp('m_flNextPrimaryAttack') + hs_fix, ent:GetProp('m_flNextSecondaryAttack'))
        end
  
        -- new player info
        local players = EntityList.GetEntitiesByName('CCSPlayer')
        rage.player_info = {}
        for i = 1, #players do
            local player = players[i]:GetPlayer()
            if EngineClient.IsConnected() and lp:IsAlive() then
                --if plist_get(player, 'Add to whitelist') then goto skip end
                if player:IsDormant() and not player:IsTeamMate() and player:GetProp('m_iHealth') > 0 and player ~= lp then
                    if player:GetRenderOrigin():Length2D() > ent:GetWeaponRange() then return end
                    rage.origin = player:GetProp('m_vecOrigin')
                    rage.alpha_multiplier = player:GetESPAlpha() -- grab alpha of the dormant esp
                    if rage.player_info_prev[i] ~= nil and rage.origin.x ~= 0 and rage.alpha_multiplier > 0 then -- if origin / dormant esp is valid
                        local dormant_accurate = rage.alpha_multiplier > 0.1 -- for debug purposes lower this to 0.1
                        if dormant_accurate then
                            local target_points = {
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 28) or Vector.new(0, 0, 38)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 30) or Vector.new(0, 0, 40)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 32) or Vector.new(0, 0, 42)),
                                rage.origin + (player:GetProp('m_flDuckAmount') >= 1 and Vector.new(0, 0, 40) or Vector.new(0, 0, 50))
                            }
                      
                            for i = 1, #target_points do
                                local target = target_points[i]
                                local target_pos = rage.vec_ang(eyepos, target)
                                local dmg = Cheat.FireBullet(lp, eyepos, target)
                                if is_AWP then
                                    max_player_speed_alt = 100
                                elseif is_auto then
                                    max_player_speed_alt = 120
                                else
                                    max_player_speed_alt = ent:GetMaxSpeed() * 0.86
                                end
                                rage.can_hit = (dmg.trace.hit_entity == nil or dmg.trace.hit_entity:EntIndex() == player:EntIndex()) and (dmg.damage > ui.ragebot.dormant_aimbot_damage:GetInt()) and (not player:IsVisible(target)) -- added visibility check to mitigate shooting at anomalies?
                              
                                if rage.can_hit then
                                    rage.can_hit_i = true
                                    if rage.can_shoot then
                                        rage.modify_velocity(cmd, (scoped and max_player_speed_alt or ent:GetMaxSpeed())*0.2)
                                        -- autoscope
                                        if not scoped and ent:IsSniper() and onground == 1 then
                                            cmd.buttons = bit.bor(cmd.buttons, 2048)
                                        end
                                    end
                                  
                                    if ui.refs.hideshots:GetBool() then
                                        rage.choke = rage.can_shoot
                                    else
                                        rage.choke = true
                                    end
                                  
                                    if inaccuracy >= 90 and rage.choke == true then
                                        cmd.viewangles.pitch = target_pos.pitch
                                        cmd.viewangles.yaw = target_pos.yaw
                                        cmd.viewangles.roll = 0
                                        cmd.buttons = bit.bor(cmd.buttons, 1)
                                        -- dont shoot again
                                        rage.can_shoot = false
                                    end
                                end
                            end
                        end
                    end
                    rage.player_info[i] = {rage.origin, rage.alpha_multiplier, rage.can_hit_i}
                end
            end
        end
        rage.player_info_prev = rage.player_info
    end
end

rage.resetter = function(event)
    if not ui.ragebot.dormant_aimbot:Get() then return end
    if event:GetName() ~= 'round_prestart' then return end
    local lp = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()):GetPlayer()
    if lp == nil then return end
    freezetime = (CVar.FindVar('mp_freezetime'):GetFloat()+1) / GlobalVars.interval_per_tick -- get freezetime plus 1 second and disable dormantbob for that amount of ticks
    rage.roundStarted = GlobalVars.tickcount + freezetime
    rage.origin = nil
    rage.player_info_prev = {}
    for i = 1, 64 do
        rage.player_info_prev[i] = {
            origin = Vector.new(0, 0, 0),
        }
    end
    rage.player_info = {}
end

rage.on_registered_shot = function(shot)
    if shot.reason ~= 1 then return end
  
    if not rage.data[shot.target_index] then
        rage.data[shot.target_index] = {
            esp_bool = false,
            shots = 0,
        }
    end

    rage.data[shot.target_index].shots = rage.data[shot.target_index].shots + 1
end

rage.on_prediction = function()
    if not ui.ragebot.maxmissed:Get() and ui.ragebot.ragebot_enable:Get() then return end
  
    for player_index, data in pairs(rage.data) do
        if data.shots >= ui.ragebot.maxmissed_c:Get() then
            data.esp_bool = true

            RageBot.EnableHitbox(player_index, 0, false)
        end
    end
end

rage.reset_data = function(event)
    if event:GetName() ~= 'round_start' then return end
  
    rage.data = {}
end

-- @endregion

-- @region: misc
local misc = {}
misc.slowwalk = function(cmd)
    if not ui.misc.slowwalk_c:GetBool() then return end
        if cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = ui.misc.slowwalk_slider:GetInt() end
        if cmd.forwardmove < 0 and -cmd.forwardmove >= ui.misc.slowwalk_slider:GetInt() then cmd.forwardmove = -ui.misc.slowwalk_slider:GetInt() end
        if cmd.sidemove < 0 and -cmd.sidemove >= ui.misc.slowwalk_slider:GetInt() then cmd.sidemove = -ui.misc.slowwalk_slider:GetInt() end
end

local clantag_restore = false
-- clantag
misc.clantag = function()
    local localplayer = EntityList.GetLocalPlayer()
    if not localplayer then return end

    if ui.misc.clantag:Get() and ui.misc.misc_enable:Get() then
        local tag =
        {
            "ps",
            "psy",
            "psyc",
            "psych ",
            "psycho",
            "psycho ",
            "psych",
            "psyc",
            "psy",
            "ps",
            "p",
            "",

        }

        local netchann_info = EngineClient.GetNetChannelInfo()

        if netchann_info == nil then
            return
        end

        local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
        local tickcount_pred = GlobalVars.tickcount + latency
        local iter = math.floor(math.fmod(tickcount_pred / 32, #tag) + 1)
      
        helpers:set_clantag(tag[iter])
        clantag_restore = false

    elseif not clantag_restore then
        helpers:set_clantag("") 
    end
end

local t = {}
misc.removeimpact = function()
    if #t == nil then
        return
    end

    if not EngineClient.IsConnected() then
        table.remove(t, #t)
        return
    end

    for i = 1, #t do
        if t[i] == nil then
            return
        end

        if t[i].ctime + 4 > math.floor(GlobalVars.curtime) then
            return
        end

        t[i].a = t[i].a - math.floor(GlobalVars.frametime * 300)

        if t[i].a < 0 then
            table.remove(t, i)
        end
    end
end
-- @endregion

-- @region: anti-aims
local anti_aims = {}
local flag_status = 0

AntiAim.jitter = {}
AntiAim.jitter.c_var = {
    choke = 0,
    yaw_v = 0,
    yaw_r = 1,
    byaw_v = 0,
    byaw_r = 1,
    fyaw_v = 0,
    fyaw_r = 0
}

AntiAim.c_var = {
    c = 1,
    ground_ticks = 0,
    step_ticks = 0,
    min = 0,
    max = 0,
    step = 0,
    return_value = 0,
    bodystep_ticks = 0,
    bodystep_min = 0,
    bodystep_max = 0,
    bodystep_step = 0,
    bodystep_return_value = 0
}

AntiAim.save_antiaims = {
    pitch = "Off",
    yaw_base = "Local view",
    yaw_1 = "Off",
    yaw_2 = 0,
    yaw_jitter_1 = "Off",
    yaw_jitter_2 = 0,
    body_yaw_1 = "Off",
    body_yaw_2 = 0,
    fake_yaw_limit = 0,
    freestanding_body_yaw = false
}

function AntiAim.jitter:tick(a,b)
    return GlobalVars.tickcount % 4 >= 2 and a or b
end

function AntiAim.jitter:choke_yaw(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.yaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.yaw_r = AntiAim.jitter.c_var.yaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.yaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
  
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end

function AntiAim.jitter:normalize_yaw(p)
    while p > 180 do
        p = p - 360
    end
    while p < -180 do
        p = p + 360
    end
    return p
end

function AntiAim.jitter:choke_body_yaw(a,b)
    local inverted = AntiAim.GetInverterState()
    local invert = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return invert and a or b
    end
end

function AntiAim.jitter:choke_fake(a,b)
    if GlobalVars.tickcount - AntiAim.jitter.c_var.fyaw_v > 1  and AntiAim.jitter.c_var.choke == 1 then
        AntiAim.jitter.c_var.fyaw_r = AntiAim.jitter.c_var.fyaw_r == 1 and 0 or 1
        AntiAim.jitter.c_var.fyaw_v = GlobalVars.tickcount
    end
    local inverted = AntiAim.GetInverterState()
  
    if a == 60 or b == 60 then
        return inverted and a or b
    else
        return AntiAim.jitter.c_var.yaw_r >= 1 and a or b
    end
end
local start_time = GlobalVars.curtime

local function get_tick()
    local end_time = GlobalVars.curtime
    local get_time = math.abs(math.floor((start_time - end_time) * 100)) % 2
    return get_time
end

function AntiAim.jitter:desync(a,b)
    local inverted = AntiAim.GetInverterState()

    if Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Get(2) then
        return inverted and a or b
    else
        return inverted and a or b
    end
end

clamp = function(value, minimum, maximum)
    if minimum > maximum then
        return math.min(math.max(value, maximum), minimum)
    else
        return math.min(math.max(value, minimum), maximum)
    end
end

AntiAim.side = 1
AntiAim.override_yaw = function(cmd, yaw_add, jitter_value, jitter_type)
    if FakeLag.SentPackets() ~= 0 then
        AntiAim.side = AntiAim.side * -1
    end
  
    local yaw_modifier = yaw_add
  
    if jitter_type == 1 then
        yaw_modifier = yaw_modifier+(jitter_value/2)*AntiAim.side
    elseif jitter_type == 2 then
        yaw_modifier = yaw_modifier+jitter_value*((AntiAim.side+1)/2)
    elseif jitter_type == 3 then
        yaw_modifier = math.random(-jitter_value,jitter_value)
    elseif jitter_type == 4 then
        yaw_modifier = yaw_modifier-(GlobalVars.tickcount*3)%jitter_value
    end

    return yaw_modifier
end

function AntiAim:run_custom(cmd)
    if EntityList.GetLocalPlayer() == nil or not ui.anti_aims.antiaim_enable:GetBool() then
        return
    end
    local p_duck = EntityList.GetLocalPlayer():GetProp("m_flDuckAmount")
    local inair = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags" ), 1 ) == 0
    local on_ground = bit.band(EntityList.GetLocalPlayer():GetProp("m_fFlags"), 1)
    local vx, vy, vz = EntityList.GetLocalPlayer():GetProp("m_vecVelocity").x, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").y, EntityList.GetLocalPlayer():GetProp("m_vecVelocity").z
    local p_still = math.sqrt(vx ^ 2 + vy ^ 2)
    local p_slow = Menu.FindVar('Aimbot', 'Anti Aim', 'Misc', 'Slow Walk')

    AntiAim.jitter.c_var.choke = ClientState.m_choked_commands
    local m = ui.anti_aims.custom
    AntiAim.save_antiaims.yaw_1 = "180"

    if on_ground == 1 then
        AntiAim.c_var.ground_ticks = AntiAim.c_var.ground_ticks + 1
    else
        AntiAim.c_var.ground_ticks = 0
    end
    if m[3].enable:Get() and p_slow then
        AntiAim.c_var.c = 3
    elseif inair and m[6].enable:Get() and EntityList.GetLocalPlayer():GetProp('m_flDuckAmount') > 0.7 then
        AntiAim.c_var.c = 6
    elseif inair and m[5].enable:Get() then
        AntiAim.c_var.c = 5
    elseif p_duck > 0.8 and not inair and AntiAim.c_var.ground_ticks > 8 and m[4].enable:Get() then
        AntiAim.c_var.c = 4
    elseif p_still > 70 and AntiAim.c_var.ground_ticks > 8 and m[2].enable:Get() then
        AntiAim.c_var.c = 2
    elseif p_still < 2 and  AntiAim.c_var.ground_ticks > 8 and m[1].enable:Get() then
        AntiAim.c_var.c = 1
    else
        AntiAim.c_var.c = 5
    end
    AntiAim.save_antiaims.yaw_base = "At targets"
    AntiAim.save_antiaims.yaw_1 = "180"
    AntiAim.save_antiaims.pitch = 1

    if AntiAim.c_var.c == 1 and m[1].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 2 and m[2].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 0
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 3 and m[3].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 24
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 4 and m[4].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 35
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 5 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 15
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    elseif AntiAim.c_var.c == 6 and m[5].extra_options:Get(1) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Double Tap'):Get()) and not (Menu.FindVar('Aimbot', 'Ragebot', 'Exploits', 'Hide Shots'):Get()) then
        AntiAim.save_antiaims.yaw_2 = 17
        AntiAim.save_antiaims.yaw_jitter_1 = 0
        AntiAim.save_antiaims.yaw_jitter_2 = 0
        AntiAim.save_antiaims.body_yaw_1 = "Static"
        AntiAim.save_antiaims.body_yaw_2 = 180
        AntiAim.save_antiaims.fake_yaw_limit = 60
        AntiAim.save_antiaims.freestanding_body_yaw = false
    else
        AntiAim.c_var.max = m[AntiAim.c_var.c].step_fake_max:Get()
        AntiAim.c_var.min = m[AntiAim.c_var.c].step_fake_min:Get()
        AntiAim.c_var.step = m[AntiAim.c_var.c].step_value:Get()
        AntiAim.c_var.step_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].step_ticks:Get()

        if m[AntiAim.c_var.c].step_fake_min:Get() >= m[AntiAim.c_var.c].step_fake_max:Get()then
            m[AntiAim.c_var.c].step_fake_min:Set(m[AntiAim.c_var.c].step_fake_max:Get())
        end

        if AntiAim.c_var.step_ticks == m[AntiAim.c_var.c].step_ticks:Get() - 1 then
            if AntiAim.c_var.return_value < AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.return_value + m[AntiAim.c_var.c].step_value:Get()
            elseif AntiAim.c_var.return_value >= AntiAim.c_var.max then
                AntiAim.c_var.return_value = AntiAim.c_var.min
            end
        end

        AntiAim.c_var.bodystep_max = m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get()
        AntiAim.c_var.bodystep_min = m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get()
        AntiAim.c_var.bodystep_step = m[AntiAim.c_var.c].body_yaw_step_value:Get()
        AntiAim.c_var.bodystep_ticks = GlobalVars.tickcount % m[AntiAim.c_var.c].body_yaw_step_ticks:Get()

        if m[AntiAim.c_var.c].step_bodyyaw_degree_left:Get() >= m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get() then
            m[AntiAim.c_var.c].step_bodyyaw_degree_left:Set(m[AntiAim.c_var.c].step_bodyyaw_degree_right:Get())
          
        end
        if AntiAim.c_var.bodystep_ticks == m[AntiAim.c_var.c].body_yaw_step_ticks:Get() - 1 then
            if AntiAim.c_var.bodystep_return_value < AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_return_value + AntiAim.c_var.bodystep_step
            elseif AntiAim.c_var.bodystep_return_value >= AntiAim.c_var.bodystep_max then
                AntiAim.c_var.bodystep_return_value = AntiAim.c_var.bodystep_min
            end
        end

        if m[AntiAim.c_var.c].yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.yaw_2 = m[AntiAim.c_var.c].static_yaw:Get()
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:tick(m[AntiAim.c_var.c].tick_yaw_left:Get(),m[AntiAim.c_var.c].tick_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 2 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:choke_yaw(m[AntiAim.c_var.c].choke_yaw_left:Get(),m[AntiAim.c_var.c].choke_yaw_right:Get())
        elseif m[AntiAim.c_var.c].yaw_mode:Get() == 3 then
            AntiAim.save_antiaims.yaw_2 = AntiAim.jitter:desync(m[AntiAim.c_var.c].desync_yaw_left:Get(),m[AntiAim.c_var.c].desync_yaw_right:Get())
        end

        if m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 1 then
            if m[AntiAim.c_var.c].yaw_jitter_degree:Get() >= m[AntiAim.c_var.c].yaw_jitter_degree2:Get() then
                m[AntiAim.c_var.c].yaw_jitter_degree:Set(m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
            end
        end

        AntiAim.save_antiaims.yaw_jitter_1 = m[AntiAim.c_var.c].yaw_jitter:Get()
        AntiAim.save_antiaims.yaw_jitter_2 = m[AntiAim.c_var.c].yaw_jitter_mode:Get() == 0 and m[AntiAim.c_var.c].yaw_jitter_degree:Get() or math.random(m[AntiAim.c_var.c].yaw_jitter_degree:Get(), m[AntiAim.c_var.c].yaw_jitter_degree2:Get())
        AntiAim.save_antiaims.body_yaw_1 = m[AntiAim.c_var.c].self_bodyyaw_mode:Get()

        if m[AntiAim.c_var.c].bodyyaw_mode:Get() == 1 then
            AntiAim.save_antiaims.body_yaw_2 = m[AntiAim.c_var.c].bodyyaw_degree:Get()
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 2 then
            AntiAim.save_antiaims.body_yaw_2 = AntiAim.jitter:choke_body_yaw(m[AntiAim.c_var.c].jitter_bodyyaw_degree_left:Get(), m[AntiAim.c_var.c].jitter_bodyyaw_degree_right:Get())
        elseif m[AntiAim.c_var.c].bodyyaw_mode:Get() == 3 then
            AntiAim.save_antiaims.body_yaw_2 = clamp(AntiAim.c_var.bodystep_return_value, AntiAim.c_var.bodystep_min, AntiAim.c_var.bodystep_max)
        end

        if m[AntiAim.c_var.c].fake_yaw_mode:Get() == 0 then
            AntiAim.save_antiaims.fake_yaw_limit = m[AntiAim.c_var.c].static_fakeyaw:Get()
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 1 then
            AntiAim.save_antiaims.fake_yaw_limit = AntiAim.jitter:choke_fake(m[AntiAim.c_var.c].jitter_fakeyaw_left:Get(),m[AntiAim.c_var.c].jitter_fakeyaw_right:Get())
        elseif m[AntiAim.c_var.c].fake_yaw_mode:Get() == 2 then
            if m[AntiAim.c_var.c].step_abs:Get() then
                AntiAim.save_antiaims.fake_yaw_limit = math.abs(clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max))
            else
                AntiAim.save_antiaims.fake_yaw_limit = clamp(AntiAim.c_var.return_value,AntiAim.c_var.min,AntiAim.c_var.max)
            end
        end
        AntiAim.save_antiaims.freestanding_body_yaw = m[AntiAim.c_var.c].freestanding_bodyyaw:Get()
    end
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Pitch'):Set(AntiAim.save_antiaims.pitch)

    AntiAim.OverrideYawOffset(AntiAim.override_yaw(cmd, AntiAim.save_antiaims.yaw_2, AntiAim.save_antiaims.yaw_jitter_2, AntiAim.save_antiaims.yaw_jitter_1))
    AntiAim.OverrideLimit(AntiAim.save_antiaims.fake_yaw_limit)

    if AntiAim.save_antiaims.body_yaw_1 == 0 then -- off
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 1 then -- opposite
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
    elseif AntiAim.save_antiaims.body_yaw_1 == 2 then -- jitter
        AntiAim.OverrideInverter(AntiAim.side ~= 1)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(1)
    else -- static
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Fake Options'):Set(2, false)
        AntiAim.OverrideInverter(Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Inverter'):Get() and true or false)
        Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'LBY Mode'):Set(0)
    end
  
    Menu.FindVar('Aimbot', 'Anti Aim', 'Main', 'Yaw Add'):Set(0)
  
    Menu.FindVar('Aimbot', 'Anti Aim', 'Fake Angle', 'Freestanding Desync'):Set(AntiAim.save_antiaims.freestanding_body_yaw and 1 or 0)
end

vector_lerp = function(vecSource, vecDestination, flPercentage) return vecSource + (vecDestination - vecSource) * flPercentage end
anti_aims.vecnew = Vector.new()
anti_aims.edge_yaw = function()
    if not ui.anti_aims.antiaim_enable:Get() then return end
    if ui.anti_aims.antiaim_helpers:Get(5) then
        local local_player = EntityList.GetLocalPlayer()
        if local_player == nil then return end
        local flag = EntityList.GetLocalPlayer():GetProp("m_fFlags")
        if (flag == 256 or flag == 262) then -- air
            return
        end
        --if local_player:GetState() == 'Air' then return end
        if ClientState.m_choked_commands == 0 then
            anti_aims.vecnew = local_player:GetEyePosition()
        end
        local trace_end = {}
        local ang_view_angles = EngineClient.GetViewAngles()
        for yaww = 18, 360, 18 do
            local yaww = normalize_yaw(yaww)
            local edge_angle = QAngle.new(0, yaww, 0)
            local vec_trace_end = anti_aims.vecnew + Cheat.AngleToForward(edge_angle) * 0x60
            local traceInfo = EngineTrace.TraceRay(anti_aims.vecnew, vec_trace_end, local_player, 0x200400B)
            if traceInfo.hit_entity and traceInfo.hit_entity:GetClassName() == 'CWorld' and traceInfo.fraction < 0.3 then
                trace_end[#trace_end + 1] = {
                    vec_trace_end = traceInfo.endpos,
                    yaww = yaww
                }
            end
        end
        table.sort(trace_end, function(a, b)
            return a.yaww < b.yaww
        end)
        local edge_angle
        if #trace_end >= 2 then
            local vec_trace_center = vector_lerp(trace_end[1].vec_trace_end, trace_end[#trace_end].vec_trace_end, 0.5)
            edge_angle = Cheat.VectorToAngle(anti_aims.vecnew - vec_trace_center)
        end

        if edge_angle then
            local yaww = ang_view_angles.yaw
            local edgee_yaw = edge_angle.yaw
            local difff = normalize_yaw(edgee_yaw - yaww)
            if math.abs(difff) < 90 then
                difff = 0
                yaww = normalize_yaw(edgee_yaw + 180)
            end
            local new_yaw = -yaww
            new_yaw = normalize_yaw(new_yaw + edgee_yaw + 180)
            new_yaw = normalize_yaw(new_yaw + difff)
            AntiAim.OverrideYawOffset(new_yaw)
        end
    end
end

anti_aims.avoid_backstab = function()
    if ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(4) then
        local all_players = EntityList.GetEntitiesByName('CCSPlayer')
        for i = 1, #all_players do
            local enemy = all_players[i]:GetPlayer()
            if enemy ~= EntityList.GetLocalPlayer() and not enemy:IsTeamMate() and not enemy:IsDormant() and enemy:IsAlive() and enemy:GetActiveWeapon() ~= nil and enemy:GetActiveWeapon():IsKnife() then
                if EntityList.GetLocalPlayer():GetRenderOrigin():DistTo(enemy:GetProp('m_vecOrigin')) <= 300 then
                    AntiAim.OverrideYawOffset(180)
                end
            end
        end
    end
end

anti_aims.antiaim_helpers = function()

    if not ui.anti_aims.antiaim_enable:Get() then return end

        if ui.anti_aims.antiaim_helpers:Get(1) then

            if ui.refs.hideshots:Get() then
                    ui.refs.fakelags:Set(false)
                else
                    ui.refs.fakelags:Set(true)
            end
        end
end

anti_aims.disable_aa_warmup = function()

    local warmup_period = EntityList.GetGameRules():GetProp("m_bWarmupPeriod")

    if  ui.anti_aims.antiaim_enable:Get() and ui.anti_aims.antiaim_helpers:Get(3) then

        if warmup_period == true then
            ui.refs.antiaim:Set(false)
        else
            ui.refs.antiaim:Set(true)
        end

    end

end

anti_aims.exploit_teleport = function()
    if ui.ragebot.tp_in_air:Get() ~= 0 and ui.anti_aims.antiaim_enable:Get() and ui.refs.doubletap:Get() and ui.ragebot.Teleport_In_Air:Get() then
        local allow_teleport = false
        local enable_teleport = false

        local active_weapon = EntityList.GetLocalPlayer():GetActiveWeapon()
        if active_weapon == nil then return end
        local weapon_id = active_weapon:GetWeaponID()

        local guns = {
            is_AWP = weapon_id == 9,
            is_auto = (weapon_id == 38 or weapon_id == 11),
            is_scout = weapon_id == 40,
            is_deagle = weapon_id == 1,
            is_r8 = weapon_id == 64,
            is_nades = active_weapon:IsGrenade(),
            is_pistols = active_weapon:IsPistol() and not is_deagle and not is_r8,
            is_smg = (weapon_id == 34 or weapon_id == 23 or weapon_id == 24 or weapon_id == 19 or weapon_id == 26 or weapon_id == 33 or weapon_id == 17),
            is_shotguns = (weapon_id == 35 or weapon_id == 25 or weapon_id == 27 or weapon_id == 29),
            is_rifle = active_weapon:IsRifle() and not is_smg and not is_shotguns,
            is_taser = weapon_id == 31,
        }
      
        for _, weapons in pairs({
            {Value = 1, active_weapon = guns.is_AWP},
            {Value = 2, active_weapon = guns.is_auto},
            {Value = 3, active_weapon = guns.is_scout},
            {Value = 4, active_weapon = guns.is_deagle},
            {Value = 5, active_weapon = guns.is_r8},
            {Value = 6, active_weapon = guns.is_nades},
            {Value = 7, active_weapon = not (guns.is_AWP or guns.is_auto or guns.is_scout or guns.is_deagle or guns.is_r8 or guns.is_nades or guns.is_pistols or guns.is_rifle or guns.is_smg or guns.is_shotguns or guns.is_taser)},
            {Value = 8, active_weapon = guns.is_pistols},
            {Value = 9, active_weapon = guns.is_rifle},
            {Value = 10, active_weapon = guns.is_smg},
            {Value = 11, active_weapon = guns.is_shotguns},
            {Value = 12, active_weapon = guns.is_taser}
        }) do
            if ui.ragebot.tp_in_air:Get(weapons.Value) and weapons.active_weapon then
                allow_teleport = true
            end
        end

        if allow_teleport then
            all_players = EntityList.GetEntitiesByName('CCSPlayer')
            for i = 1, #all_players do
                enemy = all_players[i]:GetPlayer()
                if not enemy:IsTeamMate() and enemy:IsAlive() and not enemy:IsDormant() and enemy:CanHit() then
                    enable_teleport = true
                end
            end
        end
      
        if enable_teleport and not EntityList.GetLocalPlayer():GetFlag(0) and EntityList.GetLocalPlayer():GetVelocity() > 25 then
            Exploits.ForceTeleport()
        end
    end
end

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

ffi_functions.get_entity_address = function(entity_index)
    local addr = ffi_functions.GET_CLIENT_ENTITY_FN(ffi_functions.ENTITY_LIST_POINTER, entity_index)
    return addr
end

ffi_functions.hook = {hooks = {}}
ffi_functions.hook.new = function(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(ffi_functions.hook.hooks, new_hook)
    return setmetatable(new_hook, mt)
end

anti_aims.is_jumping = false
anti_aims.ground_ticks, anti_aims.end_time = 1, 0
anti_aims.updateCSA_hk = function(thisptr, edx)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if localplayer == nil then return anti_aims.updateCSA_fn(thisptr, edx) end
    local lp_ptr = ffi_functions.get_entity_address(EngineClient.GetLocalPlayer())

    if ui.anti_aims.animbreakers:Get(1) then ui.refs.legs:Set(1) end

    if ui.anti_aims.animbreakers:Get() == 0 or not ui.anti_aims.antiaim_enable:Get() then anti_aims.updateCSA_fn(thisptr, edx) return end

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end

    if ui.anti_aims.animbreakers:Get(2) then
        ffi.cast('float*' , lp_ptr+10104)[0] = 1
    end

    if ui.anti_aims.animbreakers:Get(3) then
        ffi.cast('float*' , lp_ptr+10104)[12] = 0
    end

    anti_aims.updateCSA_fn(thisptr, edx)

    if ui.anti_aims.animbreakers:Get(1) then
        ffi.cast('float*' , lp_ptr+10104)[6] = 1
    end
  
    if ui.anti_aims.animbreakers:Get(3) then
        if bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), 1) == 1 then
            anti_aims.ground_ticks = anti_aims.ground_ticks + 1
        else
            anti_aims.ground_ticks = 0
            anti_aims.end_time = GlobalVars.curtime + 1
        end
        if not anti_aims.is_jumping and anti_aims.ground_ticks > 1 and anti_aims.end_time > GlobalVars.curtime then
            ffi.cast('float*' , lp_ptr+10104)[12] = 0.5
        end
    end
end

Cheat.RegisterCallback('destroy', function()
    for i, v in ipairs(ffi_functions.hook.hooks) do
        if v.status then
            v.stop()
        end
    end
end)

anti_aims.updateCSA_fn = ffi_functions.hook.new('void(__fastcall*)(void*, void*)', anti_aims.updateCSA_hk, ffi.cast('uintptr_t', Utils.PatternScan('client.dll', '8B F1 80 BE ? ? ? ? ? 74 36', -5))) or error("updateCSA_fn can't hook")
-- @endregion

local draggable = {}
function draggable:new(name, size, init_pos)
    local drag = {}
    local init_pos = init_pos or Vector2.new(100, 100)
    drag.size = size
    drag.x = Menu.SliderInt('Visuals', "draggable elements", name .. "_x", init_pos.x, 0, globals.screen_size.x)
    drag.y = Menu.SliderInt('Visuals', "draggable elements", name .. "_y", init_pos.y, 0, globals.screen_size.y)
    drag.x:SetVisible(false)
    drag.y:SetVisible(false)
    drag.captured = false
    drag.clicked = false
    drag.mouse_offset = Vector2.new(0, 0)

    setmetatable(drag, self)
    self.__index = self
  
    return drag
end

function draggable:get()
    return Vector2.new(self.x:Get(), self.y:Get())
end

function draggable:update()
    if not Cheat.IsMenuVisible() then
        return
    end

    local mouse_pos = Cheat.GetMousePos()
    local mouse_hold = Cheat.IsKeyDown(1)

    if not self.clicked and mouse_hold then
        self.clicked = true
        if not self.captured and mouse_hold and helpers:mouse_in_bounds(self:get(), self:get() + self.size) then
            self.captured = true
            self.mouse_offset = mouse_pos - self:get()
        end
    end

    if not mouse_hold then
        self.captured = false
        self.clicked = false
    end

    if self.captured then
        self.x:Set(mouse_pos.x - self.mouse_offset.x)
        self.y:Set(mouse_pos.y - self.mouse_offset.y)
    end
end

function draggable:set_size(size)
    self.size = size
end

-- @region: widgets
local indicators = {}
indicators.on_plant_time, indicators.fill, indicators.planting_site, indicators.planting = 0, 0, '', false
indicators.Render_Shadow = function(start_pos, endpos, color)
    Render.GradientBoxFilled(start_pos, Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), endpos.y), Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color)
    Render.GradientBoxFilled(Vector2.new(start_pos.x + ((endpos.x - start_pos.x) / 2), start_pos.y), endpos, color, Color.RGBA(0.0, 0.0, 0.0, 0.0), color, Color.RGBA(0.0, 0.0, 0.0, 0.0))
end

indicators.contains = function(table, val)
    for i=1, #table do
        if table[i] == val then
            return true
        end
    end
    return false
end

indicators.clear_planting_info = function()
    planting = false
    fill = 0
    on_plant_time = 0
    planting_site = ''
end

indicators.bomb = function(event)
    typese = {
        'bomb_abortplant', 'bomb_defused', 'bomb_planted', 'round_prestart'
    }
  
    if indicators.contains(typese, event:GetName()) then indicators.clear_planting_info() end
  
    if event:GetName() == 'bomb_beginplant' then
        on_plant_time = GlobalVars.curtime
        planting = true
        bombsite = event:GetInt('site');
        APlants = (454 or 372 or 102 or 276 or 174 or 121 or 301 or 142 or 408 or 97 or 213 or 216)
        if bombsite == APlants then
            planting_site = 'Bombsite A'
        else
            planting_site = 'Bombsite B'
        end
    end
end

indicators.Render_Indicator = function(text, col, cur)
    local position = Vector2.new(20, (globals.screen_size.y / 1.55) + (39 * cur))
    local positionS = Vector2.new(21, (globals.screen_size.y / 1.55 + 1) + (39 * cur))
    local textsize = Render.CalcTextSize(text, 24, fonts.calibrib24)

    indicators.Render_Shadow(Vector2.new(position.x - 10, position.y - 7), Vector2.new(position.x + textsize.x - 10, position.y + textsize.y + 2), Color.RGBA(0, 0, 0, 56 * col.a))

    Render.Text(text, positionS, Color.RGBA(33, 33, 33, 127 * col.a), 24, fonts.calibrib24)
    Render.Text(text, position, col, 24, fonts.calibrib24)
end

widgets = {
    create_window = function(self, s, e, alpha)
        local color = helpers:copy_color(ui.visuals.theme:Get())
        local background_color = Color.new(0, 0, 0, alpha * ui.visuals.theme:Get().a)
        local border_color1 = helpers:alpha_modulate(color, alpha)
        local border_color2 = helpers:alpha_modulate(color, alpha * 0.4)

        Render.Blur(s, e, Color.new(1 - background_color.a, 1 - background_color.a, 1 - background_color.a, alpha), 5)

        if not ui.visuals.disable_blur:Get() then
        Render.Box(s - Vector2.new(6, 6), e + Vector2.new(6, 6), helpers:alpha_modulate(border_color1, alpha * 0.02), 5)
        Render.Box(s - Vector2.new(5, 5), e + Vector2.new(5, 5), helpers:alpha_modulate(border_color1, alpha * 0.03), 5)
        Render.Box(s - Vector2.new(4, 4), e + Vector2.new(4, 4), helpers:alpha_modulate(border_color1, alpha * 0.04), 5)
        Render.Box(s - Vector2.new(3, 3), e + Vector2.new(3, 3), helpers:alpha_modulate(border_color1, alpha * 0.08), 5)
        Render.Box(s - Vector2.new(2, 2), e + Vector2.new(2, 2), helpers:alpha_modulate(border_color1, alpha * 0.13), 5)
        Render.Box(s - Vector2.new(1, 1), e + Vector2.new(1, 1), helpers:alpha_modulate(border_color1, alpha * 0.20), 5)
        end
      
        Render.BoxFilled(s + Vector2.new(5, 0), Vector2.new(e.x - 5, s.y + 1), border_color1)
        Render.BoxFilled(Vector2.new(s.x + 5, e.y - 1), e - Vector2.new(5, 0), border_color2)
        Render.GradientBoxFilled(Vector2.new(s.x, s.y + 5), Vector2.new(s.x + 1, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.GradientBoxFilled(Vector2.new(e.x - 1, s.y + 5), Vector2.new(e.x, e.y - 5), border_color1, border_color1, border_color2, border_color2)
        Render.Circle(s + Vector2.new(5, 5), 5, 8, border_color1, 1, -90, -180)
        Render.Circle(Vector2.new(s.x + 5, e.y - 5), 5, 8, border_color2, 1, 90, 180)
        Render.Circle(e - Vector2.new(5, 5), 5, 8, border_color2, 1, 0, 90)
        Render.Circle(Vector2.new(e.x - 5, s.y + 5), 5, 8, border_color1, 1, -90, 0)
    end,

    keybinds = {
        anims = {},
        drag = draggable:new("keybinds", Vector2.new(150, 20)),
        size = 100,
        alpha = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(1) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local bind_list = Cheat.GetBinds()
            local render_list = {}
            local opened = Cheat.IsMenuVisible()
            local render_offset = 0
            local raw_size = 100

            for _, bind in pairs(bind_list) do
                local bind_name = bind:GetName()
                if not self.anims[bind_name] then
                    self.anims[bind_name] = 0
                end

                self.anims[bind_name] = helpers:lerp(self.anims[bind_name], bind:IsActive() and 1 or 0)

                if bind:IsActive() then
                    opened = true
                end

                if self.anims[bind_name] > 0.01 then
                    local r_bind = {}

                    r_bind.name = bind_name:lower():gsub("^%l", string.upper)
                    r_bind.value = string.format("[%s]", bind:GetValue())
                    r_bind.alpha = self.anims[bind_name]
                    r_bind.offset = render_offset

                    if r_bind.value == "[on]" or r_bind.value == "[off]" then
                        r_bind.value = bind:GetMode() == 0 and "[toggled]" or "[hold]"
                    end

                    local name_size = Render.CalcTextSize(r_bind.name, 11, fonts.verdana).x + Render.CalcTextSize(r_bind.value, 11, fonts.verdana).x + 15

                    render_offset = render_offset + r_bind.alpha * 16
                    raw_size = math.max(raw_size, name_size)

                    table.insert(render_list, r_bind)
                end
            end

            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)
            self.size = helpers:lerp(self.size, raw_size)

            if self.alpha < 0.01 then
                return
            end
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
            helpers:text_shadow("keybinds", pos + Vector2.new(self.size, 20) / 2, Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)

            for _, r in pairs(render_list) do
                helpers:text_shadow(r.name, pos + Vector2.new(5, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
                helpers:text_shadow(r.value, pos + Vector2.new(self.size - 5 - Render.CalcTextSize(r.value, 11, fonts.verdana).x, 22 + r.offset), Color.new(1, 1, 1, r.alpha), 11, fonts.verdana)
            end
        end
    },
  
    spectators = {
        data = {},
        drag = draggable:new("spectators", Vector2.new(120, 20)),
        size = 100,
        alpha = 0,
        getsteamid64 = function(self, steamid)
            return string.sub(tostring(ffi.new("uint64_t", 76561197960265728) + ffi.new("uint64_t", steamid)), 1, -4)
        end,
        get_list = function(self)
            if not EntityList.GetLocalPlayer() then
                return {}, Cheat.IsMenuVisible()
            end

            local observe_target = EntityList.GetLocalPlayer()

            if EntityList.GetLocalPlayer():GetProp("m_iObserverMode") ~= 0 then
                local ent = EntityList.GetClientEntityFromHandle(EntityList.GetLocalPlayer():GetProp("m_hObserverTarget"))

                if ent and ent:IsPlayer() then
                    observe_target = ent:GetPlayer()
                end
            end

            if not observe_target then
                return {}, Cheat.IsMenuVisible()
            end

            local players = EntityList.GetPlayers()
            local rtn_list = {}
            local opened = Cheat.IsMenuVisible()

            for _, pl in pairs(players) do 
                if pl ~= EntityList.GetLocalPlayer() then
                    local name = pl:GetName()
                    local info = pl:GetPlayerInfo()
                    local steamid = self:getsteamid64(info.iSteamID)

                    if not self.data[steamid] then
                        if not info.fakeplayer then
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                            }

                            local player_data = self.data[steamid]

                            player_data.callback1 = function(content)
                                local parsed = json.parse(content).response
                                if not parsed then
                                    return
                                end
                                parsed = parsed.players[0]
                                if not parsed then
                                    return
                                end
                                Http.GetAsync(parsed.avatar, player_data.callback2)
                            end

                            player_data.callback2 = function(content)
                                player_data.avatar = Render.LoadImage(content, Vector2.new(32, 32))
                            end

                            Http.GetAsync("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=E8A1E59F9C119FA9BFB73F29C2A8A109&steamids=" .. steamid, player_data.callback1)
                        else
                            self.data[steamid] = {
                                name = name,
                                alpha = 0,
                                avatar = globals.default_avatar,
                            }
                        end
                    end

                    local data = self.data[steamid]
                    local observer = EntityList.GetClientEntityFromHandle(pl:GetProp("m_hObserverTarget"))
                    local is_observer = (observer and observer:IsPlayer() and observer:GetPlayer() == observe_target)
              
                    if is_observer then
                        opened = true
                    end

                    data.alpha = helpers:lerp(data.alpha, is_observer and 1 or 0)

                    if data.alpha > 0.01 then
                        table.insert(rtn_list, data)
                    end
                end
            end

            return rtn_list, opened
        end,
        draw = function(self)
            if not ui.visuals.widgets:Get(2) then
                return
            end

            self.drag:update()
            local pos = self.drag:get()

            local render_offset = 0
            local raw_size = 100

            local list, opened = self:get_list()

            for _, data in pairs(list) do
                local reneder_pos = pos + Vector2.new(5, 23 + render_offset)

                if not data.avatar then return end
                Render.Image(data.avatar, reneder_pos, Vector2.new(16, 16), Color.new(1, 1, 1, data.alpha))
                helpers:text_shadow(data.name, reneder_pos + Vector2.new(21, 2), Color.new(1, 1, 1, data.alpha), 11, fonts.verdana)

                local size = 30 + Render.CalcTextSize(data.name, 11, fonts.verdana).x

                if size > raw_size then
                    raw_size = size
                end

                render_offset = render_offset + 18 * data.alpha
            end

            self.size = helpers:lerp(self.size, raw_size)
            self.alpha = helpers:lerp(self.alpha, opened and 1 or 0)

            if self.alpha > 0.01 then
                widgets:create_window(pos, pos + Vector2.new(self.size, 20), self.alpha)
                helpers:text_shadow("spectators", pos + Vector2.new(self.size / 2, 10), Color.new(1, 1, 1, self.alpha), 11, fonts.verdana, true)
            end
        end,
    },

    watermark = {
        size = 0,
        draw = function(self)
            if not ui.visuals.widgets:Get(3) then
                return
            end

            local full_text = ""

            if ui.visuals.watermark_info:Get(1) then
                full_text = full_text .. " | " .. ui.visuals.custom_username:Get()
            end

            if ui.visuals.watermark_info:Get(2) then
                full_text = full_text .. " | " .. tostring(math.floor(helpers:get_fps())) .. " fps"
            end

            if ui.visuals.watermark_info:Get(3) then
                local net_channel = EngineClient.GetNetChannelInfo()
                local ping = 0

                if net_channel then
                    ping = net_channel:GetAvgLatency(0)
                end

                full_text = full_text .. " | delay: " .. tostring(math.floor(ping * 1000)) .. "ms"
            end

            if ui.visuals.watermark_info:Get(4) then
                full_text = full_text .. " | " .. tostring(math.floor(1 / GlobalVars.interval_per_tick + 0.5)) .. "tick"
            end

            if ui.visuals.watermark_info:Get(5) then
                full_text = full_text .. " | " .. helpers:get_time()
            end

            local size = Render.CalcTextSize("psycho" .. full_text, 11, fonts.verdana).x + 54
            self.size = helpers:lerp(self.size, size)

            local pos = Vector2.new(globals.screen_size.x - 10 - self.size, 10)
            widgets:create_window(pos, pos + Vector2.new(self.size, 20), 1)
            pos = pos + Vector2.new(6, 3)

            helpers:text_shadow("psy", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("psy", 11, fonts.verdana).x
            helpers:text_shadow("cho", pos, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize("cho", 11, fonts.verdana).x
            helpers:text_shadow(" [stable]", pos, Color.new(1, 1, 1), 11, fonts.verdana)
            pos.x = pos.x + Render.CalcTextSize(" [stable]", 11, fonts.verdana).x
            helpers:text_shadow(full_text, pos, Color.new(1, 1, 1), 11, fonts.verdana)

        end
    },

    lua_panel = {
        drag = draggable:new("lua_panel", Vector2.new(170, 45), Vector2.new(100, globals.screen_size.y / 2 - 23)),
        draw = function(self)
            if not ui.visuals.widgets:Get(4) then
                return
            end

            self.drag:update()

            local pos = self.drag:get()

            widgets:create_window(pos, pos + Vector2.new(170, 45), 1)

            local cursor = pos + Vector2.new(5, 4)

            helpers:text_shadow("» psycho anti-aim", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» psycho anti-aim ", 11, fonts.verdana).x
            helpers:text_shadow("technology", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» user:", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» user: ", 11, fonts.verdana).x
            helpers:text_shadow(globals.username, cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)
            cursor = Vector2.new(pos.x + 5, cursor.y + 12)

            helpers:text_shadow("» build: ", cursor, Color.new(1, 1, 1), 11, fonts.verdana)
            cursor.x = cursor.x + Render.CalcTextSize("» build: ", 11, fonts.verdana).x
            helpers:text_shadow("stable", cursor, helpers:alpha_modulate(ui.visuals.theme:Get(), 1), 11, fonts.verdana)

            if ui.visuals.statepanel_image:Get() == 1 then
                Render.Image(globals.avatar, pos + Vector2.new(145, 20), Vector2.new(20, 20))
            elseif ui.visuals.statepanel_image:Get() == 2 then
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
            else
                Render.Image(globals.logo_avatar2, pos + Vector2.new(134, 15), Vector2.new(30, 30))
                Render.Image(globals.avatar, pos + Vector2.new(105, 19), Vector2.new(22, 22))
            end

        end
    },

    gamesense = {

        draw = function(self)

            local local_player = EntityList.GetLocalPlayer()
            if not local_player then return end

            if not local_player:IsAlive() then return end
            local cur_dmg = ui.refs.minimum_damage:GetInt()
            if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
            local isDmg = false
            local isPing = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
                if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                    isPing = true
                end
            end
            local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
            local crouch = local_player:GetProp('m_flDuckAmount')
            local isDmg = false
            local binds = Cheat.GetBinds()
            for i = 1, #binds do
                local bind = binds[i]
                if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                    isDmg = true
                end
            end

            if ui.visuals.gamesense:Get() then
                local current_pos = 1
              
                if ui.visuals.gamesense_choose:Get(1) and isDmg then
                    indicators.Render_Indicator('DMG: '..tostring(cur_dmg), Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
      
                if ui.visuals.gamesense_choose:Get(2) and ui.ragebot.dormant_aimbot:GetBool() then
                    local colors = Color.RGBA(132,196,20,255)
                    for k, v in pairs(rage.player_info_prev) do
                        if k ~= nil then
                            if v[3] == true then
                                colors = Color.RGBA(252,222,30,255)
                                break
                            end
                        end
                    end
                    indicators.Render_Indicator('DA', colors, current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(3) and isPing then
                    local net_channel = EngineClient.GetNetChannelInfo()
                    local outgoing, incoming = net_channel:GetLatency(0), net_channel:GetLatency(1)
                    local ping = math.max(0, (incoming-outgoing)*1000)
                    indicators.Render_Indicator('PING', Color.RGBA(math.floor(255 - ((ping / 189 * 60) * 1.90)), math.floor((ping / 189 * 60) * 3.05), math.floor((ping / 189 * 60) * 0.32), 255), current_pos); current_pos = current_pos - 1;
                end
                local c4 = EntityList.GetEntitiesByClassID(129)[1];
                if ui.visuals.gamesense_choose:Get(4) and c4 ~= nil then
                    local time = c4:GetProp('m_flC4Blow') - GlobalVars.curtime
                    local timer = string.format('%.1f', time)
                    local defused = c4:GetProp('m_bBombDefused')
                    if math.floor(timer) > 0 and not defused then
                        local defusestart = c4:GetProp('m_hBombDefuser') ~= 4294967295
                        local defuselength = c4:GetProp('m_flDefuseLength')
                        local defusetimer = defusestart and (c4:GetProp('m_flDefuseCountDown') - GlobalVars.curtime) / 1 or -1
                        if defusetimer > 0 then
                            local color = math.floor(timer) > defusetimer and Color.RGBA(75, 230, 64, 80) or Color.RGBA(255, 0, 0, 80)
                      
                            local barlength = ((globals.screen_size.y - 50) / defuselength) * (defusetimer)
                            Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                            Render.Box(Vector2.new(0.0, 0.0), Vector2.new(20, globals.screen_size.y), Color.RGBA(32, 32, 32, 50))
                          
                            Render.BoxFilled(Vector2.new(0, globals.screen_size.y - barlength), Vector2.new(19, globals.screen_size.y), color)
                        end
                      
                        local bombsite = c4:GetProp('m_nBombSite') == 0 and 'A' or 'B'
                        local health = EntityList.GetLocalPlayer():GetProp('m_iHealth')
                        local armor = EntityList.GetLocalPlayer():GetProp('m_ArmorValue')
                        local willKill = false
                        local eLoc = c4:GetRenderOrigin()
                        local lLoc = EntityList.GetLocalPlayer():GetRenderOrigin()
                        local distance = eLoc:DistTo(lLoc)
                        local a = 450.7
                        local b = 75.68
                        local c = 789.2
                        local d = (distance - b) / c;
      
                        local damage = a * math.exp(-d * d)
                        if armor > 0 then
                            newDmg = damage * 0.5;
          
                            armorDmg = (damage - newDmg) * 0.5
                            if armorDmg > armor then
                                armor = armor * (1 / .5)
                                newDmg = damage - armorDmg
                            end
                            damage = newDmg;
                        end
                        local dmg = math.ceil(damage)
                        if dmg >= health then
                            willKill = true
                        else
                            willKill = false
                        end
                        indicators.Render_Indicator(bombsite..' - '..string.format('%.1f', timer)..'s', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                        if EntityList.GetLocalPlayer() then
                            if willKill == true then
                                indicators.Render_Indicator('FATAL', Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                            elseif damage > 0.5 then
                                indicators.Render_Indicator('-'..dmg..' HP', Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                            end
                        end
                    end
                end
                if ui.visuals.gamesense_choose:Get(4) and planting then
                    indicators.Render_Indicator(planting_site, Color.RGBA(252, 243, 105, 255), current_pos); current_pos = current_pos - 1;
                    local fill = 3.125 - (3.125 + on_plant_time - GlobalVars.curtime)
                    if fill > 3.125 then
                        fill = 3.125
                    end
                    local ts = Render.CalcTextSize(planting_site, 24, fonts.calibrib24)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(0, 0, 0, 200), 5)
                    Render.Circle(Vector2.new(153, globals.screen_size.y / 1.55 + 48 + (39 * current_pos - 1)), 8, 32, Color.RGBA(213, 213, 214, 255), 3, -1, (fill/3.3)*375)
                end

                if ui.visuals.gamesense_choose:Get(5) and bit.band(EntityList.GetLocalPlayer():GetProp('m_fFlags'), bit.lshift(1,0)) == 0 then
                    indicators.Render_Indicator('LC', EntityList.GetLocalPlayer():GetVelocity() > 260 and Color.RGBA(132, 196, 20, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(6) and ui.refs.fakeduck:Get() then
                    indicators.Render_Indicator('DUCK', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if  ui.visuals.gamesense_choose:Get(7) and ui.refs.doubletap:Get() then
                    indicators.Render_Indicator('DT', Exploits.GetCharge() == 1 and Color.RGBA(213, 213, 214, 255) or Color.RGBA(255, 0, 0, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(8) and ui.refs.hideshots:Get() then
                    indicators.Render_Indicator('ONSHOT', Color.RGBA(132, 196, 20, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(9) and ui.refs.yaw_base:Get() == 5 then
                    indicators.Render_Indicator('FS', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
      
                if ui.visuals.gamesense_choose:Get(10) and ui.refs.bodyaim:Get() == 2 then
                    indicators.Render_Indicator('BODY', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
                if ui.visuals.gamesense_choose:Get(11) and ui.refs.safepoints:Get() == 2 then
                    indicators.Render_Indicator('SAFE', Color.RGBA(213, 213, 214, 255), current_pos); current_pos = current_pos - 1;
                end
            end
        end
    },

    indicators = {
        x_add = 0,
        -----------------------
        draw = function(self)
            if not ui.visuals.widgets:Get(5) then return end
                local local_player = EntityList.GetLocalPlayer()
                if not local_player then return end

                if not local_player:IsAlive() then return end
                local cur_dmg = ui.refs.minimum_damage:GetInt()
                if cur_dmg > 100 then cur_dmg = '+'..cur_dmg-100 end
                local isDmg = false
                local isPing = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                    if bind:GetName() == 'Fake Ping' and bind:IsActive() then
                        isPing = true
                    end
                end
                local ground = bit.band(local_player:GetProp('m_fFlags'), bit.lshift(1,0)) == 0
                local crouch = local_player:GetProp('m_flDuckAmount')
                local isDmg = false
                local binds = Cheat.GetBinds()
                for i = 1, #binds do
                    local bind = binds[i]
                    if bind:GetName() == 'Minimum Damage' and bind:IsActive() then
                        isDmg = true
                    end
                end
                local scope = local_player:GetProp('m_bIsScoped')
                self.x_add = helpers:lerp(self.x_add, scope and 35 or 0, GlobalVars.frametime * 8)

                local alpha = 0
                local y = 0

                if scope then
                    alpha = 0.5
                else
                    alpha = 1
                end
                if globals.indicator_avatar == nil then return end
                if globals.logo_avatar2 == nil then return end
                if fonts.pixel == nil then return end
                if fonts.arrow_fonts == nil then return end
                if fonts.arrow_font2 == nil then return end

                if ui.visuals.indicator_type:Get() == 1 then
                  
                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 2), Vector2.new(100, 75), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, breath(2, ui.visuals.ghosty_color:GetColor().a * 100 / 235)))
                    end

                    Render.Image(globals.logo_avatar2, Vector2.new(globals.screen_size.x/2 - 20 +self.x_add, globals.screen_size.y/2 + 17), Vector2.new(40, 40), Color.new(ui.visuals.ghosty_color:GetColor().r, ui.visuals.ghosty_color:GetColor().g, ui.visuals.ghosty_color:GetColor().b, alpha))
                end
                --if ui.visuals.indicator_type:Get() == 1 then
                --Render.Image(globals.logo_avatar, Vector2.new(globals.screen_size.x/2 - 21 +self.x_add, globals.screen_size.y/2 + 20), Vector2.new(35, 35), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, alpha))
                --end

                if ui.visuals.indicator_type:Get() == 0 then

                    if not ui.visuals.disable_background:Get() then
                        Render.Image(globals.indicator_avatar, Vector2.new(globals.screen_size.x/2 - 50 +self.x_add, globals.screen_size.y/2 - 8), Vector2.new(100, 75), Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, breath(2, ui.visuals.ind_name_color:GetColor().a * 100 / 235)))
                    end

                    Render.Text('psycho', Vector2.new(globals.screen_size.x/2-17+self.x_add, globals.screen_size.y/2+16), Color.new(0, 0, 0, 0.5), 11, fonts.verdanabd11)
                    Render.Text('psy', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+15), AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
                    Render.Text('cho', Vector2.new(globals.screen_size.x/2-1+self.x_add, globals.screen_size.y/2+15), not AntiAim.GetInverterState() and Color.new(ui.visuals.ind_name_color:GetColor().r, ui.visuals.ind_name_color:GetColor().g, ui.visuals.ind_name_color:GetColor().b, 1) or Color.new(1, 1, 1, 1), 11, fonts.verdanabd11)
              
                    if ground then
                        state = 'AIR'
                    elseif crouch >= 1 then
                        state = 'CROUCHING'
                    elseif ui.refs.slowwalk:Get() then
                        state = 'SLOWWALKING'
                    elseif local_player:GetVelocity() > 5 then
                        state = 'MOVING'
                    else
                        state = 'STANDING'
                    end
                    local text_sizes = Render.CalcTextSize(state, 9, fonts.pixel)
                    Render.Text(state, Vector2.new(globals.screen_size.x/2+1-text_sizes.x/2+self.x_add, globals.screen_size.y/2+28), Color.new(ui.visuals.ind_state_color:GetColor().r, ui.visuals.ind_state_color:GetColor().g, ui.visuals.ind_state_color:GetColor().b, 1), 9, fonts.pixel, true)

                    Render.Text('OS', Vector2.new(globals.screen_size.x/2-18+self.x_add, globals.screen_size.y/2+37), ui.refs.hideshots:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('DT', Vector2.new(globals.screen_size.x/2-4+self.x_add, globals.screen_size.y/2+37), ui.refs.doubletap:Get() and (Exploits.GetCharge() >= 0.9 and Color.new(0, 1, 0, 1) or Color.new(1, 0, 0, 1)) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                    Render.Text('AP', Vector2.new(globals.screen_size.x/2+9+self.x_add, globals.screen_size.y/2+37), ui.refs.autopeek:Get() and Color.new(ui.visuals.ind_color:GetColor().r, ui.visuals.ind_color:GetColor().g, ui.visuals.ind_color:GetColor().b, 1) or Color.new(0.8, 0.8, 0.8, 0.7), 9, fonts.pixel, true)
                        if isDmg then
                            local text_size = Render.CalcTextSize(('DMG: %s'):format(ui.refs.minimum_damage:Get()), 9, fonts.pixel)
                            Render.Text(('DMG: %s'):format(ui.refs.minimum_damage:Get()), Vector2.new(globals.screen_size.x/2-text_size.x/2+1+self.x_add, globals.screen_size.y/2+46), Color.new(1, 1, 1, 1), 9, fonts.pixel, true)
                        end
                    end
                scope = EntityList.GetLocalPlayer():GetProp("m_bIsScoped")
                alpha = 0.7
      
                if ui.visuals.scope_conditions:Get(4) and scope then
                    alpha = 0
                else
                    if ui.visuals.arrows:GetInt() == 1 then
                        Render.Text('<', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                        Render.Text('>', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-8), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 15, fonts.verdana11)
                    end

                    if ui.visuals.arrows:GetInt() == 2 then
                        Render.Text('X', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('Z', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end

                    if ui.visuals.arrows:GetInt() == 3 then
                        Render.Text('w', Vector2.new(globals.screen_size.x/2-40-ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 3 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                        Render.Text('x', Vector2.new(globals.screen_size.x/2+31+ui.visuals.arrows_x:Get(), globals.screen_size.y/2-6), ui.refs.yaw_base:Get() == 2 and Color.new(ui.visuals.arrows_color:GetColor().r, ui.visuals.arrows_color:GetColor().g, ui.visuals.arrows_color:GetColor().b, 1) or Color.new(0.1, 0.1, 0.1, alpha), 16, fonts.arrow_font2)
                    end
                end
            end
        }
}
-- @endregion

-- @region: visuals
local visuals = {}
local scope_anim = 0
visuals.scope = function()
    -- vars
    x,y,w,o = globals.screen_size.x / 2, globals.screen_size.y / 2, ui.visuals.scope_width:GetInt(), ui.visuals.scope_offset:GetInt()
    -- проверки
    local fov_cs_debug = CVar.FindVar("fov_cs_debug")

    if not EngineClient.IsConnected() then return end
    if not EntityList.GetLocalPlayer() then return end
    if not EntityList.GetLocalPlayer():GetProp("m_bIsScoped") then return end
    if ui.visuals.custom_scope:GetBool() then
        ui.refs.scope:SetInt(2)
      
        if scope_anim > 0 then scope_anim = scope_anim - 5
            else scope_anim = 0
        end
        if ui.visuals.scope_conditions:Get(2) then scope_anim = 255 else if scope_anim < 255 then scope_anim = scope_anim + 5 else scope_anim = 255 end end
        if ui.visuals.custom_scope and ui.visuals.scope_conditions:Get(3) and fov_cs_debug:GetInt()~=90 then fov_cs_debug:SetInt(90) end

        if ui.visuals.scope_conditions:Get(1) then
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
        else
            color1 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, 0)
            color2 = Color.new(ui.visuals.custom_scope:GetColor().r, ui.visuals.custom_scope:GetColor().g, ui.visuals.custom_scope:GetColor().b, scope_anim / 255)
        end

        Render.GradientBoxFilled(Vector2.new(x - w - o, y), Vector2.new(x - o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x + w + o, y), Vector2.new(x + o, y + 1), color1, color2, color1, color2)
        Render.GradientBoxFilled(Vector2.new(x, y - o - w), Vector2.new(x + 1, y - o), color1, color1, color2, color2)
        Render.GradientBoxFilled(Vector2.new(x, y + o + w), Vector2.new(x + 1, y + o), color1, color1, color2, color2)
    else
        ui.refs.scope:SetInt(1)
    end
end

visuals.circle_desync = function() 
  
    local local_player = EntityList.GetLocalPlayer()
    if not local_player then return end

     if not local_player:IsAlive() then return end
    if ui.visuals.desync_circle_conditions:Get(2) and ui.visuals.desync_circle:GetBool() then
        CVar.FindVar('crosshair'):SetInt(0)
    else
        CVar.FindVar('crosshair'):SetInt(1)
    end

    if ui.visuals.desync_circle:Get() then

        local color = Color.new(ui.visuals.desync_circle:GetColor().r, ui.visuals.desync_circle:GetColor().g, ui.visuals.desync_circle:GetColor().b, 1)
        local view_angles = EngineClient.GetViewAngles()
        local real_yaw = AntiAim.GetCurrentRealRotation()
        local view_yaw = view_angles.yaw - 180;
        local fake = adjust_angle(real_yaw - view_yaw);
        local delta = math.abs(normalize_yaw(AntiAim.GetCurrentRealRotation() % 360 - AntiAim.GetFakeRotation() % 360)) / 2
        local fake_color = Color.RGBA(math.floor(255 - (delta * 2.29824561404)), math.floor(delta * 3.42105263158), math.floor(delta * 0.22807017543), 255)

        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, Color.new(0, 0, 0, 1), 4, 0, 360)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 7, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, 90, ui.refs.invert_side == false and -90 or 270)
        Render.Circle(Vector2.new(globals.screen_size.x/2, globals.screen_size.y/2), 15, 32, ui.visuals.desync_circle_conditions:Get(1) and fake_color or color, 4, fake+30, fake-30)
    end
end

visuals.hitmarker = function()
    if not EngineClient.IsConnected() then return end
    if not ui.visuals.hitmarker:Get() then return end

    misc.removeimpact()
    local color = ui.visuals.hitmarker:GetColor()
    local r = color.r local g = color.g local b = color.b local l = ui.visuals.hitmarker_length:Get()

    for i = 1, #t do

        local screen_pos = Render.WorldToScreen(Vector.new(t[i].x, t[i].y, t[i].z))
        local sx,sy = screen_pos.x, screen_pos.y

        Render.BoxFilled(Vector2.new(sx, sy - l), Vector2.new(sx, sy + l), Color.new(r, g, b, (t[i].a / 255)), 1.0)
        Render.BoxFilled(Vector2.new(sx - l, sy), Vector2.new(sx + l, sy), Color.new(r, g, b, (t[i].a / 255)), 1.0)
    end
end

visuals.thirdperson = function()
    if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
        Menu.FindVar("Visuals", "View", "Thirdperson", "Distance"):Set(ui.misc.thirdperson_distance:Get())
    end
        if ui.misc.thirdperson:Get() and ui.misc.misc_enable:Get() then
            Cheat.SetThirdPersonAnim(not ui.misc.thirdperson_anim:Get())
        else
            Cheat.SetThirdPersonAnim(true)
        end
end
visuals._verification = function(shot)
    local text = ''

    local hg_diff = hgroup ~= aimed_hgroup
    local dmg_diff = shot.damage ~= shot.wanted_damage

    if hg_diff or dmg_diff then
        text = string.format(
            ' | mismatch: [ %s ]', (function()
                local addr = ''

                if dmg_diff then addr = 'dmg: ' .. shot.wanted_damage .. (hg_diff and ' | ' or '') end
                if hg_diff then addr = addr .. (hg_diff and 'hitgroup: ' .. aimed_hgroup or '') end

                return addr
            end)()
        )
    end

    return text
end

local size_changed = false

local text = ''

visuals.glowmenu = function()
    if not ui.misc.menu_customize:Get() then return end
    local menu_pos = Render.GetMenuPos()
    local menu_sz = Render.GetMenuSize()
  
    function force_update()    image_size = Vector2.new(menu_sz.x * 3, menu_sz.y * 3)    end
    if menu_sz.x ~= cache_size.x then force_update() size_changed = true end
    if size_changed == true and cache_size.x == menu_sz.x then force_update() end
    if not Cheat.IsMenuVisible() then return end
  
    if ui.misc.menu_dim:Get() then
        Render.BoxFilled(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(0, 0, 0, ui.misc.dim_slider:GetFloat()))
    end

    if ui.misc.menu_blur:Get() then

        Render.Blur(Vector2.new(0.0, 0.0), Vector2.new(EngineClient.GetScreenSize().x, EngineClient.GetScreenSize().y), Color.new(1, 1, 1, ui.misc.blur_slider:GetFloat()))
    end
  
    if ui.misc.menu_glow:Get() then
        local alpha = 0
        if ui.misc.glow_pulse:Get() then
                alpha = breath(2, ui.misc.color_edit:GetColor().a * 175 / 235)
            else
                alpha = ui.misc.color_edit:GetColor().a
        end

        Render.Image(globals.background, Vector2.new(menu_pos.x - menu_sz.x, menu_pos.y - menu_sz.y), image_size, Color.new(ui.misc.color_edit:GetColor().r, ui.misc.color_edit:GetColor().g, ui.misc.color_edit:GetColor().b, alpha ))
    end
end

visuals.events = function(event)

    local name = event:GetName()
    if name == "player_hurt" then
        local attacker = event:GetInt("attacker")

        if EntityList.GetPlayerForUserID(attacker) == globals.local_player then
      
            if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(1) then
                local player = EntityList.GetPlayerForUserID(event:GetInt("userid"))

                if not player then
                    return
                end

                local hitgroup_names = {
                    [0] = "generic",
                    [1] = "head",
                    [2] = "chest",
                    [3] = "stomach",
                    [4] = "left arm",
                    [5] = "right arm",
                    [6] = "left leg",
                    [7] = "right leg",
                    [10] = "gear"
                }

                logs:add(string.format("Hit %s in the %s for %d damage (%d health remaining)", player:GetName(), hitgroup_names[event:GetInt("hitgroup")] or "?", event:GetInt("dmg_health"), event:GetInt("health")))
            end
        end
    end

    if name == "bullet_impact" then
        local fire_plr = EntityList.GetPlayerForUserID(event:GetInt("userid"))
        local localplayer = EntityList.GetLocalPlayer()
            if fire_plr ~= localplayer then
                return
            end
         table.insert(t, {
            x = event:GetInt("x"),
            y = event:GetInt("y"),
            z = event:GetInt("z"),
            a = 255,
            ctime = GlobalVars.curtime,
         })
    end

    if name == 'player_connect_full' then
        t = {}
    end

    if name == "player_hurt" then
        local localplayer = EntityList.GetLocalPlayer()
        local attacker = EntityList.GetPlayerForUserID(event:GetInt("attacker"))
        if ui.misc.hitsound:Get() and ui.misc.misc_enable:Get() then
            if attacker == localplayer then
                EngineClient.ExecuteClientCmd(string.format("playvol %s %s", ui.misc.hitsound_direction:Get(), ui.misc.hitsound_volume:Get()))
            end
        end
    end

    if name == 'player_hurt' then
        local weapon = event:GetString('weapon', '');
        if (weapon == 'hegrenade' or weapon == 'inferno' or weapon == 'knife') then
            if event:GetInt('userid') == nil then return end
            if event:GetInt('attacker') == nil then return end
            local attacker_id = EntityList.GetPlayerForUserID(event:GetInt('attacker'))
            if attacker_id == nil or attacker_id ~= EntityList.GetLocalPlayer() then
                return
            end
          
            local hittype = 'Hit'
            if weapon == 'hegrenade' then
                hittype = 'Naded';
            elseif weapon == 'inferno' then
                hittype = 'Burned';
            elseif weapon == 'knife' then
                hittype = 'Knifed';
            end
            local server_damage = event:GetInt('dmg_health')
            local target_id = EntityList.GetPlayerForUserID(event:GetInt('userid'))
            if target_id == nil then return end
            local target_name = string.lower(target_id:GetName())
            local health = target_id:GetProp('m_iHealth')-server_damage
            if health < 0 then health = 0 end
            text = string.format('%s %s for %i damage (%i remaining)', hittype, target_name, server_damage, health)
            if ui.visuals.log_type:Get(3) then
                ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
                ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), text..'\n')

                table.insert(hitlogs, {text = text, time = GlobalVars.realtime})

            end
        end
    end

end
local hitgroup_names1 = { 'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear' }

visuals.ragebot_shot = function(shot)
    miss_hitbox = missgroup_names[shot.hitgroup] or '?'
end

visuals.registered_shot = function(shot)

    hit_id = hit_id + 1
    shot_id = num_format((hit_id % 15) + 1)
    local safety = Menu.FindVar('Aimbot', 'Ragebot', 'Misc', 'Safe Points'):Get()
    local name = string.lower(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetName())
    if name == nil then return end
    local hgroup = hitgroup_names1[shot.hitgroup + 1] or '?'
    local hit_chance = tostring(math.floor(shot.hitchance + 0.5))
    local backtrack = shot.backtrack
    local m_iHealth = EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_iHealth')
    if m_iHealth == nil then return end
    local health = m_iHealth - shot.damage
    if health < 0 then health = 0 end
    local aimed_hgroup = hitgroup_names1[shot.wanted_hitgroup + 1] or '?'
  
    local feet_yaw = math.min(58, math.max(yaw_normalize(EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter')[12] * 120 - 60), -58))
    if EntityList.GetClientEntity(shot.target_index):GetPlayer():GetProp('m_flPoseParameter') == nil then return end
    if feet_yaw == nil then return end
    local ping = EngineClient.GetNetChannelInfo():GetLatency(0)*1000
    local avg_ping = EngineClient.GetNetChannelInfo():GetAvgLatency(0)*1000
    --if shot.reason == nil or hit_id == nil or aimed_hgroup == nil or shot_id == nil or feet_yaw == nil or safety == nil or name == nil or hit_chance == nil or ping == nil or avg_ping == nil then return end
    local netChannelInfo = ffi.cast('void***', getNetChannelInfo(I_EngineClientPtr)) or error('netchaninfo is nil')
    local netChannel = GetNetChannel(netChannelInfo)
    local net_state = string.format(
        'delay: %d:%.2f | dropped: %.0f',
        avg_ping, math.abs(avg_ping-ping), (netChannel.AvgLoss*100)
    )
  
    local uflags = {
        math.abs(avg_ping-ping) < 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction'):GetInt() == 1 and 0 or 1,
        CVar.FindVar('cl_clock_correction_force_server_tick') == 999 and 0 or 1
    }

    local pflags = {
        ClientState.m_choked_commands > 1 and 1 or 0,
        EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier') < 1.00 and 1 or 0,
        (EntityList.GetLocalPlayer():GetRenderOrigin().z <= EntityList.GetClientEntity(shot.target_index):GetPlayer():GetRenderOrigin().z) and 1 or 0
    }

    local correction = Menu.FindVar('Aimbot', 'Ragebot', 'Main', 'Override Resolver'):GetBool()
  
    if shot.reason == 0 then
        text = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s%% | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
        textc = string.format('Registered %s shot in %s\'s %s for %d damage [angle: %.2f° | %d:%d°] ( hitchance: %s | safety: %s | history(Δ): %d | flags: %s%s )',
        shot_id, name, hgroup, shot.damage, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, hit_chance .. '%%', safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags), visuals._verification(shot))
    elseif shot.reason == 1 then
        shot_reason = (shot.reason == 1 and total_hits ~= EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')) and 'damage rejection' or string.format('unknown [angle: %.2f° | %d:%d°]', shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw)
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to %s ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot_reason, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 2 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to spread [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 3 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to occlusion [angle: %.2f° | %d:%d°] ( dmg: %d | safety: %d | history(Δ): %d | flags: %s )',
        shot_id, name, miss_hitbox, hit_chance, shot.spread_degree, correction and 1 or 0, (feet_yaw < 10 and feet_yaw > -10) and 0 or feet_yaw, shot.wanted_damage, safety == 2 and 2 or (safety == 1 and 1 or 0), backtrack, table.concat(pflags))
    elseif shot.reason == 4 then
        text1 = string.format('Missed %s shot at %s\'s %s(%s%%) due to prediction error [%s] [vel_modifier: %.1f | history(Δ): %d | error: %s]',
        shot_id, name, miss_hitbox, hit_chance, net_state, EntityList.GetLocalPlayer():GetProp('m_flVelocityModifier'), backtrack, table.concat(uflags))
    end
    if ui.visuals.log_type:Get(3) then

        if shot.reason == 0 then
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 255), textc..'\n')
        else
            ffi_functions.color_print1(Color.RGBA(255, 162, 163, 255), '[psycho] ')
            ffi_functions.color_print1(Color.RGBA(216, 216, 216, 200), text1..'\n')
        end

        table.insert(hitlogs, {text = text, time = GlobalVars.realtime})
    end

end

-- @endregion

-- @region: world
local world = {}
world.sun_set = function()
    if not ui.world.world_enable:GetBool() then return end
    local CCascadeLights = EntityList.GetEntitiesByName('CCascadeLight')
    if not CCascadeLights == nil then return end
    for i=1, #CCascadeLights do
        local CCascadeLight = CCascadeLights[i]
        if ui.world.sunset:GetBool() then
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(ui.world.shadow_x:Get(), ui.world.shadow_y:Get(), ui.world.shadow_z:Get()))
            end
            if CCascadeLight:GetProp('m_flMaxShadowDist') ~= ui.world.shadow_dist:Get() then
                CCascadeLight:SetProp('m_flMaxShadowDist', ui.world.shadow_dist:Get())
            end
        else
            if CCascadeLight:GetProp('m_shadowDirection') ~= Vector.new(0, 0, 0) then
                CCascadeLight:SetProp('m_shadowDirection', Vector.new(0, 0, 0))
                CCascadeLight:SetProp('m_envLightShadowDirection', Vector.new(0, 0, 0))
            end
        end
    end
end

local materials = {
    "particle/fire_burning_character/fire_env_fire_depthblend_oriented", "particle/fire_burning_character/fire_burning_character", "particle/fire_explosion_1/fire_explosion_1_oriented", "particle/fire_explosion_1/fire_explosion_1_bright", "particle/fire_burning_character/fire_burning_character_depthblend", "particle/fire_burning_character/fire_env_fire_depthblend",
}

world.molotov = function()
    for _, v in pairs(materials) do
        local material = MatSystem.FindMaterial(v, "")

        if material ~= nil then
            material:SetMaterialVarFlag(bit.lshift(1, 28), ui.world.molly_conditions:Get(1) and ui.world.world_enable:GetBool())
            material:SetMaterialVarFlag(bit.lshift(1, 15), ui.world.molly_conditions:Get(2) and ui.world.world_enable:GetBool())
        end
    end

end

-- effects
world.effects = function()
    if not ui.world.enable_bloom:Get() and ui.world.world_enable:Get() then return end
    if not EntityList.GetLocalPlayer() then
        return
    end

        local ambient = CVar.FindVar('r_modelAmbientMin')

        local CETC = EntityList.GetEntitiesByName('CEnvTonemapController')

        for idx, entity in pairs(CETC) do
            entity:SetProp('m_bUseCustomAutoExposureMin', true)
            entity:SetProp('m_bUseCustomAutoExposureMax', true)
            entity:SetProp('m_bUseCustomBloomScale', true)
            entity:SetProp('m_flCustomAutoExposureMin', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomAutoExposureMax', ui.world.exposure:GetFloat() / 10);
            entity:SetProp('m_flCustomBloomScale', ui.world.bloom:GetFloat() / 10);
        end

        ambient:SetFloat(ui.world.model_ambient:GetFloat() / 10)

end

world.custom_skybox = function()
    if ui.world.custom_skybox:GetBool() and ui.world.world_enable:GetBool() then
        skybox_color = ui.world.custom_skybox:GetColor()
        skyboxname = ui.world.skybox_choose:GetString()
        cvar = CVar.FindVar("sv_skyname")
        ui.refs.skybox:SetInt(0)
        ui.refs.skybox:SetColor(skybox_color)
        cvar:SetString(skyboxname)
    else
        return 
    end
end
-- @endregion

logs = {
    logs = {},
    draw = function(self)
        local draw_offset = 50

        for _, log in pairs(self.logs) do
            local expired = log.expire_time < GlobalVars.realtime

            if expired then
                log.alpha = helpers:lerp(log.alpha, 0)
                log.pos = helpers:lerp(log.pos, 0)
            else
                log.alpha = helpers:lerp(log.alpha, 1)
                log.pos = helpers:lerp(log.pos, draw_offset)
                draw_offset = draw_offset + 30
            end

            if log.alpha < 0.01 and expired then
                table.remove(self.logs, _)
            else
                local size = Render.CalcTextSize(log.text, 11, fonts.verdana).x
                local pos = Vector2.new((globals.screen_size.x - size) * 0.5 - 5, globals.screen_size.y - log.pos)
                widgets:create_window(pos, pos + Vector2.new(size + 10, 20), log.alpha)
                Render.Text(log.text, pos + Vector2.new(5, 4), Color.new(1, 1, 1, log.alpha), 11, fonts.verdana)
            end
        end
    end,
    add = function(self, text)
        local log = {
            text = text,
            expire_time = GlobalVars.realtime + 5,
            pos = 0,
            alpha = 0,
        }

        table.insert(self.logs, log)
    end
}

-- @region: config system
ffi_functions.VGUI_System = ffi.cast(ffi.typeof('void***'), Utils.CreateInterface('vgui2.dll', 'VGUI_System010'))
ffi_functions.get_clipboard_text_length = ffi.cast('get_clipboard_text_length', ffi_functions.VGUI_System[0][7])
ffi_functions.get_clipboard_text = ffi.cast('get_clipboard_text', ffi_functions.VGUI_System[0][11])
ffi_functions.set_clipboard_text = ffi.cast('set_clipboard_text', ffi_functions.VGUI_System[0][9])

cfg_system.set_clipboard = function(text)
    ffi_functions.set_clipboard_text(ffi_functions.VGUI_System, text, #text)
end

cfg_system.get_clipboard = function()
    local clipboard_text_length = ffi_functions.get_clipboard_text_length(ffi_functions.VGUI_System)

    if (clipboard_text_length > 0) then
        local buffer = ffi.new('char[?]', clipboard_text_length)

        ffi_functions.get_clipboard_text(ffi_functions.VGUI_System, 0, buffer, clipboard_text_length * ffi.sizeof('char[?]', clipboard_text_length))
        return ffi.string(buffer, clipboard_text_length - 1)
    end

    return ''
end

cfg_system.cfg_data = {
    bools = {
        ui.anti_aims.custom[1].enable, ui.anti_aims.custom[2].enable, ui.anti_aims.custom[3].enable, ui.anti_aims.custom[4].enable, ui.anti_aims.custom[5].enable, ui.anti_aims.custom[6].enable,
        ui.anti_aims.custom[1].freestanding_bodyyaw, ui.anti_aims.custom[2].freestanding_bodyyaw, ui.anti_aims.custom[3].freestanding_bodyyaw, ui.anti_aims.custom[4].freestanding_bodyyaw, ui.anti_aims.custom[5].freestanding_bodyyaw, ui.anti_aims.custom[6].freestanding_bodyyaw,
        ui.anti_aims.custom[1].step_abs, ui.anti_aims.custom[2].step_abs, ui.anti_aims.custom[3].step_abs, ui.anti_aims.custom[4].step_abs, ui.anti_aims.custom[5].step_abs, ui.anti_aims.custom[6].step_abs,
        ui.misc.misc_enable,
        ui.misc.slowwalk_c,
        ui.misc.hitsound,
        ui.world.custom_skybox,
        ui.world.world_enable,
        ui.world.sunset,
        ui.visuals.visuals_enable,
        ui.visuals.disable_blur,
        ui.visuals.disable_background,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.anti_aims.antiaim_enable,
        ui.misc.menu_glow,
        ui.misc.glow_pulse,
        ui.misc.menu_dim,
        ui.misc.menu_blur,
        ui.misc.menu_customize,
        ui.misc.thirdperson,
        ui.ragebot.maxmissed,
        ui.misc.thirdperson_anim,
        ui.world.enable_bloom,
        ui.misc.clantag,
        ui.ragebot.dormant_aimbot,
        ui.ragebot.doubletap_recharge,
        ui.ragebot.override_doubletap,
        ui.ragebot.Teleport_In_Air,
        ui.visuals.gamesense,
        ui.ragebot.bodyaims,
        ui.misc.color_override,
        ui.misc.autopeek,
        ui.misc.quick_peek

    },
    ints = {
        ui.anti_aims.custom[1].yaw_mode, ui.anti_aims.custom[2].yaw_mode, ui.anti_aims.custom[3].yaw_mode, ui.anti_aims.custom[4].yaw_mode, ui.anti_aims.custom[5].yaw_mode, ui.anti_aims.custom[6].yaw_mode,
        ui.anti_aims.custom[1].static_yaw, ui.anti_aims.custom[2].static_yaw, ui.anti_aims.custom[3].static_yaw, ui.anti_aims.custom[4].static_yaw, ui.anti_aims.custom[5].static_yaw, ui.anti_aims.custom[6].static_yaw,
        ui.anti_aims.custom[1].tick_yaw_left, ui.anti_aims.custom[2].tick_yaw_left, ui.anti_aims.custom[3].tick_yaw_left, ui.anti_aims.custom[4].tick_yaw_left, ui.anti_aims.custom[5].tick_yaw_left, ui.anti_aims.custom[6].tick_yaw_left,
        ui.anti_aims.custom[1].tick_yaw_right, ui.anti_aims.custom[2].tick_yaw_right, ui.anti_aims.custom[3].tick_yaw_right, ui.anti_aims.custom[4].tick_yaw_right, ui.anti_aims.custom[5].tick_yaw_right, ui.anti_aims.custom[6].tick_yaw_right,
        ui.anti_aims.custom[1].choke_yaw_left, ui.anti_aims.custom[2].choke_yaw_left, ui.anti_aims.custom[3].choke_yaw_left, ui.anti_aims.custom[4].choke_yaw_left, ui.anti_aims.custom[5].choke_yaw_left, ui.anti_aims.custom[6].choke_yaw_left,
        ui.anti_aims.custom[1].choke_yaw_right, ui.anti_aims.custom[2].choke_yaw_right, ui.anti_aims.custom[3].choke_yaw_right, ui.anti_aims.custom[4].choke_yaw_right, ui.anti_aims.custom[5].choke_yaw_right, ui.anti_aims.custom[6].choke_yaw_right,
        ui.anti_aims.custom[1].desync_yaw_left, ui.anti_aims.custom[2].desync_yaw_left, ui.anti_aims.custom[3].desync_yaw_left, ui.anti_aims.custom[4].desync_yaw_left, ui.anti_aims.custom[5].desync_yaw_left, ui.anti_aims.custom[6].desync_yaw_left,
        ui.anti_aims.custom[1].desync_yaw_right, ui.anti_aims.custom[2].desync_yaw_right, ui.anti_aims.custom[3].desync_yaw_right, ui.anti_aims.custom[4].desync_yaw_right, ui.anti_aims.custom[5].desync_yaw_right, ui.anti_aims.custom[6].desync_yaw_right,
        ui.anti_aims.custom[1].yaw_jitter, ui.anti_aims.custom[2].yaw_jitter, ui.anti_aims.custom[3].yaw_jitter, ui.anti_aims.custom[4].yaw_jitter, ui.anti_aims.custom[5].yaw_jitter, ui.anti_aims.custom[6].yaw_jitter,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree, ui.anti_aims.custom[3].yaw_jitter_degree, ui.anti_aims.custom[4].yaw_jitter_degree, ui.anti_aims.custom[5].yaw_jitter_degree, ui.anti_aims.custom[6].yaw_jitter_degree,
        ui.anti_aims.custom[1].yaw_jitter_degree, ui.anti_aims.custom[2].yaw_jitter_degree2, ui.anti_aims.custom[3].yaw_jitter_degree2, ui.anti_aims.custom[4].yaw_jitter_degree2, ui.anti_aims.custom[5].yaw_jitter_degree2, ui.anti_aims.custom[6].yaw_jitter_degree2,
    
        ui.anti_aims.custom[1].self_bodyyaw_mode, ui.anti_aims.custom[2].self_bodyyaw_mode, ui.anti_aims.custom[3].self_bodyyaw_mode, ui.anti_aims.custom[4].self_bodyyaw_mode, ui.anti_aims.custom[5].self_bodyyaw_mode, ui.anti_aims.custom[6].self_bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_mode, ui.anti_aims.custom[2].bodyyaw_mode, ui.anti_aims.custom[3].bodyyaw_mode, ui.anti_aims.custom[4].bodyyaw_mode, ui.anti_aims.custom[5].bodyyaw_mode, ui.anti_aims.custom[6].bodyyaw_mode,
        ui.anti_aims.custom[1].bodyyaw_degree, ui.anti_aims.custom[2].bodyyaw_degree, ui.anti_aims.custom[3].bodyyaw_degree, ui.anti_aims.custom[4].bodyyaw_degree, ui.anti_aims.custom[5].bodyyaw_degree, ui.anti_aims.custom[6].bodyyaw_degree,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_left, ui.anti_aims.custom[2].jitter_bodyyaw_degree_left, ui.anti_aims.custom[3].jitter_bodyyaw_degree_left, ui.anti_aims.custom[4].jitter_bodyyaw_degree_left, ui.anti_aims.custom[5].jitter_bodyyaw_degree_left, ui.anti_aims.custom[6].jitter_bodyyaw_degree_left,
        ui.anti_aims.custom[1].jitter_bodyyaw_degree_right, ui.anti_aims.custom[2].jitter_bodyyaw_degree_right, ui.anti_aims.custom[3].jitter_bodyyaw_degree_right, ui.anti_aims.custom[4].jitter_bodyyaw_degree_right, ui.anti_aims.custom[5].jitter_bodyyaw_degree_right, ui.anti_aims.custom[6].jitter_bodyyaw_degree_right,
        ui.anti_aims.custom[1].step_bodyyaw_degree_left, ui.anti_aims.custom[2].step_bodyyaw_degree_left, ui.anti_aims.custom[3].step_bodyyaw_degree_left, ui.anti_aims.custom[4].step_bodyyaw_degree_left, ui.anti_aims.custom[5].step_bodyyaw_degree_left, ui.anti_aims.custom[6].step_bodyyaw_degree_left,
        ui.anti_aims.custom[1].step_bodyyaw_degree_right, ui.anti_aims.custom[2].step_bodyyaw_degree_right, ui.anti_aims.custom[3].step_bodyyaw_degree_right, ui.anti_aims.custom[4].step_bodyyaw_degree_right, ui.anti_aims.custom[5].step_bodyyaw_degree_right, ui.anti_aims.custom[6].step_bodyyaw_degree_right,
        ui.anti_aims.custom[1].body_yaw_step_ticks, ui.anti_aims.custom[2].body_yaw_step_ticks, ui.anti_aims.custom[3].body_yaw_step_ticks, ui.anti_aims.custom[4].body_yaw_step_ticks, ui.anti_aims.custom[5].body_yaw_step_ticks, ui.anti_aims.custom[6].body_yaw_step_ticks,
        ui.anti_aims.custom[1].body_yaw_step_value, ui.anti_aims.custom[2].body_yaw_step_value, ui.anti_aims.custom[3].body_yaw_step_value, ui.anti_aims.custom[4].body_yaw_step_value, ui.anti_aims.custom[5].body_yaw_step_value, ui.anti_aims.custom[6].body_yaw_step_value,

        ui.anti_aims.custom[1].fake_yaw_mode, ui.anti_aims.custom[2].fake_yaw_mode, ui.anti_aims.custom[3].fake_yaw_mode, ui.anti_aims.custom[4].fake_yaw_mode, ui.anti_aims.custom[5].fake_yaw_mode, ui.anti_aims.custom[6].fake_yaw_mode,
        ui.anti_aims.custom[1].static_fakeyaw, ui.anti_aims.custom[2].static_fakeyaw, ui.anti_aims.custom[3].static_fakeyaw, ui.anti_aims.custom[4].static_fakeyaw, ui.anti_aims.custom[5].static_fakeyaw, ui.anti_aims.custom[6].static_fakeyaw,
        ui.anti_aims.custom[1].jitter_fakeyaw_left, ui.anti_aims.custom[2].jitter_fakeyaw_left, ui.anti_aims.custom[3].jitter_fakeyaw_left, ui.anti_aims.custom[4].jitter_fakeyaw_left, ui.anti_aims.custom[5].jitter_fakeyaw_left, ui.anti_aims.custom[6].jitter_fakeyaw_left,
        ui.anti_aims.custom[1].jitter_fakeyaw_right, ui.anti_aims.custom[2].jitter_fakeyaw_right, ui.anti_aims.custom[3].jitter_fakeyaw_right, ui.anti_aims.custom[4].jitter_fakeyaw_right, ui.anti_aims.custom[5].jitter_fakeyaw_right, ui.anti_aims.custom[6].jitter_fakeyaw_right,
        ui.anti_aims.custom[1].step_ticks, ui.anti_aims.custom[2].step_ticks, ui.anti_aims.custom[3].step_ticks, ui.anti_aims.custom[4].step_ticks, ui.anti_aims.custom[5].step_ticks, ui.anti_aims.custom[6].step_ticks,
        ui.anti_aims.custom[1].step_value, ui.anti_aims.custom[2].step_value, ui.anti_aims.custom[3].step_value, ui.anti_aims.custom[4].step_value, ui.anti_aims.custom[5].step_value, ui.anti_aims.custom[6].step_value,
        ui.anti_aims.custom[1].step_fake_min, ui.anti_aims.custom[2].step_fake_min, ui.anti_aims.custom[3].step_fake_min, ui.anti_aims.custom[4].step_fake_min, ui.anti_aims.custom[5].step_fake_min, ui.anti_aims.custom[6].step_fake_min,
        ui.anti_aims.custom[1].step_fake_max, ui.anti_aims.custom[2].step_fake_max, ui.anti_aims.custom[3].step_fake_max, ui.anti_aims.custom[4].step_fake_max, ui.anti_aims.custom[5].step_fake_max, ui.anti_aims.custom[6].step_fake_max,
        ui.anti_aims.custom[1].extra_options, ui.anti_aims.custom[2].extra_options, ui.anti_aims.custom[3].extra_options, ui.anti_aims.custom[4].extra_options, ui.anti_aims.custom[5].extra_options, ui.anti_aims.custom[6].extra_options,
        ui.misc.slowwalk_slider,
        ui.world.shadow_dist,
        ui.world.molly_conditions,
        ui.visuals.widgets,
        ui.visuals.watermark_info,
        ui.visuals.statepanel_image,
        ui.visuals.log_type,
        ui.visuals.indicator_type,
        ui.visuals.arrows,
        ui.visuals.arrows_x,
        ui.visuals.scope_width,
        ui.visuals.scope_offset,
        ui.visuals.scope_conditions,
        ui.visuals.desync_circle_conditions,
        ui.visuals.hitmarker_length,
      
        ui.anti_aims.antiaim_helpers,
        ui.ragebot.tp_in_air,
        ui.anti_aims.animbreakers,
        ui.misc.thirdperson_distance,
        ui.ragebot.maxmissed_c,
        ui.ragebot.dormant_aimbot_damage,
        ui.ragebot.doubletap_speed,
        ui.visuals.gamesense_choose,
        ui.ragebot.baimhp,
        ui.ragebot.baimmode,
        ui.ragebot.hitchances,
        ui.ragebot.air_hitchance,
        ui.ragebot.noscope_hitchance,

    },

    floats = {
        ui.misc.hitsound_volume,
        ui.world.shadow_x,
        ui.world.shadow_y,
        ui.world.shadow_z,
        ui.misc.blur_slider,
        ui.misc.dim_slider,
        ui.world.exposure,
        ui.world.bloom,
        ui.world.model_ambient,

    },

    strings = {
        ui.misc.hitsound_direction,
        ui.world.skybox_choose,
        ui.visuals.custom_username
    },

    colors = {
        ui.visuals.ghosty_color,
        ui.visuals.ind_name_color,
        ui.visuals.ind_state_color,
        ui.visuals.ind_color,
        ui.visuals.arrows_color,
        ui.visuals.theme,
        ui.world.custom_skybox,
        ui.visuals.custom_scope,
        ui.visuals.desync_circle,
        ui.visuals.hitmarker,
        ui.misc.color_edit,
        ui.misc.color_override,
        ui.misc.autopeek
    }
}

de_en_coding = 'pl3KmT/U1Djka4d7xA9WHXfNvngIbe56PSRFZGLOwrq2Ms8QEytVYhBJoC0i+czu'

cfg_system.encode = function(data)
    return ((data:gsub('.', function(x)
        local r,de_en_coding= '', x:byte()
        for i=8,1,-1 do r=r..(de_en_coding%2^i-de_en_coding%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 de_en_coding:sub(c+1,c+1)
    end)..({ '', '==', '=' })[#data%3+1])
end

cfg_system.decode = function(data)
    data = string.gsub(data, '[^'..de_en_coding..'=]', '')
    return (data:gsub('.', function(x)
        if (x == '=') then return '' end
        local r,f='',(de_en_coding: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
ui.global.export_cfg:RegisterCallback(function()
    local code = {{}, {}, {}, {}, {}}

    for _, bools in pairs(cfg_system.cfg_data.bools) do
        table.insert(code[1], bools:GetBool())
    end

    for _, ints in pairs(cfg_system.cfg_data.ints) do
        table.insert(code[2], ints:GetInt())
    end

    for _, floats in pairs(cfg_system.cfg_data.floats) do
        table.insert(code[3], floats:GetFloat())
    end

    for _, strings in pairs(cfg_system.cfg_data.strings) do
        table.insert(code[4], strings:GetString())
    end

    for _, colors in pairs(cfg_system.cfg_data.colors) do
        local clr = colors:GetColor()
        table.insert(code[5], string.format('%02X%02X%02X%02X', math.floor(clr.r * 255), math.floor(clr.g * 255), math.floor(clr.b * 255), math.floor(clr.a * 255)))
    end
  
    cfg_system.set_clipboard(cfg_system.encode(json.stringify(code)))
    logs:add('Config exported to clipboard.')
end)

cfg_system.config_load = function(text)
    local decode_cfg = json.parse(cfg_system.decode(text))
    if decode_cfg == nil then
        logs:add('Failed to load config.')
    else
        for k, v in pairs(decode_cfg) do
            k = ({[1] = 'bools', [2] = 'ints', [3] = 'floats', [4] = 'strings', [5] = 'colors'})[k]

            for k2, v2 in pairs(v) do
                if (k == 'bools') then
                    cfg_system.cfg_data[k][k2]:SetBool(v2)
                end

                if (k == 'ints') then
                    cfg_system.cfg_data[k][k2]:SetInt(v2)
                end

                if (k == 'floats') then
                    cfg_system.cfg_data[k][k2]:SetFloat(v2)
                end

                if (k == 'strings') then
                    cfg_system.cfg_data[k][k2]:SetString(v2)
                end

                if (k == 'colors') then
                    cfg_system.cfg_data[k][k2]:SetColor(Color.new(tonumber('0x'..v2:sub(1, 2))/255, tonumber('0x'..v2:sub(3, 4))/255, tonumber('0x'..v2:sub(5, 6))/255, tonumber('0x'..v2:sub(7, 8))/255))
                end
            end
        end
      
        logs:add("Applied imported config.")
    end
end
ui.global.import_cfg:RegisterCallback(function()
    cfg_system.config_load(cfg_system.get_clipboard())
end)

ui.global.default_cfg:RegisterCallback(function()
    cfg_system.config_load("5t1y1Fri1FmRdOAtefHM1F1RdOAtefHM1FaRdLnSIU4Gk31Y1FrYbOXGk31h1FrYbOXGk31B1FrYbOXGk31J1FrYbOXGk31o1FrLvfyVn9ERd910eUDhn9ERaWpRdOAtefHM1Fmy1FrLvfyVn9ERaW1RdLnSIU4Gk31yat10nLTMbBHM1FmY1FrLvfyVn9ERaWHRdLnSIU4Gk31y4R10nLTMbBHM1FmJ1FrLvfyVn9ERaWPRdLnSIU4Gk31yd910eUDhn9ERaFpRdLnSIU4Gk31ta910eUDhn9ERaF1RdOAtefHM1F1V1FrYbOXGk31t4310eUDhn9ERaFHRdOAtefHM1F1B1FrLvfyVn9ERaFbRdLnSIU4Gk31td310eUDhn9ERaFZRdOAtefHM1FaE1FrYbOXGk31Va910eUDhn9ERaV1RdOAtefHM1FaV1FrYbOXGk31V4310eUDhn9ERaVHRdLnSIU4Gk31V4R10eUDhn9ERaVbRdOAtefHM1Fao1FrYbOXGk31Vd910eUDhn9ER4KpRdLnSIU4Gk31Ya910eUDhn9ER4K1RdOAtefHM1FxV1FrLvfyVn9ER4KxRdOAtefHM1Fxh1FrYbOXGk31Y4R10eUDhnNYM1F1RdOMRa910a9ERaR10aRERat10a3ER4310a3ER4910a9ER4R10aRER4t10a3ERd310a3ERd910a3ERaWpRdFpM1Fmy1Fwoa3ERaW1RdFpM1FmV1FwsaRERaWxRdFpM1Fmh1FwEk31y4R10a3ERaWbRdRYtk31yd310a3ERaWZRdF1M1F1E1FwEk31ta910a3ERaF1RdFpM1F1V1Fwtk31t4310a3ERaFHRdFpM1F1B1FwsaRERaFbRdFpM1F1o1FwEk31td910a3ERaVpRdRYtk31Va910a3ERaV1RdF1M1FaV1FwEk31V4310a3ERaVHRdFpM1FaB1Fwtk31V4t10a3ERaVPRdFpM1FaC1FwEk31Ya310a3ER4KmRdFpM1Fxt1FwEk31Yat10a3ER4KxRdFpM1Fxh1FwEk31Y4R10a3ER4KbRdFpM1Fxo1FwEk31Yd910a9ER4WpRdFmM1FHy1Fwyk31haR10a9ER4WaRdFmM1FHY1Fwyk31h49104FvM1FHB1FwJa9ER4WbRdFbJk31hd310aW1M1FHC1FwBa9ER4FpRdFvtk31Ba9104FvM1Fvt1FwJatER4FaRdFPyk31B4310a3ER4FHRdFvhk31B4R104FbM1FvJ1Fwtk31Bd310aRER4FZRdF1M1FbE1FwVk31Ja910aRER4V1RdF1M1FbV1Fwtk31J4310aRER4VHRdFpM1FbB1FwEk31J4t10a9ER4VPRdF1M1FbC1Fwhd3ERdKpRdFHok31oa9104FpM1FPt1FwBa3ERdKaRdFHok31o43104WPM1FPh1FwVa3ERdKvRdFaEk31o4t10aVpM1FPo1FwVa3ERdKZRdFHtk31Ca310aVpM1FZy1FwVa3ERdW1RdFaEk31Cat10aVpM1FZY1FwVa3ERdWHRdFvEk31C4R10aVpM1FZJ1FwYk31Cd31049ERdWZRdFPM1FmEa310d3ERaWpy1Fwok31yaK1RdFxM1FmEat10aRERaWpY1Fwtk31yaKHRdFHM1FmE4R1049ERaWpJ1Fwhk31yaKPRdFmM1FmEd9104WpM1Fmya3104WpM1Fmya9104WPM1FmyaR104WPM1Fmyat104WPM1Fmy43104WpM1Fmy49104FpM1Fmy4R104FpM1Fmy4t104WPM1Fmyd3104WPM1Fmyd9104WPM1Fmta3104FpM1Fmta910a3ERaW1t1FwEk31yaFaRdFpM1Fmt4310a3ERaW1h1FwEk31yaFvRdFpM1Fmt4t104WpM1Fmtd310aWpEa3ERaW1C1FwVk31yaVpRdFvVk31yaVmRdF1Ck31yaV1RdFaM1FmVat1049ERaWaY1Fwyk31yaVHRdF1M1FmV4R10a3ERaWaJ1Fwod9ERaWao1FwtaRERaWaC1Fwy43ERaWxE1Fwtk31y4KmRdFvM1FmYaR10aWmM1FmYat1043ERaWxY1FwJk31y4KHRdFvhk31y4KvRdF1M1FmY4t10a9ERaWxo1Fwy4tERaWxC1FwtaKxJ69ERat105t1y1Fwyk31t1FwBa3ERat104FpM1FxRdFmEa3ER4910a9ER4R10a3oVaKpEaKpEaWmCaFpCaFPC4RER4t10a3ERd310a3ERd910aUYM1FxRdOMRa9101O4EvND2I/H8eBTB1RERaR101G4Evf4GAfCOgfCGkYCGvOXMvX+E431M1FaRdRDEgfCO5LXYn9Dck31h1Fri1FmRdRD3xHmYAZnKd31M1F1RdRD/AZn/AZn/AR1M1FaRdRD/AZn/AZn/AR1M1FxRdRD/AZn/AZn/AR1M1FHRdRD3xFG3AZnKd31M1FvRdRD34KS3AZvEa31M1FbRdRD/AZnTAZX/AR1M1FPRdRD3AWG3AZnKd31M1FZRdRDlaVZyAZn/AR1M1FmE1FwRdWPJAZHoxVPRk31ya9101FPB4ZD/AFxY1Ohc")
end)
-- @endregion

function ui_set_visible(vis, bool)
    vis:SetVisible(bool)
end

local function ui_callbacks()
    --ragebot
    ui.ragebot.maxmissed:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.maxmissed_c:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.maxmissed:GetBool())
    ui.ragebot.dormant_aimbot:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.dormant_aimbot_damage:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.dormant_aimbot:GetBool())
    ui.ragebot.override_doubletap:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.doubletap_speed:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.doubletap_recharge:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.override_doubletap:GetBool())
    ui.ragebot.Teleport_In_Air:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.tp_in_air:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.Teleport_In_Air:Get())
    ui.ragebot.bodyaims:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.baimmode:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.baimhp:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.bodyaims:Get())
    ui.ragebot.hitchances:SetVisible(ui.ragebot.ragebot_enable:GetBool())
    ui.ragebot.air_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(1))
    ui.ragebot.noscope_hitchance:SetVisible(ui.ragebot.ragebot_enable:GetBool() and ui.ragebot.hitchances:Get(2))


    --widgets
    ui.visuals.widgets:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.watermark_info:SetVisible(ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.statepanel_image:SetVisible(ui.visuals.widgets:Get(4) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.custom_username:SetVisible(ui.visuals.watermark_info:Get(1) and ui.visuals.widgets:Get(3) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.theme:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_blur:SetVisible(ui.visuals.visuals_enable:GetBool() and (ui.visuals.widgets:Get(1) or ui.visuals.widgets:Get(2) or ui.visuals.widgets:Get(3) or ui.visuals.widgets:Get(4) or ui.visuals.widgets:Get(6)))
    ui.visuals.disable_background:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.indicator_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(5))
    ui.visuals.arrows:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_x:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.arrows_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.arrows:Get() ~= 0 and ui.visuals.visuals_enable:GetBool())
    ui.visuals.ghosty_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 1)
    ui.visuals.ind_name_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_state_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)
    ui.visuals.ind_color:SetVisible(ui.visuals.widgets:Get(5) and ui.visuals.visuals_enable:GetBool() and ui.visuals.indicator_type:Get() == 0)

    --visuals micellaneous
    ui.visuals.custom_scope:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_width:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_offset:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.scope_conditions:SetVisible(ui.visuals.custom_scope:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.desync_circle_conditions:SetVisible(ui.visuals.desync_circle:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.hitmarker_length:SetVisible(ui.visuals.hitmarker:GetBool() and ui.visuals.visuals_enable:GetBool())
    ui.visuals.log_type:SetVisible(ui.visuals.visuals_enable:GetBool() and ui.visuals.widgets:Get(6))
    ui.visuals.gamesense:SetVisible(ui.visuals.visuals_enable:GetBool())
    ui.visuals.gamesense_choose:SetVisible(ui.visuals.gamesense:GetBool() and ui.visuals.visuals_enable:GetBool())
    -- world
    ui.world.sunset:SetVisible(ui.world.world_enable:GetBool())
    ui.world.shadow_x:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_y:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_z:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.shadow_dist:SetVisible(ui.world.sunset:GetBool() and ui.world.world_enable:GetBool())
    ui.world.molly_conditions:SetVisible(ui.world.world_enable:GetBool())
    ui.world.custom_skybox:SetVisible(ui.world.world_enable:GetBool())
    ui.world.skybox_choose:SetVisible(ui.world.world_enable:GetBool() and ui.world.custom_skybox:GetBool())
    ui.world.enable_bloom:SetVisible(ui.world.world_enable:GetBool())
    ui.world.model_ambient:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.bloom:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())
    ui.world.exposure:SetVisible(ui.world.enable_bloom:GetBool() and ui.world.world_enable:GetBool())

    --antiaim
    ui.anti_aims.antiaim_helpers:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
    ui.anti_aims.animbreakers:SetVisible(ui.anti_aims.antiaim_enable:GetBool() and ui.anti_aims.antiaim_helpers:Get(2))

    --misc
    ui.misc.slowwalk_c:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.slowwalk_slider:SetVisible(ui.misc.slowwalk_c:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_direction:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.hitsound_volume:SetVisible(ui.misc.hitsound:GetBool() and ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.thirdperson_distance:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.thirdperson_anim:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.thirdperson:GetBool())
    ui.misc.clantag:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.autopeek:SetVisible(ui.misc.misc_enable:GetBool())
    ui.misc.color_override:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())
    ui.misc.quick_peek:SetVisible(ui.misc.misc_enable:GetBool() and ui.misc.autopeek:GetBool())

    --main
    ui.misc.menu_glow:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.glow_pulse:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.color_edit:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_glow:Get())
    ui.misc.menu_dim:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.dim_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_dim:Get())
    ui.misc.menu_blur:SetVisible(ui.misc.menu_customize:Get())
    ui.misc.blur_slider:SetVisible(ui.misc.menu_customize:Get() and ui.misc.menu_blur:Get())

    --aa buider
  
    local m = ui.anti_aims
    for i = 1,#_state do
        local selects = ui.anti_aims.states_selection:Get()+1
        local cswitch = m.custom[i].enable:Get()
        local show = selects == i and cswitch and ui.anti_aims.antiaim_enable:GetBool()
        ui.anti_aims.states_selection:SetVisible(ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].enable:SetVisible(selects == i and ui.anti_aims.antiaim_enable:GetBool())
        m.custom[i].extra_options:SetVisible(show)
        ui_set_visible(m.custom[i].yaw_mode,show)
        ---- {"Static","Period jitter \aC08A8AFF[Tick]","Period jitter \aC08A8AFF[Choke]","Period jitter \aC08A8AFF[Desync]"}
        ui_set_visible(m.custom[i].static_yaw,show and m.custom[i].yaw_mode:Get() == 0)
        ui_set_visible(m.custom[i].tick_yaw_left,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].tick_yaw_right,show and m.custom[i].yaw_mode:Get() == 1)
        ui_set_visible(m.custom[i].choke_yaw_left,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].choke_yaw_right,show and m.custom[i].yaw_mode:Get() == 2)
        ui_set_visible(m.custom[i].desync_yaw_left,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].desync_yaw_right,show and m.custom[i].yaw_mode:Get() == 3)
        ui_set_visible(m.custom[i].yaw_jitter,show)
        ui_set_visible(m.custom[i].yaw_jitter_mode,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree,show and m.custom[i].yaw_jitter:Get() ~= 0)
        ui_set_visible(m.custom[i].yaw_jitter_degree2,show and m.custom[i].yaw_jitter:Get() ~= 0 and m.custom[i].yaw_jitter_mode:Get() == 1)

        ui_set_visible(m.custom[i].self_bodyyaw_mode,show)
        ui_set_visible(m.custom[i].bodyyaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)   
        ui_set_visible(m.custom[i].bodyyaw_degree,show and m.custom[i].bodyyaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1 )
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].jitter_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_left,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].step_bodyyaw_degree_right,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_ticks,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)
        ui_set_visible(m.custom[i].body_yaw_step_value,show and m.custom[i].bodyyaw_mode:Get() == 3 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 1)

        ui_set_visible(m.custom[i].fake_yaw_mode,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].static_fakeyaw,show and m.custom[i].fake_yaw_mode:Get() == 0 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_left,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].jitter_fakeyaw_right,show and m.custom[i].fake_yaw_mode:Get() == 1 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_value,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_ticks,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
--
        ui_set_visible(m.custom[i].step_abs,show and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0)
        ui_set_visible(m.custom[i].step_fake_min,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].step_fake_max,show  and m.custom[i].fake_yaw_mode:Get() == 2 and m.custom[i].self_bodyyaw_mode:Get() ~= 0 and m.custom[i].fake_yaw_mode:Get() ~= 0 )
        ui_set_visible(m.custom[i].freestanding_bodyyaw,show and m.custom[i].self_bodyyaw_mode:Get() ~= 0)
    end

end
local time_to_ticks = function(t) return math.floor(0.5 + (t / GlobalVars.interval_per_tick)) end
local callbacks = {

    on_draw = function()
        if Cheat.IsMenuVisible() then
            ui_callbacks()
        end

        globals.local_player = EntityList.GetLocalPlayer()

        visuals.glowmenu()
      
        misc.clantag()
        autopeek:paint_function()
      if ui.visuals.visuals_enable:Get() then
        widgets.lua_panel:draw()
        widgets.indicators:draw()
        widgets.watermark:draw()
        widgets.keybinds:draw()
        widgets.spectators:draw()
        widgets.gamesense:draw()
        visuals.scope()
        visuals.hitmarker()
        visuals.circle_desync()
        logs:draw()

        local x, y = 5, 5
        if(ui.visuals.log_type:Get(2)) then
            for i, hitlog in ipairs(hitlogs) do
                    Render.Text(hitlog.text, Vector2.new(x+1, y+1), Color.RGBA(0, 0, 0, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)-105), 10, fonts.lucida_console)
                    Render.Text(hitlog.text, Vector2.new(x, y), Color.RGBA(255, 255, 255, math.floor((hitlog.time + 10 - GlobalVars.realtime)*500)), 10, fonts.lucida_console)
                y = y + 15
                if #hitlogs > 15 then table.remove(hitlogs,1) end
                if hitlog.time + 10 < GlobalVars.realtime then table.remove(hitlogs, i) end
            end
        end
      end

        world.sun_set()
        world.molotov()
        world.custom_skybox()
        world.effects()
        visuals.thirdperson()
    end,

    on_player_connect_full = function()
        t = {}
    end,

    on_prediction = function(cmd)
        anti_aims.avoid_backstab()
        anti_aims.exploit_teleport()
        anti_aims.disable_aa_warmup()
        rage.ragebot(cmd)
        anti_aims.antiaim_helpers()
        AntiAim.run_custom(cmd)
        anti_aims.edge_yaw()
        misc.slowwalk(cmd)
        rage.on_prediction()
        rage.dormant_aim(cmd)
        autopeek:autopeek_main(cmd)
    end,

    on_createmove = function(cmd)
        rage.baim()
    end,

    on_ragebot_shot = function(shot)
        if EntityList.GetLocalPlayer() == nil then return end
        total_hits = EntityList.GetLocalPlayer():GetProp('m_totalHitsOnServer')
        if total_hits == nil then return end
        miss_hitbox = missgroup_names[shot.hitgroup] or '?'
        self_choke = ClientState.m_choked_commands
        choke = time_to_ticks(GlobalVars.curtime - EntityList.GetClientEntity(shot.index):GetPlayer():GetProp('m_flSimulationTime')) + 1;
        if choke < 0 then
            choke = 0
        elseif choke > 14 then
            choke = 14
        end
        visuals.ragebot_shot(shot)
        autopeek.ragebot_shot(shot)
    end,

    on_pre_prediction = function(cmd)
        rage.hitchances()
    end,

    registered_shot = function(shot)
        rage.on_registered_shot(shot)
        visuals.registered_shot(shot)

        if ui.visuals.widgets:Get(6) and ui.visuals.log_type:Get(2) and shot.reason ~= 0 then
            local name = EntityList.GetPlayer(shot.target_index):GetName()
            local hitgroup_names = {
                [0] = "generic",
                [1] = "head",
                [2] = "chest",
                [3] = "stomach",
                [4] = "left arm",
                [5] = "right arm",
                [6] = "left leg",
                [7] = "right leg",
                [10] = "gear"
            }
            local miss_reasons = {"animation desync", "spread", "occlusion", "prediction error"}
            logs:add(string.format("Missed %s's %s due to %s", name, hitgroup_names[shot.wanted_hitgroup], miss_reasons[shot.reason]))
        end

    end,

    on_events = function(event)
        rage.reset_data(event)
        rage.resetter(event)
        visuals.events(event)
        indicators.bomb(event)
    end,
}

Cheat.RegisterCallback("draw", callbacks.on_draw)
Cheat.RegisterCallback("prediction", callbacks.on_prediction)
Cheat.RegisterCallback("createmove", callbacks.on_createmove)
Cheat.RegisterCallback("pre_prediction", callbacks.on_pre_prediction)
Cheat.RegisterCallback("registered_shot", callbacks.registered_shot)
Cheat.RegisterCallback("ragebot_shot", callbacks.on_ragebot_shot)
Cheat.RegisterCallback("events", callbacks.on_events)
logs:add("Welcome to psycho, " ..globals.username)
не рекомендую к использованию, много фпс жрет
 
Назад
Сверху Снизу