LUA скрипт [ nixware.cc / free ] sprays.lua

Начинающий
Статус
Оффлайн
Регистрация
11 Авг 2022
Сообщения
16
Реакции[?]
0
Поинты[?]
0
Код:
-- Tabs
local script_tabs = ui.add_combo_box("                sprays.lua", "script_tab_selection", { "[Ragebot]", "[Anti-Aim]", "[Visuals]", "[Misc]", "[UI]" }, 0)

--Rage_Bot
--Exploit
local exploit_doubletap = ui.add_key_bind("exploit doubletap", "exploit_doubletap", 0, 2)
local exploit_hide_shots = ui.add_key_bind("exploit hide shots", "exploit_hide_shots", 0, 2)

local dmg_override = ui.add_key_bind("dmg override", "dmg_override", 0, 1)
local dmg_override_value = ui.add_slider_int("dmg override value", "dmg_override_value", 1, 120, 1)

local hitscan_override = ui.add_key_bind('hitscan override', 'hitscan_override', 0, 1)
local hitscan_override_type = ui.add_combo_box("hitscan override type", "hitscan_override_type", { "head", "chest", "pelvis", "stomach", "legs", "foot" }, 0)

local safe_points_override = ui.add_key_bind("safe points override", "safe_points_override", 0, 1)
local safe_points_override_type = ui.add_combo_box("safe points override type", "safe_points_override_type", { "default", "prefer", "force" }, 0)

--Anti-Aim

require("bit32")
local ffi = require("ffi")
local pitch = ui.add_slider_int("Pitch", "pitch", -90, 90, 90)
local yaw_offset1 = ui.add_slider_int("Yaw offset", "yaw_offset1", -180, 180, 0)
local yaw_offset2 = ui.add_slider_int("Inverted yaw offset", "yaw_offset2", -180, 180, 0)
local jitter_offset2 = ui.add_slider_int("jitter offset", "jitter_offset2", 0, 50, 0)
local desync1 = ui.add_slider_int("Desync delta", "desync1", 0, 58, 58)
local desync2 = ui.add_slider_int("Inverted desync delta", "desync2", 0, 58, 58)
local lby_delta = ui.add_slider_float("LBY delta", "lby_delta", 0, 180, 180)
local lby_update_period = ui.add_slider_float("LBY update time", "lby_update_period", 0.055, 0.5, 0.15)
local inverter_bind = ui.add_key_bind("Inverter", "invert_side", 0, 2)
local max_fakelag = ui.add_check_box("Max FakeLag", "max_fakelag", false)
local jitter_desync = ui.add_multi_combo_box("Jitter desync conditions", "jitter_desync", { "[O]Standing", "[S]Walk", "[W]Run", "[A]Air", "[C]Crouch" }, { false, false, false, false, false })
local yaw_jitter = ui.add_multi_combo_box("Yaw jitter conditions", "yaw_jitter", { "[O]Standing", "[S]Walk", "[W]Run", "[A]Air", "[C]Crouch" }, { false, false, false, false, false })
--local no_micromoves = ui.add_check_box("Semi-LBY", "no_micromoves", false)
local left_manual = ui.add_key_bind("Manual left", "left_manual", 0, 1)
local right_manual = ui.add_key_bind("Manual right", "right_manual", 0, 1)
--local disable_manuals_if_unsafe = ui.add_check_box("Disable when unsafe", "disable_manuals_if_unsafe", true)

local m_vecVelocity = se.get_netvar("DT_BasePlayer", "m_vecVelocity[0]")
local netMoveType = se.get_netvar("DT_BaseEntity", "m_nRenderMode") + 1
local m_hActiveWeapon = se.get_netvar("DT_BaseCombatCharacter", "m_hActiveWeapon")
local m_fThrowTime = se.get_netvar("DT_BaseCSGrenade", "m_fThrowTime")
local m_flDuckAmount = se.get_netvar("DT_BasePlayer", "m_flDuckAmount")
local m_vecOrigin = se.get_netvar("DT_BaseEntity", "m_vecOrigin")
local m_hCarriedHostage = se.get_netvar("DT_CSPlayer", "m_hCarriedHostage")
local m_flFallVelocity = se.get_netvar("DT_BasePlayer", "m_flFallVelocity")

ffi.cdef[[
    struct WeaponInfo_t
    {
        char _0x0000[6];
        uint8_t classID;
        char _0x0007[13];
        __int32 max_clip;   
        char _0x0018[12];
        __int32 max_reserved_ammo;
        char _0x0028[96];
        char* hud_name;           
        char* weapon_name;       
        char _0x0090[60];
        __int32 type;           
    };
    struct Animstate_t
    {
        char pad[ 3 ];
        char m_bForceWeaponUpdate;
        char pad1[ 91 ];
        void* m_pBaseEntity;
        void* m_pActiveWeapon;
        void* m_pLastActiveWeapon;
        float m_flLastClientSideAnimationUpdateTime;
        int m_iLastClientSideAnimationUpdateFramecount;
        float m_flAnimUpdateDelta;
        float m_flEyeYaw;
        float m_flPitch;
        float m_flGoalFeetYaw;
    };
]]

local weapon_data_call = ffi.cast("int*(__thiscall*)(void*)", client.find_pattern("client.dll", "55 8B EC 81 EC ? ? ? ? 53 8B D9 56 57 8D 8B ? ? ? ? 85 C9 75 04"))

local function weapon_data(weapon)
    return ffi.cast("struct WeaponInfo_t*", weapon_data_call(ffi.cast("void*", weapon:get_address())))
end

local function get_animstate()
    local entity = entitylist.get_local_player()
    return ffi.cast("struct Animstate_t**", entity:get_address() + 0x9960)[0]
end

local function clamp_yaw(yaw)
    while yaw < -180.0 do yaw = yaw + 360.0 end
    while yaw > 180.0 do yaw = yaw - 360.0 end
    return yaw
end

local jitter_desync_inverted = false
local e_pressed = false
local jitter_side = 1
local freezetime = false
local manual_side = 0 -- 0 backwards, -1 left, 1 right
local lby_update_time = 0.0
local lby_force_choke = false

local function get_current_desync(mod_yaw)
    local animstate = get_animstate()
    return math.abs(mod_yaw - math.abs(clamp_yaw(engine.get_view_angles().yaw - animstate.m_flGoalFeetYaw))) -- CO3DAT3JIb JS REZOLVER
end

local function is_nade(lp)
    return weapon_data(entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon))).type == 0
end

local function is_throwing(lp)
    return entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon)):get_prop_float(m_fThrowTime) > 0.1
end

local function hasbit(x, p) return x % (p + p) >= p end

local function get_lby_breaker_time(fd)
    return fd and 0.4 or lby_update_period:get_value()
end

--0 for standing, 1 is walk, 2 is run, 3 air, 4 crouch
local function movement_type(lp, fd)
    local fv = lp:get_prop_float(m_flFallVelocity)
    if fv < -1 or fv > 1 then return 3 end
    if lp:get_prop_float(m_flDuckAmount) > 0.1 or fd then return 4 end
    if ui.get_key_bind("antihit_extra_slowwalk_bind"):is_active() then return 1 end
    if lp:get_prop_vector(m_vecVelocity):length() < 4 then return 0 end
    return 2
end

local function checks(cmd, lp)
    if freezetime then return true end
    local move_type = lp:get_prop_int(netMoveType)
    if move_type == 8 or move_type == 9 then return true end
    if is_nade(lp) and not is_throwing(lp) then return false end
    if is_nade(lp) and is_throwing(lp) then return true end
    if hasbit(cmd.buttons, bit32.lshift(1, 0)) then return true end
end

local function micro_move(cmd, lp)
    local move = 1.10
    if (lp:get_prop_float(m_flDuckAmount) > 0.1) then move = move * 3.0 end
    if cmd.command_number % 2 == 0 then move = -move end
    cmd.sidemove = cmd.sidemove + move
end

local function manual_aa()
    if client.is_key_clicked(left_manual:get_key()) then
        if manual_side == -1 then manual_side = 0 else manual_side = -1 end
    end
    if client.is_key_clicked(right_manual:get_key()) then
        if manual_side == 1 then manual_side = 0 else manual_side = 1 end
    end
end

local function break_lby(cmd, lby, lp, fd)
    if clientstate.get_choked_commands() >= 13 and fd then return 0 end
    if globalvars.get_current_time() >= lby_update_time then
        cmd.send_packet = false
        lby_force_choke = true
        lby_update_time = globalvars.get_current_time() + get_lby_breaker_time(fd)
        micro_move(cmd, lp)
        return lby
    end
    if lby_force_choke then
        lby_force_choke = false
        cmd.send_packet = false
    end
    return 0
end

local function main(cmd)
    local lp = entitylist.get_local_player()
    if not lp or not lp:is_alive() then return end
    if checks(cmd, lp) then return end
    cmd.viewangles.yaw = 180
    cmd.viewangles.pitch = 90
    local in_use = hasbit(cmd.buttons, bit32.lshift(1, 5))
    local is_standing = lp:get_prop_vector(m_vecVelocity):length() < 4

    --stop legit aa when planting, defusing and taking a hostage
    if in_use then
        local pos = lp:get_prop_vector(m_vecOrigin)
        local C4 = entitylist.get_entities_by_class("CPlantedC4")
        local hostages = entitylist.get_entities_by_class("CHostage")
        if  (#C4 ~= 0 and C4[1]:get_prop_vector(m_vecOrigin):dist_to(pos) <= 75) or
            (weapon_data(entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon))).classID == 207)
        then return end
        if #hostages > 0 then
            for i = 1, #hostages do
                if hostages[i]:get_prop_vector(m_vecOrigin):dist_to(pos) <= 75 and lp:get_prop_int(m_hCarriedHostage) == -1 then return end
            end
        end
    end

    --turning off fake lag
    --doing this shit because cmd.send_packet doesn't work :c
    ui.get_check_box("antihit_fakelag_enable"):set_value(false)
    ui.get_check_box("antihit_antiaim_enable"):set_value(false)
    local fakelag_limit = ui.get_slider_int("antihit_fakelag_limit")
    local fakelag = fakelag_limit:get_value() or 1
    if fakelag == 0 then fakelag_limit:set_value(1) end
    if max_fakelag:get_value() then fakelag = 15 end
    local exploit_is_active = ui.get_key_bind("rage_active_exploit_bind"):is_active()
    local fakeduck_is_active = ui.get_key_bind("antihit_extra_fakeduck_bind"):is_active()
    if not fakeduck_is_active and not exploit_is_active then
        cmd.send_packet = (fakelag <= clientstate.get_choked_commands())
    elseif exploit_is_active and not fakeduck_is_active then cmd.send_packet = (cmd.command_number % 2 == 0) end

    --stop aa on "USE" for one tick to make picking up weapons easier
    local first_time_e_pressed = false
    if e_pressed then cmd.buttons = bit32.band(cmd.buttons, -33) end
    if e_pressed ~= in_use then first_time_e_pressed = true end
    e_pressed = in_use
    
    local inverter = inverter_bind:is_active()
    local viewangles = engine.get_view_angles()
    local yaw = viewangles.yaw - 180 + (inverter and yaw_offset2:get_value() or yaw_offset1:get_value())
    local movement = movement_type(lp, fakeduck_is_active)

    --jitter
    if yaw_jitter:get_value(movement) then
        yaw = yaw + (inverter and jitter_offset2:get_value() or jitter_offset1:get_value() * -1) * jitter_side
    end

    --jitter inverter
    if jitter_desync:get_value(movement) and not cmd.send_packet then
        jitter_desync_inverted = not jitter_desync_inverted
        inverter = jitter_desync_inverted
    end

    --flips your yaw 180 degrees to look forward when you press E, and flip inverter to make your real appear at the same place
    if in_use then
        yaw = yaw + 180
        inverter = not inverter
    end

    --changing jitter side to make jitter... jitter!
    --btw there's 300iq move that syncs your jitter with desync jitter, so your aa will never be fucked up :D
    if not cmd.send_packet then
        if jitter_desync:get_value(movement) then jitter_side = (inverter and 1 or -1)
        else jitter_side = jitter_side * -1 end
    end

    --calculating delta
    local lby = lby_delta:get_value()
    local delta = (inverter and desync2:get_value() or desync1:get_value() * -1)
    if ((not is_standing and lby ~= 0) or lby == 0) and get_current_desync(viewangles.yaw - yaw) < math.abs(delta) then
        delta = (delta / math.abs(delta)) * 120
    end

    -- do LBY or micromove if LBY is off
    if is_standing then
        if lby ~= 0 then
            yaw = yaw + break_lby(cmd, lby, lp, fakeduck_is_active)
            delta = delta * 2
        else micro_move(cmd, lp) end
    end

    --animation desyncing process
    if not cmd.send_packet and not first_time_e_pressed then yaw = yaw - delta end

    --manual aa bind logic and manuals itself
    manual_aa()

    --i left it for another time xd

    --if disable_manuals_if_unsafe:get_value() then
    --    local pos = lp:get_player_hitbox_pos(0) --local's head position
    --    local players = entitylist.get_players(0)
    --    for i = 1, #players do
    --        local player = players[i]
    --        if not player:is_alive() or player:is_dormant() then goto skip end
    --        local attacker_pos = player:get_player_hitbox_pos(4) --we don't need big accuracy with positions to hit sideways head
    --        local trace = trace.line(0, 65536, pos, attacker_pos)
    --        print(tostring(trace.fraction .. " " .. trace.hitbox .. " " .. trace.hit_entity_index))
    --        ::skip::
    --    end
    --end
    if not in_use then yaw = yaw + (90 * manual_side) end

    --send yaw and pitch to server
    cmd.viewangles.yaw = yaw
    cmd.viewangles.pitch = pitch:get_value()

    --sets our pitch to natural if pitch slider is on 0
    if in_use or pitch:get_value() == 0 then cmd.viewangles.pitch = viewangles.pitch end
end

client.register_callback("create_move", main)
client.register_callback("round_prestart", function()
    freezetime = true
    lby_update_time = get_lby_breaker_time(ui.get_key_bind("antihit_extra_fakeduck_bind"):is_active())
    manual_side = 0
end)
client.register_callback("round_freeze_end", function() freezetime = false end)

--Visuals
--Croshair
local m_bIsScoped = se.get_netvar("DT_CSPlayer", "m_bIsScoped")
local Scope = false
local offset = ui.add_slider_int("Offset Scope", "offset_scope", 0, 500, 10)
local length = ui.add_slider_int("Length Scope", "length_scope", 0, 1000, 60)
local anim_speed = ui.add_slider_int("Animation speed", "anim_speed_scope", 1, 30, 15)
local animoffset = ui.add_check_box("Animate offset", "animoffset_scope", false)
local col_1 = ui.add_color_edit("First color", "scope_color1", true, color_t.new(255, 255, 255, 255))
local col_2 = ui.add_color_edit("Second color", "scope_color2", true, color_t.new(255, 255, 255, 10))
local anim_num = 0
local lerp = function(a, b, t)
    return a + (b - a) * t
end
client.register_callback("frame_stage_notify", function(s)
    if s ~= 5 then return end
    local local_player = entitylist:get_local_player()
    local bIsScoped = local_player:get_prop_bool(se.get_netvar("DT_CSPlayer", "m_bIsScoped"))
    local_player:set_prop_int(m_bIsScoped, bIsScoped and 1 or 0)
    Scope = bIsScoped and true or false
    if local_player:get_prop_int(m_bIsScoped) then
        local_player:set_prop_int(m_bIsScoped, 0)
    end
end)
client.register_callback("paint", function()
    local local_player = entitylist:get_local_player()
    local screen = engine.get_screen_size()
    local start_x, start_y = screen.x /2, screen.y /2
    local offsett = offset:get_value()
    local lengthh = length:get_value() * anim_num
    local width = 1
    local col1 = col_1:get_value() col1.a = col1.a * anim_num
    local col2 = col_2:get_value() col2.a = col2.a * anim_num
    local animcond = Scope and local_player:is_alive()
    anim_num = lerp(anim_num, animcond and 1 or 0, anim_speed:get_value() * globalvars.get_frame_time())
    offsett = animoffset:get_value() and offsett * anim_num or offsett
    --left
    renderer.rect_filled_fade(vec2_t.new(start_x - offsett + 1, start_y), vec2_t.new(start_x - offsett - lengthh + 1, start_y + width), col1, col2, col2, col1)
    --right
    renderer.rect_filled_fade(vec2_t.new(start_x + offsett, start_y), vec2_t.new(start_x + offsett + lengthh, start_y + width), col1, col2, col2, col1)
    --down
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y + offsett), vec2_t.new(start_x + width, start_y + offsett + lengthh), col1, col1, col2, col2)
    --up
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y - offsett + 1), vec2_t.new(start_x + width, start_y - offsett - lengthh + 1), col1, col1, col2, col2)
end)

--Thisperson
local distation = ui.add_slider_int('Thirdperson Ditstation', 'tppdist', 30, 200, 150)
local tpp = se.get_convar('cam_idealdist')
client.register_callback('create_move', function()
tpp:set_int(distation:get_value())
end)

--Mask Changer

local ffi = require("ffi")
local bit = require("bit")
 
local __thiscall = function(func, this)
    return function(...) return func(this, ...) end
end
local interface_ptr = ffi.typeof("void***")


local vtable_bind = function(module, interface, index, typedef)
    local addr = ffi.cast("void***", se.create_interface(module, interface)) or error(interface .. " was not found")
    return __thiscall(ffi.cast(typedef, addr[0][index]), addr)
end


local vtable_entry = function(instance, i, ct)
    return ffi.cast(ct, ffi.cast(interface_ptr, instance)[0][i])
end


local vtable_thunk = function(i, ct)
    local t = ffi.typeof(ct)
    return function(instance, ...)
        return vtable_entry(instance, i, t)(instance, ...)
    end
end



local get_class_name = vtable_thunk(143, "const char*(__thiscall*)(void*)")

local set_model_index = vtable_thunk(75, "void(__thiscall*)(void*,int)")


local get_client_entity_from_handle = vtable_bind("client.dll", "VClientEntityList003", 4, "void*(__thiscall*)(void*,void*)")

local get_model_index = vtable_bind("engine.dll", "VModelInfoClient004", 2, "int(__thiscall*)(void*, const char*)")


local rawientitylist = se.create_interface('client.dll', 'VClientEntityList003') or error('VClientEntityList003 was not found', 2)
local ientitylist = ffi.cast(interface_ptr, rawientitylist) or error('rawientitylist is nil', 2)

local get_client_entity = ffi.cast('void*(__thiscall*)(void*, int)', ientitylist[0][3]) or error('get_client_entity was not found', 2)


local client_string_table_container = ffi.cast(interface_ptr, se.create_interface('engine.dll', 'VEngineClientStringTable001')) or error('VEngineClientStringTable001 was not found', 2)
local find_table = vtable_thunk(3, 'void*(__thiscall*)(void*, const char*)')


local model_info = ffi.cast(interface_ptr, se.create_interface('engine.dll', 'VModelInfoClient004')) or error('VModelInfoClient004 wasnt found', 2)


ffi.cdef [[
    typedef void(__thiscall* find_or_load_model_t)(void*, const char*);
]]


local add_string = vtable_thunk(8, "int*(__thiscall*)(void*, bool, const char*, int length, const void* userdata)")

local find_or_load_model = ffi.cast("find_or_load_model_t", model_info[0][43]) -- vtable thunk crashes (?)

local function _precache(szModelName)
    if szModelName == "" then return end -- don't precache empty strings (crash)
    if szModelName == nil then return end
    szModelName = string.gsub(szModelName, [[\]], [[/]])

    local m_pModelPrecacheTable = find_table(client_string_table_container, "modelprecache")
    if m_pModelPrecacheTable ~= nil then
        find_or_load_model(model_info, szModelName)
        add_string(m_pModelPrecacheTable, false, szModelName, -1, nil)
    end
end


local changer = {}


changer.list_names = {'None', 'Dallas', 'Battle Mask', 'Evil Clown', 'Anaglyph', 'Boar', 'Bunny', 'Bunny Gold', 'Chains', 'Chicken', 'Devil Plastic', 'Hoxton', 'Pumpkin', 'Samurai', 'Sheep Bloody', 'Sheep Gold', 'Sheep Model', 'Skull', 'Template', 'Wolf', 'Doll',}
changer.models = {'', 'models/player/holiday/facemasks/facemask_dallas.mdl', 'models/player/holiday/facemasks/facemask_battlemask.mdl', 'models/player/holiday/facemasks/evil_clown.mdl', 'models/player/holiday/facemasks/facemask_anaglyph.mdl', 'models/player/holiday/facemasks/facemask_boar.mdl', 'models/player/holiday/facemasks/facemask_bunny.mdl', 'models/player/holiday/facemasks/facemask_bunny_gold.mdl', 'models/player/holiday/facemasks/facemask_chains.mdl', 'models/player/holiday/facemasks/facemask_chicken.mdl', 'models/player/holiday/facemasks/facemask_devil_plastic.mdl', 'models/player/holiday/facemasks/facemask_hoxton.mdl', 'models/player/holiday/facemasks/facemask_pumpkin.mdl', 'models/player/holiday/facemasks/facemask_samurai.mdl', 'models/player/holiday/facemasks/facemask_sheep_bloody.mdl', 'models/player/holiday/facemasks/facemask_sheep_gold.mdl', 'models/player/holiday/facemasks/facemask_sheep_model.mdl', 'models/player/holiday/facemasks/facemask_skull.mdl', 'models/player/holiday/facemasks/facemask_template.mdl', 'models/player/holiday/facemasks/facemask_wolf.mdl', 'models/player/holiday/facemasks/porcelain_doll.mdl',}

changer.last_model = 0
changer.model_index = -1
changer.enabled = false


local combobox_masks = ui.add_combo_box("Masc Changer", "lua_mask", changer.list_names, 0)


local function precache(modelPath)
    if modelPath == "" then return -1 end -- don't crash.
    local local_model_index = get_model_index(modelPath)
    if local_model_index == -1 then
        _precache(modelPath)
    end
    return get_model_index(modelPath)
end

local function on_paint()
    if not engine.is_in_game() then
        changer.last_model = 0
        return
    end
    if changer.last_model ~= combobox_masks:get_value() then
        changer.last_model = combobox_masks:get_value()
        if changer.last_model == 0 then
            changer.enabled = false
        else
            changer.enabled = true
            changer.model_index = precache(changer.models[changer.last_model + 1])
        end
    end
end


local function get_player_address(lp)
    return get_client_entity(ientitylist, lp:get_index())
end


local function on_setup_command(cmd)
    if changer.model_index == -1 then return precache(changer.models[changer.last_model + 1]) end

    local local_player = entitylist.get_local_player()
    if changer.enabled then
        local lp_addr = ffi.cast("intptr_t*", get_player_address(local_player))
        local m_AddonModelsHead = ffi.cast("intptr_t*", lp_addr + 0x462F) -- E8 ? ? ? ? A1 ? ? ? ? 8B CE 8B 40 10
        local i, next_model = m_AddonModelsHead[0], -1

        while i ~= -1 do
            next_model = ffi.cast("intptr_t*", lp_addr + 0x462C)[0] + 0x18 * i -- this is the pModel (CAddonModel) afaik
            i = ffi.cast("intptr_t*", next_model + 0x14)[0]
            local m_pEnt = ffi.cast("intptr_t**", next_model)[0] -- CHandle<C_BaseAnimating> m_hEnt -> Get()
            local m_iAddon = ffi.cast("intptr_t*", next_model + 0x4)[0]
            if tonumber(m_iAddon) == 16 then -- face mask addon bits knife = 10
                local entity = get_client_entity_from_handle(m_pEnt)
                set_model_index(entity, changer.model_index)
            end
        end
    end
end


local m_iAddonBits = se.get_netvar("DT_CSPlayer", "m_iAddonBits")

client.register_callback("create_move", function()
    local local_player = entitylist.get_local_player()
    if local_player == nil then return end
    if changer.enabled then
        if bit.band(local_player:get_prop_int(m_iAddonBits), 0x10000) ~= 0x10000 then
            local_player:set_prop_int(m_iAddonBits, 0x10000 + local_player:get_prop_int(m_iAddonBits))
        end
    else
        if bit.band(local_player:get_prop_int(m_iAddonBits), 0x10000) == 0x10000 then
            local_player:set_prop_int(m_iAddonBits, local_player:get_prop_int(m_iAddonBits) - 0x10000)
        end
    end
end)

client.register_callback('paint', on_paint)
client.register_callback("create_move", on_setup_command)


--clanteg

local toggle_clantag = ui.add_check_box("Clantag", "toggle_clantag", false)

local timing = 3
local count = 0
local clantag_animation =

{
"  ",
" s ",
" sp ",
" spr ",
" spra ",
" spray ",
" sprays ",
" sprays. ",
" sprays.l ",
" sprays.lu ",
" sprays.lua ",
" sprays.lua ",
" sprays.lu ",
" sprays.l ",
" sprays. ",
" sprays ",
" spray ",
" spra ",
" spr ",
" sp ",
" s ",
"  ",
}

client.register_callback("create_move", function()
    local players = entitylist.get_players(0)
end)
    

client.register_callback("paint", function()
    if not engine.is_connected() then return end
    if not toggle_clantag:get_value() then return end
    if timing < globalvars.get_tick_count() then
        count = count + 1

        if count > 60 then
            count = 0
        end

        se.set_clantag(clantag_animation[count])

        timing = globalvars.get_tick_count() + 30
    end
end)


local ffi = require 'ffi'

ffi.cdef[[
    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
]]

local ENTITY_LIST_POINTER = ffi.cast("void***", se.create_interface("client.dll", "VClientEntityList003")) or error("Failed to find VClientEntityList003!")
local GET_CLIENT_ENTITY_FN = ffi.cast("GetClientEntity_4242425_t", ENTITY_LIST_POINTER[0][3])

local ffi_helper = {
    get_animstate_offset = function()
        return 14612
    end,

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

local function on_create_move(cmd)
    local localplayer = entitylist.get_local_player()
    if not localplayer then return end
    ffi.cast("float*", ffi_helper.get_entity_address(localplayer:get_index()) + 10100)[0] = 0
end

local function leg_breaker(cmd) 
    if switch then
        switch = false
    else
         switch = true
    end

    if switch then
        local antiaim_active_movement_type = ui.get_combo_box("antihit_extra_leg_movement"):set_value(1)
    else
        local antiaim_active_movement_type = ui.get_combo_box("antihit_extra_leg_movement"):set_value(2)
    end
end

client.register_callback("create_move", on_create_move)
client.register_callback("create_move", leg_breaker)

--Trashtalk
local messagesRU = {
    "Супер изи для sprays.technologies",
    "Легчяйшая для sprays.lua",
    "Простейший для text.lua",
    "Тут могла быть ваша реклама",
    "Легко для sprays.lua",
    "Изи для sprays.lua",
    "Owned by kilzef.lua",
    "Падаещ от sprays.lua",
    "Лёкий подсочник для sprayscord",
}

client.notify("Sprays.lua Load")

local trashtalk_type = ui.add_combo_box("kil say", "trashtalk_type", { "Off", "sprays.lua" }, 0)


client.register_callback("player_death", function(event)
    
    local attacker_index = engine.get_player_for_user_id(event:get_int("attacker",0))
    local died_index = engine.get_player_for_user_id(event:get_int("userid",1))
    local me = engine.get_local_player()
    
    math.randomseed(os.clock()*100000000000)

        if attacker_index == me and died_index ~= me then     
            if trashtalk_type:get_value() == 1 then   
                engine.execute_client_cmd("say " .. tostring(messagesRU[math.random(0, #messagesRU)]))
            elseif trashtalk_type:get_value() == 2 then
                engine.execute_client_cmd("say " .. tostring(messagesENG[math.random(0, #messagesENG)]))
            elseif trashtalk_type:get_value() == 3 then
                engine.execute_client_cmd("say " .. tostring(trashfacts[math.random(0, #trashfacts)]))
            end
        end
end)

--Indicator Keybinds

--Under Cross

--adding ui elements
local x_offset = ui.add_slider_int("X offset", "indicators_x_offset", -100, 100, 0)
local y_offset = ui.add_slider_int("Y offset", "indicators_y_offset", -100, 100, 0)
local center = ui.add_check_box("Center Under Cross", "indicators_cetner", false)

--function for fast indicator adding
local function indicator(var, name, color, logic)
    logic = logic or nil
    return {
        ["var"] = var,
        ["name"] = name,
        ["color"] = color,
        ["alpha"] = 0,
        ["logic"] = logic
    }
end

--some shit
local function clamp(v, min, max) return math.min(math.max(v, min), max) end
local bind = ui.get_key_bind
local active_exploit, active_exploit_bind = ui.get_combo_box("rage_active_exploit"), ui.get_key_bind("rage_active_exploit_bind")

--defining array with indicators
local indicators = {
    indicator(nil, " sprays.lua ", color_t.new(400, 175, 255, 255), function() return true end),
    indicator(nil, "DOUBLETAP", color_t.new(255, 255, 255, 255), function()
        return (active_exploit:get_value() == 2 and active_exploit_bind:is_active())
    end),
    indicator(nil, "HIDESHOT", color_t.new(255, 255, 255, 255), function()
        return (active_exploit:get_value() == 1 and active_exploit_bind:is_active())
    end),
    indicator(bind("antihit_extra_fakeduck_bind"), "FAKEDUCK", color_t.new(255, 255, 255, 255)),
    indicator(bind("antihit_extra_autopeek_bind"), "QUICKPEEK", color_t.new(255, 255, 255, 255)), 
}

local margin, speed, size = 8, 0.06, 10
local font = renderer.setup_font("C:/Windows/fonts/smallest pixel-7.ttf", size, 10)
client.register_callback("paint", function ()
    local lp = entitylist.get_local_player()
    if not lp:is_alive() then return end
    local speed = speed * globalvars.get_absolute_frametime() * 100
    local screen = engine.get_screen_size()
    local centering = center:get_value() and 1 or 0
    local cx = screen.x / 2 + x_offset:get_value()
    local cy = screen.y / 2
    local y = cy + 9 + y_offset:get_value()
    for i = 1, #indicators do
        local bind = indicators[i]
        local active = (bind.var ~= nil and bind.var:is_active()) or (bind.var == nil and bind.logic())
        bind.alpha = clamp(bind.alpha + (active and speed or (speed * -1)), 0, 1)
        if bind.alpha == 0 then goto skip end
        local text_size = renderer.get_text_size(font, size, bind.name)
        local bx, by, col = cx - ((text_size.x / 2) * centering), y - margin + (bind.alpha * margin), bind.color
        col.a = bind.alpha * 255
        renderer.text(bind.name, font, vec2_t.new(bx, by + 1), size, color_t.new(0, 0, 0, col.a / 1.33))
        renderer.text(bind.name, font, vec2_t.new(bx, by), size, col)
        y = y + (bind.alpha * margin)
        ::skip::
    end
end)

--UI UNDICATORS
local screen_ind = ui.add_multi_combo_box("Screen indicators", "screen_ind", { "Keybinds", "Watermark" }, { false, false })
local watermarkname = ui.add_text_input("Custom watermark name", "watermarkname", "Sprays.lua")
local watermarkusername = ui.add_text_input("Custom watermark username", "watermarkusername", "")
local animation_type = ui.add_combo_box("Animation type", "animation_type", { "Skeet", "Neverlose" }, 0)
local auto_resize_width = ui.add_check_box("Auto resize width", "auto_resize_width", false)
local style_line = ui.add_combo_box("Style line", "style_line", { "Static", "Fade", "Reverse fade", "Gradient", "Skeet", "Chroma" }, 0)
local chroma_dir = ui.add_combo_box("Chroma direction", "chroma_dir", { "Left", "Right", "Static" }, 0)
local color_line = ui.add_color_edit("Color line", "color_line", true, color_t.new(52, 164, 235, 255))
local keybinds_x = ui.add_slider_int("keybind_x", "keybinds_x", 0, engine.get_screen_size().x, 345)
local keybinds_y = ui.add_slider_int("keybind_y", "keybinds_y", 0, engine.get_screen_size().y, 215)

local verdana = renderer.setup_font("C:/windows/fonts/verdana.ttf", 12, 0)
local types = { "always", "hold", "toggle", "disabled" }

local function hsv2rgb(h, s, v, a)
    local r, g, b

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

    i = i % 6

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

    return color_t.new(r * 255, g * 255, b * 255, a * 255)
end
function math.lerp(a, b, t) return a + (b - a) * t end
local function drag(x, y, width, height, xmenu, ymenu, item)
    local cursor = renderer.get_cursor_pos()
    if (cursor.x >= x) and (cursor.x <= x + width) and (cursor.y >= y) and (cursor.y <= y + height) then
        if client.is_key_pressed(1) and item[1] == 0 then
            item[1] = 1
            item[2] = x - cursor.x
            item[3] = y - cursor.y
        end
    end
    if not client.is_key_pressed(1) then item[1] = 0 end
    if item[1] == 1 and ui.is_visible() then
        xmenu:set_value(cursor.x + item[2])
        ymenu:set_value(cursor.y + item[3])
    end
end
local function filledbox(x, y, w, h, al)
    local rgb = hsv2rgb(globalvars.get_real_time() / 4, 0.9, 1, 1)
    local chromd = chroma_dir:get_value()
    local col = color_line:get_value()
    local stl = style_line:get_value()

    if stl ~= 4 then
    renderer.rect_filled(vec2_t.new(x, y), vec2_t.new(x + w, y + h), color_t.new(15, 15, 15, col.a * al))
    else
    renderer.rect_filled(vec2_t.new(x, y - 2), vec2_t.new(x + w, y + h), color_t.new(30, 30, 30, col.a * al))
    renderer.rect_filled_fade(vec2_t.new(x + 1, y - 1), vec2_t.new(x + w / 2, y), color_t.new(0, 213, 255, 255 * al), color_t.new(204, 18, 204, 255 * al), color_t.new(204, 18, 204, 255 * al), color_t.new(0, 213, 255, 255 * al))
    renderer.rect_filled_fade(vec2_t.new(x + (w / 2), y - 1), vec2_t.new(x + w - 1, y), color_t.new(204, 18, 204, 255 * al), color_t.new(255, 250, 0, 255 * al), color_t.new(255, 250, 0, 255 * al), color_t.new(204, 18, 204, 255 * al))
    end
    
    gradient_color = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(0, 0, 0, 255 * al) or stl == 2 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 3 and color_t.new(0, 213, 255, 255 * al) or stl == 5 and color_t.new(chromd==1 and rgb.g or rgb.r, chromd==1 and rgb.b or rgb.g, chromd ==1 and rgb.g or rgb.b, 255 * al) or color_t.new(0, 0, 0, 0)
    gradient_color1 = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 2 and color_t.new(0, 0, 0, 255 * al) or stl == 3 and color_t.new(204, 18, 204, 255 * al) or stl == 5 and color_t.new(chromd==2 and rgb.r or rgb.b, chromd==2 and rgb.g or rgb.r, chromd==2 and rgb.b or rgb.g, 255 * al) or color_t.new(0, 0, 0, 0)
    gradient_color2 = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(0, 0, 0, 255 * al) or stl == 2 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 3 and color_t.new(255, 250, 0, 255 * al) or stl == 5 and color_t.new(chromd==0 and rgb.g or rgb.r, chromd==0 and rgb.b or rgb.g, chromd ==0 and rgb.g or rgb.b, 255 * al) or color_t.new(0, 0, 0, 0)

    if stl ~= 4 then
        renderer.rect_filled_fade(vec2_t.new(x, y - 2), vec2_t.new(x + w / 2, y), gradient_color, gradient_color1, gradient_color1, gradient_color)
        renderer.rect_filled_fade(vec2_t.new(x + (w / 2), y - 2), vec2_t.new(x + w, y), gradient_color1, gradient_color2, gradient_color2, gradient_color1)
    end
end
--indicators
local item = { 0, 0, 0 }
local animwidth = 0;
local alpha = { 0 }
local bind = {
["Double tap"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 2, add = 0, multiply = 0},
["Hide shots"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 1, add = 0, multiply = 0},
["On shot anti aim"] = {reference = ui.get_key_bind("antihit_antiaim_flip_bind"), exploit = 0, add = 0, multiply = 0},
["Auto peek"] = {reference = ui.get_key_bind("antihit_extra_autopeek_bind"), exploit = 0, add = 0, multiply = 0},
["Slow walk"] = {reference = ui.get_key_bind("antihit_extra_slowwalk_bind"), exploit = 0, add = 0, multiply = 0},
["Fake duck"] = {reference = ui.get_key_bind("antihit_extra_fakeduck_bind"), exploit = 0, add = 0, multiply = 0},
["Jump bug"] = {reference = ui.get_key_bind("misc_jump_bug_bind"), exploit = 0, add = 0, multiply = 0},
["Edge jump"] = {reference = ui.get_key_bind("misc_edge_jump_bind"), exploit = 0, add = 0, multiply = 0},
--["Название бинда"] = {reference = получение бинда, exploit = 0 (это не трогать), add = 0 (это не трогать), multiply = 0 (это не трогать)},
};
client.register_callback("paint", function()
    --ui visible
    local screen = screen_ind:get_value(1) or screen_ind:get_value(0)
    watermarkname:set_visible(screen_ind:get_value(1))
    watermarkusername:set_visible(screen_ind:get_value(1))
    animation_type:set_visible(screen_ind:get_value(0))
    auto_resize_width:set_visible(screen_ind:get_value(0))
    style_line:set_visible(screen) chroma_dir:set_visible(style_line:get_value() == 5) color_line:set_visible(screen)
    keybinds_x:set_visible(false) keybinds_y:set_visible(false)
    --timer
    local function watermark()
    --watermark
        if screen_ind:get_value(1) then
            local wtname = ""
            local user = ""
            if watermarkname:get_value() ~= "" then wtname = tostring(watermarkname:get_value()) else wtname = "nixware.cc" end
            if watermarkusername:get_value() ~= "" then user = tostring(watermarkusername:get_value()) else user = client.get_username() end
            local username = client.get_username()
            local ping = se.get_latency()
            local tickcount = 1 / globalvars.get_interval_per_tick()
            local text = ""
            if engine.is_connected() then
            text = wtname .. " | " .. user .. " | delay: " .. ping .. "ms | " .. tickcount .. "tick | " .. os.date("%X") else
            text = wtname .. " | " .. user .. " | " .. os.date("%X") end
            local screen = engine.get_screen_size()
            local w = renderer.get_text_size(verdana, 12, text).x + 10
            local h = 17
            local x = screen.x - w - 10
            filledbox(x, 8, w, h, 1)
            renderer.text(text, verdana, vec2_t.new(x + 6, 10 + 1), 12, color_t.new(0, 0, 0, 255))
            renderer.text(text, verdana, vec2_t.new(x + 5, 10), 12, color_t.new(255, 255, 255, 255))
        end
    end
    --keybinds
    local function keybinds()
        if screen_ind:get_value(0) and engine.is_connected() then
            local pos = {x = keybinds_x:get_value(), y = keybinds_y:get_value()}
            local alphak, keybinds = {}, {}
            local width, maxwidth = 25, 0;
            local height = 17;
            local bind_y = height + 4
            
            for i,v in pairs(bind) do
                local exploits = ui.get_combo_box("rage_active_exploit"):get_value(); v.add = math.lerp(v.add, v.reference:is_active() and 255 or 0, 0.1); v.multiply = v.add > 4 and 1 or 0;
                if v.add > 4 then if v.exploit == 0 then table.insert(keybinds, i) end; if v.exploit ~= 0 and exploits == v.exploit then table.insert(keybinds, i) end; end;
                if v.exploit == 0 and v.reference:is_active() then table.insert(alphak, i) end; if v.exploit ~= 0 and exploits == v.exploit and v.reference:is_active() then table.insert(alphak, i) end;
            end
            if #alphak ~= 0 or ui.is_visible() then alpha[1] = math.lerp(alpha[1], 255, 0.1) end; if #alphak == 0 and not ui.is_visible() then alpha[1] = math.lerp(alpha[1], 0, 0.1) end       
            for k,f in pairs(keybinds) do if renderer.get_text_size(verdana, 12, f .. "["..types[bind[f].reference:get_type() + 1].."]").x > maxwidth then maxwidth = renderer.get_text_size(verdana, 12, f .. "["..types[bind[f].reference:get_type() + 1].."]").x; end; end
            if maxwidth == 0 then maxwidth = 50 end; width = width + maxwidth; if width < 130 then width = 130 end if animwidth == 0 then animwidth = width end; animwidth = math.lerp(animwidth, width, 0.1)
            w = auto_resize_width:get_value() and (animation_type:get_value() == 1 and animwidth or width) or 150
            for k,f in pairs(keybinds) do 
                local v = bind[f]; bind_y = bind_y + (animation_type:get_value() == 1 and 20 * (v.add / 255) or 20 * v.multiply); plus = bind_y - (animation_type:get_value() == 1 and 20 * (v.add / 255) or 20 * v.multiply);
                renderer.text(f, verdana, vec2_t.new(pos.x + 5, pos.y + plus + 1), 12, color_t.new(0, 0, 0, 255 * (v.add / 255)))
                renderer.text(f, verdana, vec2_t.new(pos.x + 4, pos.y + plus), 12, color_t.new(255, 255, 255, 255 * (v.add / 255)))
                renderer.text("["..types[v.reference:get_type() + 1].."]", verdana, vec2_t.new(pos.x + w - renderer.get_text_size(verdana, 12, "["..types[v.reference:get_type() + 1].."]").x - 3, pos.y + plus + 1), 12, color_t.new(0, 0, 0, 255 * (v.add / 255)))
                renderer.text("["..types[v.reference:get_type() + 1].."]", verdana, vec2_t.new(pos.x + w - renderer.get_text_size(verdana, 12, "["..types[v.reference:get_type() + 1].."]").x - 4, pos.y + plus), 12, color_t.new(255, 255, 255, 255 * (v.add / 255)))
            end
            if alpha[1] > 1 then
                filledbox(pos.x, pos.y, w, height, (alpha[1] / 255))
                renderer.text("keybinds", verdana, vec2_t.new(pos.x + (w /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2) + 1, pos.y + 3), 12, color_t.new(0, 0, 0, 255 * (alpha[1] / 255)))
                renderer.text("keybinds", verdana, vec2_t.new(pos.x + (w /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2), pos.y + 2), 12, color_t.new(255, 255, 255, 255 * (alpha[1] / 255)))
                drag(pos.x, pos.y, w, height + 2, keybinds_x, keybinds_y, item)
            end
        end
    end
    watermark(); keybinds();
end)








function on_paint()
    -- Script tabs
    if script_tabs:get_value() ~= 0 then -- Ragebot tab
    exploit_doubletap:set_visible(false)
    exploit_hide_shots:set_visible(false)
    dmg_override :set_visible(false)
    dmg_override_value:set_visible(false)
    hitscan_override:set_visible(false)
    hitscan_override_type:set_visible(false)
    safe_points_override:set_visible(false)
    safe_points_override_type:set_visible(false)
    else
    exploit_doubletap:set_visible(true)
    exploit_hide_shots:set_visible(true)
    dmg_override :set_visible(true)
    dmg_override_value:set_visible(true)
    hitscan_override:set_visible(true)
    hitscan_override_type:set_visible(true)
    safe_points_override:set_visible(true)
    safe_points_override_type:set_visible(true)
    end

    if script_tabs:get_value() ~= 1 then -- Anti-Aim tab
    pitch:set_visible(false)
    yaw_offset1:set_visible(false)
    yaw_offset2:set_visible(false)
    jitter_offset2:set_visible(false)
    desync1:set_visible(false)
    desync2:set_visible(false)
    lby_delta:set_visible(false)
    lby_update_period:set_visible(false)
    inverter_bind:set_visible(false)
    max_fakelag:set_visible(false)
    jitter_desync:set_visible(false)
    yaw_jitter:set_visible(false)
    right_manual:set_visible(false)
    left_manual:set_visible(false)
    else
    pitch:set_visible(true)
    yaw_offset1:set_visible(true)
    yaw_offset2:set_visible(true)
    jitter_offset2:set_visible(true)
    desync1:set_visible(true)
    desync2:set_visible(true)
    lby_delta:set_visible(true)
    lby_update_period:set_visible(true)
    inverter_bind:set_visible(true)
    max_fakelag:set_visible(true)
    jitter_desync:set_visible(true)
    yaw_jitter:set_visible(true)
    right_manual:set_visible(true)
    left_manual:set_visible(true)
    end

    if script_tabs:get_value() ~= 2 then -- Visuals tab
    offset:set_visible(false)
    length:set_visible(false)
    anim_speed:set_visible(false)
    animoffset:set_visible(false)
    col_1:set_visible(false)
    col_2:set_visible(false)
    distation:set_visible(false)
    combobox_masks:set_visible(false)
    x_offset:set_visible(false)
    y_offset:set_visible(false) 
    center:set_visible(false)

    else
    offset:set_visible(true)
    length:set_visible(true)
    anim_speed:set_visible(true)
    animoffset:set_visible(true)
    col_1:set_visible(true)
    col_2:set_visible(true)
    distation:set_visible(true)
    combobox_masks:set_visible(true)
    x_offset:set_visible(true)
    y_offset:set_visible(true)
    center:set_visible(true)
    end

    if script_tabs:get_value() ~= 3 then -- Misc tab
    toggle_clantag:set_visible(false)
    trashtalk_type:set_visible(false)
    menu.logger_type:set_visible(false)
    menu.log_info:set_visible(false)
    else
    toggle_clantag:set_visible(true)
    trashtalk_type:set_visible(true)
    menu.logger_type:set_visible(true)
    menu.log_info:set_visible(true)
    end

    if script_tabs:get_value() ~= 4 then -- UI tab
    screen_ind:set_visible(false)
    watermarkname:set_visible(false)
    watermarkusername:set_visible(false)
    animation_type:set_visible(false)
    auto_resize_width:set_visible(false)
    style_line:set_visible(false)
    chroma_dir:set_visible(false)
    color_line:set_visible(false)
    else
    screen_ind:set_visible(true)
    watermarkname:set_visible(true)
    watermarkusername:set_visible(true)
    animation_type:set_visible(true)
    auto_resize_width:set_visible(true)
    style_line:set_visible(true)
    chroma_dir:set_visible(true)
    color_line:set_visible(true)
    end

end
 
 client.register_callback("create_move", on_create_move)
 client.register_callback("paint", on_paint)
 
>.<
Участник
Статус
Оффлайн
Регистрация
22 Дек 2020
Сообщения
533
Реакции[?]
171
Поинты[?]
4K
спосибо за подробное описание функционала данного lua скрипта
 
Эксперт
Статус
Оффлайн
Регистрация
22 Мар 2020
Сообщения
2,191
Реакции[?]
484
Поинты[?]
3K
Код:
-- Tabs
local script_tabs = ui.add_combo_box("                sprays.lua", "script_tab_selection", { "[Ragebot]", "[Anti-Aim]", "[Visuals]", "[Misc]", "[UI]" }, 0)

--Rage_Bot
--Exploit
local exploit_doubletap = ui.add_key_bind("exploit doubletap", "exploit_doubletap", 0, 2)
local exploit_hide_shots = ui.add_key_bind("exploit hide shots", "exploit_hide_shots", 0, 2)

local dmg_override = ui.add_key_bind("dmg override", "dmg_override", 0, 1)
local dmg_override_value = ui.add_slider_int("dmg override value", "dmg_override_value", 1, 120, 1)

local hitscan_override = ui.add_key_bind('hitscan override', 'hitscan_override', 0, 1)
local hitscan_override_type = ui.add_combo_box("hitscan override type", "hitscan_override_type", { "head", "chest", "pelvis", "stomach", "legs", "foot" }, 0)

local safe_points_override = ui.add_key_bind("safe points override", "safe_points_override", 0, 1)
local safe_points_override_type = ui.add_combo_box("safe points override type", "safe_points_override_type", { "default", "prefer", "force" }, 0)

--Anti-Aim

require("bit32")
local ffi = require("ffi")
local pitch = ui.add_slider_int("Pitch", "pitch", -90, 90, 90)
local yaw_offset1 = ui.add_slider_int("Yaw offset", "yaw_offset1", -180, 180, 0)
local yaw_offset2 = ui.add_slider_int("Inverted yaw offset", "yaw_offset2", -180, 180, 0)
local jitter_offset2 = ui.add_slider_int("jitter offset", "jitter_offset2", 0, 50, 0)
local desync1 = ui.add_slider_int("Desync delta", "desync1", 0, 58, 58)
local desync2 = ui.add_slider_int("Inverted desync delta", "desync2", 0, 58, 58)
local lby_delta = ui.add_slider_float("LBY delta", "lby_delta", 0, 180, 180)
local lby_update_period = ui.add_slider_float("LBY update time", "lby_update_period", 0.055, 0.5, 0.15)
local inverter_bind = ui.add_key_bind("Inverter", "invert_side", 0, 2)
local max_fakelag = ui.add_check_box("Max FakeLag", "max_fakelag", false)
local jitter_desync = ui.add_multi_combo_box("Jitter desync conditions", "jitter_desync", { "[O]Standing", "[S]Walk", "[W]Run", "[A]Air", "[C]Crouch" }, { false, false, false, false, false })
local yaw_jitter = ui.add_multi_combo_box("Yaw jitter conditions", "yaw_jitter", { "[O]Standing", "[S]Walk", "[W]Run", "[A]Air", "[C]Crouch" }, { false, false, false, false, false })
--local no_micromoves = ui.add_check_box("Semi-LBY", "no_micromoves", false)
local left_manual = ui.add_key_bind("Manual left", "left_manual", 0, 1)
local right_manual = ui.add_key_bind("Manual right", "right_manual", 0, 1)
--local disable_manuals_if_unsafe = ui.add_check_box("Disable when unsafe", "disable_manuals_if_unsafe", true)

local m_vecVelocity = se.get_netvar("DT_BasePlayer", "m_vecVelocity[0]")
local netMoveType = se.get_netvar("DT_BaseEntity", "m_nRenderMode") + 1
local m_hActiveWeapon = se.get_netvar("DT_BaseCombatCharacter", "m_hActiveWeapon")
local m_fThrowTime = se.get_netvar("DT_BaseCSGrenade", "m_fThrowTime")
local m_flDuckAmount = se.get_netvar("DT_BasePlayer", "m_flDuckAmount")
local m_vecOrigin = se.get_netvar("DT_BaseEntity", "m_vecOrigin")
local m_hCarriedHostage = se.get_netvar("DT_CSPlayer", "m_hCarriedHostage")
local m_flFallVelocity = se.get_netvar("DT_BasePlayer", "m_flFallVelocity")

ffi.cdef[[
    struct WeaponInfo_t
    {
        char _0x0000[6];
        uint8_t classID;
        char _0x0007[13];
        __int32 max_clip;  
        char _0x0018[12];
        __int32 max_reserved_ammo;
        char _0x0028[96];
        char* hud_name;          
        char* weapon_name;      
        char _0x0090[60];
        __int32 type;          
    };
    struct Animstate_t
    {
        char pad[ 3 ];
        char m_bForceWeaponUpdate;
        char pad1[ 91 ];
        void* m_pBaseEntity;
        void* m_pActiveWeapon;
        void* m_pLastActiveWeapon;
        float m_flLastClientSideAnimationUpdateTime;
        int m_iLastClientSideAnimationUpdateFramecount;
        float m_flAnimUpdateDelta;
        float m_flEyeYaw;
        float m_flPitch;
        float m_flGoalFeetYaw;
    };
]]

local weapon_data_call = ffi.cast("int*(__thiscall*)(void*)", client.find_pattern("client.dll", "55 8B EC 81 EC ? ? ? ? 53 8B D9 56 57 8D 8B ? ? ? ? 85 C9 75 04"))

local function weapon_data(weapon)
    return ffi.cast("struct WeaponInfo_t*", weapon_data_call(ffi.cast("void*", weapon:get_address())))
end

local function get_animstate()
    local entity = entitylist.get_local_player()
    return ffi.cast("struct Animstate_t**", entity:get_address() + 0x9960)[0]
end

local function clamp_yaw(yaw)
    while yaw < -180.0 do yaw = yaw + 360.0 end
    while yaw > 180.0 do yaw = yaw - 360.0 end
    return yaw
end

local jitter_desync_inverted = false
local e_pressed = false
local jitter_side = 1
local freezetime = false
local manual_side = 0 -- 0 backwards, -1 left, 1 right
local lby_update_time = 0.0
local lby_force_choke = false

local function get_current_desync(mod_yaw)
    local animstate = get_animstate()
    return math.abs(mod_yaw - math.abs(clamp_yaw(engine.get_view_angles().yaw - animstate.m_flGoalFeetYaw))) -- CO3DAT3JIb JS REZOLVER
end

local function is_nade(lp)
    return weapon_data(entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon))).type == 0
end

local function is_throwing(lp)
    return entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon)):get_prop_float(m_fThrowTime) > 0.1
end

local function hasbit(x, p) return x % (p + p) >= p end

local function get_lby_breaker_time(fd)
    return fd and 0.4 or lby_update_period:get_value()
end

--0 for standing, 1 is walk, 2 is run, 3 air, 4 crouch
local function movement_type(lp, fd)
    local fv = lp:get_prop_float(m_flFallVelocity)
    if fv < -1 or fv > 1 then return 3 end
    if lp:get_prop_float(m_flDuckAmount) > 0.1 or fd then return 4 end
    if ui.get_key_bind("antihit_extra_slowwalk_bind"):is_active() then return 1 end
    if lp:get_prop_vector(m_vecVelocity):length() < 4 then return 0 end
    return 2
end

local function checks(cmd, lp)
    if freezetime then return true end
    local move_type = lp:get_prop_int(netMoveType)
    if move_type == 8 or move_type == 9 then return true end
    if is_nade(lp) and not is_throwing(lp) then return false end
    if is_nade(lp) and is_throwing(lp) then return true end
    if hasbit(cmd.buttons, bit32.lshift(1, 0)) then return true end
end

local function micro_move(cmd, lp)
    local move = 1.10
    if (lp:get_prop_float(m_flDuckAmount) > 0.1) then move = move * 3.0 end
    if cmd.command_number % 2 == 0 then move = -move end
    cmd.sidemove = cmd.sidemove + move
end

local function manual_aa()
    if client.is_key_clicked(left_manual:get_key()) then
        if manual_side == -1 then manual_side = 0 else manual_side = -1 end
    end
    if client.is_key_clicked(right_manual:get_key()) then
        if manual_side == 1 then manual_side = 0 else manual_side = 1 end
    end
end

local function break_lby(cmd, lby, lp, fd)
    if clientstate.get_choked_commands() >= 13 and fd then return 0 end
    if globalvars.get_current_time() >= lby_update_time then
        cmd.send_packet = false
        lby_force_choke = true
        lby_update_time = globalvars.get_current_time() + get_lby_breaker_time(fd)
        micro_move(cmd, lp)
        return lby
    end
    if lby_force_choke then
        lby_force_choke = false
        cmd.send_packet = false
    end
    return 0
end

local function main(cmd)
    local lp = entitylist.get_local_player()
    if not lp or not lp:is_alive() then return end
    if checks(cmd, lp) then return end
    cmd.viewangles.yaw = 180
    cmd.viewangles.pitch = 90
    local in_use = hasbit(cmd.buttons, bit32.lshift(1, 5))
    local is_standing = lp:get_prop_vector(m_vecVelocity):length() < 4

    --stop legit aa when planting, defusing and taking a hostage
    if in_use then
        local pos = lp:get_prop_vector(m_vecOrigin)
        local C4 = entitylist.get_entities_by_class("CPlantedC4")
        local hostages = entitylist.get_entities_by_class("CHostage")
        if  (#C4 ~= 0 and C4[1]:get_prop_vector(m_vecOrigin):dist_to(pos) <= 75) or
            (weapon_data(entitylist.get_entity_from_handle(lp:get_prop_int(m_hActiveWeapon))).classID == 207)
        then return end
        if #hostages > 0 then
            for i = 1, #hostages do
                if hostages[i]:get_prop_vector(m_vecOrigin):dist_to(pos) <= 75 and lp:get_prop_int(m_hCarriedHostage) == -1 then return end
            end
        end
    end

    --turning off fake lag
    --doing this shit because cmd.send_packet doesn't work :c
    ui.get_check_box("antihit_fakelag_enable"):set_value(false)
    ui.get_check_box("antihit_antiaim_enable"):set_value(false)
    local fakelag_limit = ui.get_slider_int("antihit_fakelag_limit")
    local fakelag = fakelag_limit:get_value() or 1
    if fakelag == 0 then fakelag_limit:set_value(1) end
    if max_fakelag:get_value() then fakelag = 15 end
    local exploit_is_active = ui.get_key_bind("rage_active_exploit_bind"):is_active()
    local fakeduck_is_active = ui.get_key_bind("antihit_extra_fakeduck_bind"):is_active()
    if not fakeduck_is_active and not exploit_is_active then
        cmd.send_packet = (fakelag <= clientstate.get_choked_commands())
    elseif exploit_is_active and not fakeduck_is_active then cmd.send_packet = (cmd.command_number % 2 == 0) end

    --stop aa on "USE" for one tick to make picking up weapons easier
    local first_time_e_pressed = false
    if e_pressed then cmd.buttons = bit32.band(cmd.buttons, -33) end
    if e_pressed ~= in_use then first_time_e_pressed = true end
    e_pressed = in_use
   
    local inverter = inverter_bind:is_active()
    local viewangles = engine.get_view_angles()
    local yaw = viewangles.yaw - 180 + (inverter and yaw_offset2:get_value() or yaw_offset1:get_value())
    local movement = movement_type(lp, fakeduck_is_active)

    --jitter
    if yaw_jitter:get_value(movement) then
        yaw = yaw + (inverter and jitter_offset2:get_value() or jitter_offset1:get_value() * -1) * jitter_side
    end

    --jitter inverter
    if jitter_desync:get_value(movement) and not cmd.send_packet then
        jitter_desync_inverted = not jitter_desync_inverted
        inverter = jitter_desync_inverted
    end

    --flips your yaw 180 degrees to look forward when you press E, and flip inverter to make your real appear at the same place
    if in_use then
        yaw = yaw + 180
        inverter = not inverter
    end

    --changing jitter side to make jitter... jitter!
    --btw there's 300iq move that syncs your jitter with desync jitter, so your aa will never be fucked up :D
    if not cmd.send_packet then
        if jitter_desync:get_value(movement) then jitter_side = (inverter and 1 or -1)
        else jitter_side = jitter_side * -1 end
    end

    --calculating delta
    local lby = lby_delta:get_value()
    local delta = (inverter and desync2:get_value() or desync1:get_value() * -1)
    if ((not is_standing and lby ~= 0) or lby == 0) and get_current_desync(viewangles.yaw - yaw) < math.abs(delta) then
        delta = (delta / math.abs(delta)) * 120
    end

    -- do LBY or micromove if LBY is off
    if is_standing then
        if lby ~= 0 then
            yaw = yaw + break_lby(cmd, lby, lp, fakeduck_is_active)
            delta = delta * 2
        else micro_move(cmd, lp) end
    end

    --animation desyncing process
    if not cmd.send_packet and not first_time_e_pressed then yaw = yaw - delta end

    --manual aa bind logic and manuals itself
    manual_aa()

    --i left it for another time xd

    --if disable_manuals_if_unsafe:get_value() then
    --    local pos = lp:get_player_hitbox_pos(0) --local's head position
    --    local players = entitylist.get_players(0)
    --    for i = 1, #players do
    --        local player = players[i]
    --        if not player:is_alive() or player:is_dormant() then goto skip end
    --        local attacker_pos = player:get_player_hitbox_pos(4) --we don't need big accuracy with positions to hit sideways head
    --        local trace = trace.line(0, 65536, pos, attacker_pos)
    --        print(tostring(trace.fraction .. " " .. trace.hitbox .. " " .. trace.hit_entity_index))
    --        ::skip::
    --    end
    --end
    if not in_use then yaw = yaw + (90 * manual_side) end

    --send yaw and pitch to server
    cmd.viewangles.yaw = yaw
    cmd.viewangles.pitch = pitch:get_value()

    --sets our pitch to natural if pitch slider is on 0
    if in_use or pitch:get_value() == 0 then cmd.viewangles.pitch = viewangles.pitch end
end

client.register_callback("create_move", main)
client.register_callback("round_prestart", function()
    freezetime = true
    lby_update_time = get_lby_breaker_time(ui.get_key_bind("antihit_extra_fakeduck_bind"):is_active())
    manual_side = 0
end)
client.register_callback("round_freeze_end", function() freezetime = false end)

--Visuals
--Croshair
local m_bIsScoped = se.get_netvar("DT_CSPlayer", "m_bIsScoped")
local Scope = false
local offset = ui.add_slider_int("Offset Scope", "offset_scope", 0, 500, 10)
local length = ui.add_slider_int("Length Scope", "length_scope", 0, 1000, 60)
local anim_speed = ui.add_slider_int("Animation speed", "anim_speed_scope", 1, 30, 15)
local animoffset = ui.add_check_box("Animate offset", "animoffset_scope", false)
local col_1 = ui.add_color_edit("First color", "scope_color1", true, color_t.new(255, 255, 255, 255))
local col_2 = ui.add_color_edit("Second color", "scope_color2", true, color_t.new(255, 255, 255, 10))
local anim_num = 0
local lerp = function(a, b, t)
    return a + (b - a) * t
end
client.register_callback("frame_stage_notify", function(s)
    if s ~= 5 then return end
    local local_player = entitylist:get_local_player()
    local bIsScoped = local_player:get_prop_bool(se.get_netvar("DT_CSPlayer", "m_bIsScoped"))
    local_player:set_prop_int(m_bIsScoped, bIsScoped and 1 or 0)
    Scope = bIsScoped and true or false
    if local_player:get_prop_int(m_bIsScoped) then
        local_player:set_prop_int(m_bIsScoped, 0)
    end
end)
client.register_callback("paint", function()
    local local_player = entitylist:get_local_player()
    local screen = engine.get_screen_size()
    local start_x, start_y = screen.x /2, screen.y /2
    local offsett = offset:get_value()
    local lengthh = length:get_value() * anim_num
    local width = 1
    local col1 = col_1:get_value() col1.a = col1.a * anim_num
    local col2 = col_2:get_value() col2.a = col2.a * anim_num
    local animcond = Scope and local_player:is_alive()
    anim_num = lerp(anim_num, animcond and 1 or 0, anim_speed:get_value() * globalvars.get_frame_time())
    offsett = animoffset:get_value() and offsett * anim_num or offsett
    --left
    renderer.rect_filled_fade(vec2_t.new(start_x - offsett + 1, start_y), vec2_t.new(start_x - offsett - lengthh + 1, start_y + width), col1, col2, col2, col1)
    --right
    renderer.rect_filled_fade(vec2_t.new(start_x + offsett, start_y), vec2_t.new(start_x + offsett + lengthh, start_y + width), col1, col2, col2, col1)
    --down
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y + offsett), vec2_t.new(start_x + width, start_y + offsett + lengthh), col1, col1, col2, col2)
    --up
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y - offsett + 1), vec2_t.new(start_x + width, start_y - offsett - lengthh + 1), col1, col1, col2, col2)
end)

--Thisperson
local distation = ui.add_slider_int('Thirdperson Ditstation', 'tppdist', 30, 200, 150)
local tpp = se.get_convar('cam_idealdist')
client.register_callback('create_move', function()
tpp:set_int(distation:get_value())
end)

--Mask Changer

local ffi = require("ffi")
local bit = require("bit")

local __thiscall = function(func, this)
    return function(...) return func(this, ...) end
end
local interface_ptr = ffi.typeof("void***")


local vtable_bind = function(module, interface, index, typedef)
    local addr = ffi.cast("void***", se.create_interface(module, interface)) or error(interface .. " was not found")
    return __thiscall(ffi.cast(typedef, addr[0][index]), addr)
end


local vtable_entry = function(instance, i, ct)
    return ffi.cast(ct, ffi.cast(interface_ptr, instance)[0][i])
end


local vtable_thunk = function(i, ct)
    local t = ffi.typeof(ct)
    return function(instance, ...)
        return vtable_entry(instance, i, t)(instance, ...)
    end
end



local get_class_name = vtable_thunk(143, "const char*(__thiscall*)(void*)")

local set_model_index = vtable_thunk(75, "void(__thiscall*)(void*,int)")


local get_client_entity_from_handle = vtable_bind("client.dll", "VClientEntityList003", 4, "void*(__thiscall*)(void*,void*)")

local get_model_index = vtable_bind("engine.dll", "VModelInfoClient004", 2, "int(__thiscall*)(void*, const char*)")


local rawientitylist = se.create_interface('client.dll', 'VClientEntityList003') or error('VClientEntityList003 was not found', 2)
local ientitylist = ffi.cast(interface_ptr, rawientitylist) or error('rawientitylist is nil', 2)

local get_client_entity = ffi.cast('void*(__thiscall*)(void*, int)', ientitylist[0][3]) or error('get_client_entity was not found', 2)


local client_string_table_container = ffi.cast(interface_ptr, se.create_interface('engine.dll', 'VEngineClientStringTable001')) or error('VEngineClientStringTable001 was not found', 2)
local find_table = vtable_thunk(3, 'void*(__thiscall*)(void*, const char*)')


local model_info = ffi.cast(interface_ptr, se.create_interface('engine.dll', 'VModelInfoClient004')) or error('VModelInfoClient004 wasnt found', 2)


ffi.cdef [[
    typedef void(__thiscall* find_or_load_model_t)(void*, const char*);
]]


local add_string = vtable_thunk(8, "int*(__thiscall*)(void*, bool, const char*, int length, const void* userdata)")

local find_or_load_model = ffi.cast("find_or_load_model_t", model_info[0][43]) -- vtable thunk crashes (?)

local function _precache(szModelName)
    if szModelName == "" then return end -- don't precache empty strings (crash)
    if szModelName == nil then return end
    szModelName = string.gsub(szModelName, [[\]], [[/]])

    local m_pModelPrecacheTable = find_table(client_string_table_container, "modelprecache")
    if m_pModelPrecacheTable ~= nil then
        find_or_load_model(model_info, szModelName)
        add_string(m_pModelPrecacheTable, false, szModelName, -1, nil)
    end
end


local changer = {}


changer.list_names = {'None', 'Dallas', 'Battle Mask', 'Evil Clown', 'Anaglyph', 'Boar', 'Bunny', 'Bunny Gold', 'Chains', 'Chicken', 'Devil Plastic', 'Hoxton', 'Pumpkin', 'Samurai', 'Sheep Bloody', 'Sheep Gold', 'Sheep Model', 'Skull', 'Template', 'Wolf', 'Doll',}
changer.models = {'', 'models/player/holiday/facemasks/facemask_dallas.mdl', 'models/player/holiday/facemasks/facemask_battlemask.mdl', 'models/player/holiday/facemasks/evil_clown.mdl', 'models/player/holiday/facemasks/facemask_anaglyph.mdl', 'models/player/holiday/facemasks/facemask_boar.mdl', 'models/player/holiday/facemasks/facemask_bunny.mdl', 'models/player/holiday/facemasks/facemask_bunny_gold.mdl', 'models/player/holiday/facemasks/facemask_chains.mdl', 'models/player/holiday/facemasks/facemask_chicken.mdl', 'models/player/holiday/facemasks/facemask_devil_plastic.mdl', 'models/player/holiday/facemasks/facemask_hoxton.mdl', 'models/player/holiday/facemasks/facemask_pumpkin.mdl', 'models/player/holiday/facemasks/facemask_samurai.mdl', 'models/player/holiday/facemasks/facemask_sheep_bloody.mdl', 'models/player/holiday/facemasks/facemask_sheep_gold.mdl', 'models/player/holiday/facemasks/facemask_sheep_model.mdl', 'models/player/holiday/facemasks/facemask_skull.mdl', 'models/player/holiday/facemasks/facemask_template.mdl', 'models/player/holiday/facemasks/facemask_wolf.mdl', 'models/player/holiday/facemasks/porcelain_doll.mdl',}

changer.last_model = 0
changer.model_index = -1
changer.enabled = false


local combobox_masks = ui.add_combo_box("Masc Changer", "lua_mask", changer.list_names, 0)


local function precache(modelPath)
    if modelPath == "" then return -1 end -- don't crash.
    local local_model_index = get_model_index(modelPath)
    if local_model_index == -1 then
        _precache(modelPath)
    end
    return get_model_index(modelPath)
end

local function on_paint()
    if not engine.is_in_game() then
        changer.last_model = 0
        return
    end
    if changer.last_model ~= combobox_masks:get_value() then
        changer.last_model = combobox_masks:get_value()
        if changer.last_model == 0 then
            changer.enabled = false
        else
            changer.enabled = true
            changer.model_index = precache(changer.models[changer.last_model + 1])
        end
    end
end


local function get_player_address(lp)
    return get_client_entity(ientitylist, lp:get_index())
end


local function on_setup_command(cmd)
    if changer.model_index == -1 then return precache(changer.models[changer.last_model + 1]) end

    local local_player = entitylist.get_local_player()
    if changer.enabled then
        local lp_addr = ffi.cast("intptr_t*", get_player_address(local_player))
        local m_AddonModelsHead = ffi.cast("intptr_t*", lp_addr + 0x462F) -- E8 ? ? ? ? A1 ? ? ? ? 8B CE 8B 40 10
        local i, next_model = m_AddonModelsHead[0], -1

        while i ~= -1 do
            next_model = ffi.cast("intptr_t*", lp_addr + 0x462C)[0] + 0x18 * i -- this is the pModel (CAddonModel) afaik
            i = ffi.cast("intptr_t*", next_model + 0x14)[0]
            local m_pEnt = ffi.cast("intptr_t**", next_model)[0] -- CHandle<C_BaseAnimating> m_hEnt -> Get()
            local m_iAddon = ffi.cast("intptr_t*", next_model + 0x4)[0]
            if tonumber(m_iAddon) == 16 then -- face mask addon bits knife = 10
                local entity = get_client_entity_from_handle(m_pEnt)
                set_model_index(entity, changer.model_index)
            end
        end
    end
end


local m_iAddonBits = se.get_netvar("DT_CSPlayer", "m_iAddonBits")

client.register_callback("create_move", function()
    local local_player = entitylist.get_local_player()
    if local_player == nil then return end
    if changer.enabled then
        if bit.band(local_player:get_prop_int(m_iAddonBits), 0x10000) ~= 0x10000 then
            local_player:set_prop_int(m_iAddonBits, 0x10000 + local_player:get_prop_int(m_iAddonBits))
        end
    else
        if bit.band(local_player:get_prop_int(m_iAddonBits), 0x10000) == 0x10000 then
            local_player:set_prop_int(m_iAddonBits, local_player:get_prop_int(m_iAddonBits) - 0x10000)
        end
    end
end)

client.register_callback('paint', on_paint)
client.register_callback("create_move", on_setup_command)


--clanteg

local toggle_clantag = ui.add_check_box("Clantag", "toggle_clantag", false)

local timing = 3
local count = 0
local clantag_animation =

{
"  ",
" s ",
" sp ",
" spr ",
" spra ",
" spray ",
" sprays ",
" sprays. ",
" sprays.l ",
" sprays.lu ",
" sprays.lua ",
" sprays.lua ",
" sprays.lu ",
" sprays.l ",
" sprays. ",
" sprays ",
" spray ",
" spra ",
" spr ",
" sp ",
" s ",
"  ",
}

client.register_callback("create_move", function()
    local players = entitylist.get_players(0)
end)
   

client.register_callback("paint", function()
    if not engine.is_connected() then return end
    if not toggle_clantag:get_value() then return end
    if timing < globalvars.get_tick_count() then
        count = count + 1

        if count > 60 then
            count = 0
        end

        se.set_clantag(clantag_animation[count])

        timing = globalvars.get_tick_count() + 30
    end
end)


local ffi = require 'ffi'

ffi.cdef[[
    typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
]]

local ENTITY_LIST_POINTER = ffi.cast("void***", se.create_interface("client.dll", "VClientEntityList003")) or error("Failed to find VClientEntityList003!")
local GET_CLIENT_ENTITY_FN = ffi.cast("GetClientEntity_4242425_t", ENTITY_LIST_POINTER[0][3])

local ffi_helper = {
    get_animstate_offset = function()
        return 14612
    end,

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

local function on_create_move(cmd)
    local localplayer = entitylist.get_local_player()
    if not localplayer then return end
    ffi.cast("float*", ffi_helper.get_entity_address(localplayer:get_index()) + 10100)[0] = 0
end

local function leg_breaker(cmd)
    if switch then
        switch = false
    else
         switch = true
    end

    if switch then
        local antiaim_active_movement_type = ui.get_combo_box("antihit_extra_leg_movement"):set_value(1)
    else
        local antiaim_active_movement_type = ui.get_combo_box("antihit_extra_leg_movement"):set_value(2)
    end
end

client.register_callback("create_move", on_create_move)
client.register_callback("create_move", leg_breaker)

--Trashtalk
local messagesRU = {
    "Супер изи для sprays.technologies",
    "Легчяйшая для sprays.lua",
    "Простейший для text.lua",
    "Тут могла быть ваша реклама",
    "Легко для sprays.lua",
    "Изи для sprays.lua",
    "Owned by kilzef.lua",
    "Падаещ от sprays.lua",
    "Лёкий подсочник для sprayscord",
}

client.notify("Sprays.lua Load")

local trashtalk_type = ui.add_combo_box("kil say", "trashtalk_type", { "Off", "sprays.lua" }, 0)


client.register_callback("player_death", function(event)
   
    local attacker_index = engine.get_player_for_user_id(event:get_int("attacker",0))
    local died_index = engine.get_player_for_user_id(event:get_int("userid",1))
    local me = engine.get_local_player()
   
    math.randomseed(os.clock()*100000000000)

        if attacker_index == me and died_index ~= me then    
            if trashtalk_type:get_value() == 1 then  
                engine.execute_client_cmd("say " .. tostring(messagesRU[math.random(0, #messagesRU)]))
            elseif trashtalk_type:get_value() == 2 then
                engine.execute_client_cmd("say " .. tostring(messagesENG[math.random(0, #messagesENG)]))
            elseif trashtalk_type:get_value() == 3 then
                engine.execute_client_cmd("say " .. tostring(trashfacts[math.random(0, #trashfacts)]))
            end
        end
end)

--Indicator Keybinds

--Under Cross

--adding ui elements
local x_offset = ui.add_slider_int("X offset", "indicators_x_offset", -100, 100, 0)
local y_offset = ui.add_slider_int("Y offset", "indicators_y_offset", -100, 100, 0)
local center = ui.add_check_box("Center Under Cross", "indicators_cetner", false)

--function for fast indicator adding
local function indicator(var, name, color, logic)
    logic = logic or nil
    return {
        ["var"] = var,
        ["name"] = name,
        ["color"] = color,
        ["alpha"] = 0,
        ["logic"] = logic
    }
end

--some shit
local function clamp(v, min, max) return math.min(math.max(v, min), max) end
local bind = ui.get_key_bind
local active_exploit, active_exploit_bind = ui.get_combo_box("rage_active_exploit"), ui.get_key_bind("rage_active_exploit_bind")

--defining array with indicators
local indicators = {
    indicator(nil, " sprays.lua ", color_t.new(400, 175, 255, 255), function() return true end),
    indicator(nil, "DOUBLETAP", color_t.new(255, 255, 255, 255), function()
        return (active_exploit:get_value() == 2 and active_exploit_bind:is_active())
    end),
    indicator(nil, "HIDESHOT", color_t.new(255, 255, 255, 255), function()
        return (active_exploit:get_value() == 1 and active_exploit_bind:is_active())
    end),
    indicator(bind("antihit_extra_fakeduck_bind"), "FAKEDUCK", color_t.new(255, 255, 255, 255)),
    indicator(bind("antihit_extra_autopeek_bind"), "QUICKPEEK", color_t.new(255, 255, 255, 255)),
}

local margin, speed, size = 8, 0.06, 10
local font = renderer.setup_font("C:/Windows/fonts/smallest pixel-7.ttf", size, 10)
client.register_callback("paint", function ()
    local lp = entitylist.get_local_player()
    if not lp:is_alive() then return end
    local speed = speed * globalvars.get_absolute_frametime() * 100
    local screen = engine.get_screen_size()
    local centering = center:get_value() and 1 or 0
    local cx = screen.x / 2 + x_offset:get_value()
    local cy = screen.y / 2
    local y = cy + 9 + y_offset:get_value()
    for i = 1, #indicators do
        local bind = indicators[i]
        local active = (bind.var ~= nil and bind.var:is_active()) or (bind.var == nil and bind.logic())
        bind.alpha = clamp(bind.alpha + (active and speed or (speed * -1)), 0, 1)
        if bind.alpha == 0 then goto skip end
        local text_size = renderer.get_text_size(font, size, bind.name)
        local bx, by, col = cx - ((text_size.x / 2) * centering), y - margin + (bind.alpha * margin), bind.color
        col.a = bind.alpha * 255
        renderer.text(bind.name, font, vec2_t.new(bx, by + 1), size, color_t.new(0, 0, 0, col.a / 1.33))
        renderer.text(bind.name, font, vec2_t.new(bx, by), size, col)
        y = y + (bind.alpha * margin)
        ::skip::
    end
end)

--UI UNDICATORS
local screen_ind = ui.add_multi_combo_box("Screen indicators", "screen_ind", { "Keybinds", "Watermark" }, { false, false })
local watermarkname = ui.add_text_input("Custom watermark name", "watermarkname", "Sprays.lua")
local watermarkusername = ui.add_text_input("Custom watermark username", "watermarkusername", "")
local animation_type = ui.add_combo_box("Animation type", "animation_type", { "Skeet", "Neverlose" }, 0)
local auto_resize_width = ui.add_check_box("Auto resize width", "auto_resize_width", false)
local style_line = ui.add_combo_box("Style line", "style_line", { "Static", "Fade", "Reverse fade", "Gradient", "Skeet", "Chroma" }, 0)
local chroma_dir = ui.add_combo_box("Chroma direction", "chroma_dir", { "Left", "Right", "Static" }, 0)
local color_line = ui.add_color_edit("Color line", "color_line", true, color_t.new(52, 164, 235, 255))
local keybinds_x = ui.add_slider_int("keybind_x", "keybinds_x", 0, engine.get_screen_size().x, 345)
local keybinds_y = ui.add_slider_int("keybind_y", "keybinds_y", 0, engine.get_screen_size().y, 215)

local verdana = renderer.setup_font("C:/windows/fonts/verdana.ttf", 12, 0)
local types = { "always", "hold", "toggle", "disabled" }

local function hsv2rgb(h, s, v, a)
    local r, g, b

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

    i = i % 6

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

    return color_t.new(r * 255, g * 255, b * 255, a * 255)
end
function math.lerp(a, b, t) return a + (b - a) * t end
local function drag(x, y, width, height, xmenu, ymenu, item)
    local cursor = renderer.get_cursor_pos()
    if (cursor.x >= x) and (cursor.x <= x + width) and (cursor.y >= y) and (cursor.y <= y + height) then
        if client.is_key_pressed(1) and item[1] == 0 then
            item[1] = 1
            item[2] = x - cursor.x
            item[3] = y - cursor.y
        end
    end
    if not client.is_key_pressed(1) then item[1] = 0 end
    if item[1] == 1 and ui.is_visible() then
        xmenu:set_value(cursor.x + item[2])
        ymenu:set_value(cursor.y + item[3])
    end
end
local function filledbox(x, y, w, h, al)
    local rgb = hsv2rgb(globalvars.get_real_time() / 4, 0.9, 1, 1)
    local chromd = chroma_dir:get_value()
    local col = color_line:get_value()
    local stl = style_line:get_value()

    if stl ~= 4 then
    renderer.rect_filled(vec2_t.new(x, y), vec2_t.new(x + w, y + h), color_t.new(15, 15, 15, col.a * al))
    else
    renderer.rect_filled(vec2_t.new(x, y - 2), vec2_t.new(x + w, y + h), color_t.new(30, 30, 30, col.a * al))
    renderer.rect_filled_fade(vec2_t.new(x + 1, y - 1), vec2_t.new(x + w / 2, y), color_t.new(0, 213, 255, 255 * al), color_t.new(204, 18, 204, 255 * al), color_t.new(204, 18, 204, 255 * al), color_t.new(0, 213, 255, 255 * al))
    renderer.rect_filled_fade(vec2_t.new(x + (w / 2), y - 1), vec2_t.new(x + w - 1, y), color_t.new(204, 18, 204, 255 * al), color_t.new(255, 250, 0, 255 * al), color_t.new(255, 250, 0, 255 * al), color_t.new(204, 18, 204, 255 * al))
    end
   
    gradient_color = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(0, 0, 0, 255 * al) or stl == 2 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 3 and color_t.new(0, 213, 255, 255 * al) or stl == 5 and color_t.new(chromd==1 and rgb.g or rgb.r, chromd==1 and rgb.b or rgb.g, chromd ==1 and rgb.g or rgb.b, 255 * al) or color_t.new(0, 0, 0, 0)
    gradient_color1 = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 2 and color_t.new(0, 0, 0, 255 * al) or stl == 3 and color_t.new(204, 18, 204, 255 * al) or stl == 5 and color_t.new(chromd==2 and rgb.r or rgb.b, chromd==2 and rgb.g or rgb.r, chromd==2 and rgb.b or rgb.g, 255 * al) or color_t.new(0, 0, 0, 0)
    gradient_color2 = stl == 0 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 1 and color_t.new(0, 0, 0, 255 * al) or stl == 2 and color_t.new(col.r, col.g, col.b, 255 * al) or stl == 3 and color_t.new(255, 250, 0, 255 * al) or stl == 5 and color_t.new(chromd==0 and rgb.g or rgb.r, chromd==0 and rgb.b or rgb.g, chromd ==0 and rgb.g or rgb.b, 255 * al) or color_t.new(0, 0, 0, 0)

    if stl ~= 4 then
        renderer.rect_filled_fade(vec2_t.new(x, y - 2), vec2_t.new(x + w / 2, y), gradient_color, gradient_color1, gradient_color1, gradient_color)
        renderer.rect_filled_fade(vec2_t.new(x + (w / 2), y - 2), vec2_t.new(x + w, y), gradient_color1, gradient_color2, gradient_color2, gradient_color1)
    end
end
--indicators
local item = { 0, 0, 0 }
local animwidth = 0;
local alpha = { 0 }
local bind = {
["Double tap"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 2, add = 0, multiply = 0},
["Hide shots"] = {reference = ui.get_key_bind("rage_active_exploit_bind"), exploit = 1, add = 0, multiply = 0},
["On shot anti aim"] = {reference = ui.get_key_bind("antihit_antiaim_flip_bind"), exploit = 0, add = 0, multiply = 0},
["Auto peek"] = {reference = ui.get_key_bind("antihit_extra_autopeek_bind"), exploit = 0, add = 0, multiply = 0},
["Slow walk"] = {reference = ui.get_key_bind("antihit_extra_slowwalk_bind"), exploit = 0, add = 0, multiply = 0},
["Fake duck"] = {reference = ui.get_key_bind("antihit_extra_fakeduck_bind"), exploit = 0, add = 0, multiply = 0},
["Jump bug"] = {reference = ui.get_key_bind("misc_jump_bug_bind"), exploit = 0, add = 0, multiply = 0},
["Edge jump"] = {reference = ui.get_key_bind("misc_edge_jump_bind"), exploit = 0, add = 0, multiply = 0},
--["Название бинда"] = {reference = получение бинда, exploit = 0 (это не трогать), add = 0 (это не трогать), multiply = 0 (это не трогать)},
};
client.register_callback("paint", function()
    --ui visible
    local screen = screen_ind:get_value(1) or screen_ind:get_value(0)
    watermarkname:set_visible(screen_ind:get_value(1))
    watermarkusername:set_visible(screen_ind:get_value(1))
    animation_type:set_visible(screen_ind:get_value(0))
    auto_resize_width:set_visible(screen_ind:get_value(0))
    style_line:set_visible(screen) chroma_dir:set_visible(style_line:get_value() == 5) color_line:set_visible(screen)
    keybinds_x:set_visible(false) keybinds_y:set_visible(false)
    --timer
    local function watermark()
    --watermark
        if screen_ind:get_value(1) then
            local wtname = ""
            local user = ""
            if watermarkname:get_value() ~= "" then wtname = tostring(watermarkname:get_value()) else wtname = "nixware.cc" end
            if watermarkusername:get_value() ~= "" then user = tostring(watermarkusername:get_value()) else user = client.get_username() end
            local username = client.get_username()
            local ping = se.get_latency()
            local tickcount = 1 / globalvars.get_interval_per_tick()
            local text = ""
            if engine.is_connected() then
            text = wtname .. " | " .. user .. " | delay: " .. ping .. "ms | " .. tickcount .. "tick | " .. os.date("%X") else
            text = wtname .. " | " .. user .. " | " .. os.date("%X") end
            local screen = engine.get_screen_size()
            local w = renderer.get_text_size(verdana, 12, text).x + 10
            local h = 17
            local x = screen.x - w - 10
            filledbox(x, 8, w, h, 1)
            renderer.text(text, verdana, vec2_t.new(x + 6, 10 + 1), 12, color_t.new(0, 0, 0, 255))
            renderer.text(text, verdana, vec2_t.new(x + 5, 10), 12, color_t.new(255, 255, 255, 255))
        end
    end
    --keybinds
    local function keybinds()
        if screen_ind:get_value(0) and engine.is_connected() then
            local pos = {x = keybinds_x:get_value(), y = keybinds_y:get_value()}
            local alphak, keybinds = {}, {}
            local width, maxwidth = 25, 0;
            local height = 17;
            local bind_y = height + 4
           
            for i,v in pairs(bind) do
                local exploits = ui.get_combo_box("rage_active_exploit"):get_value(); v.add = math.lerp(v.add, v.reference:is_active() and 255 or 0, 0.1); v.multiply = v.add > 4 and 1 or 0;
                if v.add > 4 then if v.exploit == 0 then table.insert(keybinds, i) end; if v.exploit ~= 0 and exploits == v.exploit then table.insert(keybinds, i) end; end;
                if v.exploit == 0 and v.reference:is_active() then table.insert(alphak, i) end; if v.exploit ~= 0 and exploits == v.exploit and v.reference:is_active() then table.insert(alphak, i) end;
            end
            if #alphak ~= 0 or ui.is_visible() then alpha[1] = math.lerp(alpha[1], 255, 0.1) end; if #alphak == 0 and not ui.is_visible() then alpha[1] = math.lerp(alpha[1], 0, 0.1) end      
            for k,f in pairs(keybinds) do if renderer.get_text_size(verdana, 12, f .. "["..types[bind[f].reference:get_type() + 1].."]").x > maxwidth then maxwidth = renderer.get_text_size(verdana, 12, f .. "["..types[bind[f].reference:get_type() + 1].."]").x; end; end
            if maxwidth == 0 then maxwidth = 50 end; width = width + maxwidth; if width < 130 then width = 130 end if animwidth == 0 then animwidth = width end; animwidth = math.lerp(animwidth, width, 0.1)
            w = auto_resize_width:get_value() and (animation_type:get_value() == 1 and animwidth or width) or 150
            for k,f in pairs(keybinds) do
                local v = bind[f]; bind_y = bind_y + (animation_type:get_value() == 1 and 20 * (v.add / 255) or 20 * v.multiply); plus = bind_y - (animation_type:get_value() == 1 and 20 * (v.add / 255) or 20 * v.multiply);
                renderer.text(f, verdana, vec2_t.new(pos.x + 5, pos.y + plus + 1), 12, color_t.new(0, 0, 0, 255 * (v.add / 255)))
                renderer.text(f, verdana, vec2_t.new(pos.x + 4, pos.y + plus), 12, color_t.new(255, 255, 255, 255 * (v.add / 255)))
                renderer.text("["..types[v.reference:get_type() + 1].."]", verdana, vec2_t.new(pos.x + w - renderer.get_text_size(verdana, 12, "["..types[v.reference:get_type() + 1].."]").x - 3, pos.y + plus + 1), 12, color_t.new(0, 0, 0, 255 * (v.add / 255)))
                renderer.text("["..types[v.reference:get_type() + 1].."]", verdana, vec2_t.new(pos.x + w - renderer.get_text_size(verdana, 12, "["..types[v.reference:get_type() + 1].."]").x - 4, pos.y + plus), 12, color_t.new(255, 255, 255, 255 * (v.add / 255)))
            end
            if alpha[1] > 1 then
                filledbox(pos.x, pos.y, w, height, (alpha[1] / 255))
                renderer.text("keybinds", verdana, vec2_t.new(pos.x + (w /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2) + 1, pos.y + 3), 12, color_t.new(0, 0, 0, 255 * (alpha[1] / 255)))
                renderer.text("keybinds", verdana, vec2_t.new(pos.x + (w /2) - (renderer.get_text_size(verdana, 12, "keybinds").x /2), pos.y + 2), 12, color_t.new(255, 255, 255, 255 * (alpha[1] / 255)))
                drag(pos.x, pos.y, w, height + 2, keybinds_x, keybinds_y, item)
            end
        end
    end
    watermark(); keybinds();
end)








function on_paint()
    -- Script tabs
    if script_tabs:get_value() ~= 0 then -- Ragebot tab
    exploit_doubletap:set_visible(false)
    exploit_hide_shots:set_visible(false)
    dmg_override :set_visible(false)
    dmg_override_value:set_visible(false)
    hitscan_override:set_visible(false)
    hitscan_override_type:set_visible(false)
    safe_points_override:set_visible(false)
    safe_points_override_type:set_visible(false)
    else
    exploit_doubletap:set_visible(true)
    exploit_hide_shots:set_visible(true)
    dmg_override :set_visible(true)
    dmg_override_value:set_visible(true)
    hitscan_override:set_visible(true)
    hitscan_override_type:set_visible(true)
    safe_points_override:set_visible(true)
    safe_points_override_type:set_visible(true)
    end

    if script_tabs:get_value() ~= 1 then -- Anti-Aim tab
    pitch:set_visible(false)
    yaw_offset1:set_visible(false)
    yaw_offset2:set_visible(false)
    jitter_offset2:set_visible(false)
    desync1:set_visible(false)
    desync2:set_visible(false)
    lby_delta:set_visible(false)
    lby_update_period:set_visible(false)
    inverter_bind:set_visible(false)
    max_fakelag:set_visible(false)
    jitter_desync:set_visible(false)
    yaw_jitter:set_visible(false)
    right_manual:set_visible(false)
    left_manual:set_visible(false)
    else
    pitch:set_visible(true)
    yaw_offset1:set_visible(true)
    yaw_offset2:set_visible(true)
    jitter_offset2:set_visible(true)
    desync1:set_visible(true)
    desync2:set_visible(true)
    lby_delta:set_visible(true)
    lby_update_period:set_visible(true)
    inverter_bind:set_visible(true)
    max_fakelag:set_visible(true)
    jitter_desync:set_visible(true)
    yaw_jitter:set_visible(true)
    right_manual:set_visible(true)
    left_manual:set_visible(true)
    end

    if script_tabs:get_value() ~= 2 then -- Visuals tab
    offset:set_visible(false)
    length:set_visible(false)
    anim_speed:set_visible(false)
    animoffset:set_visible(false)
    col_1:set_visible(false)
    col_2:set_visible(false)
    distation:set_visible(false)
    combobox_masks:set_visible(false)
    x_offset:set_visible(false)
    y_offset:set_visible(false)
    center:set_visible(false)

    else
    offset:set_visible(true)
    length:set_visible(true)
    anim_speed:set_visible(true)
    animoffset:set_visible(true)
    col_1:set_visible(true)
    col_2:set_visible(true)
    distation:set_visible(true)
    combobox_masks:set_visible(true)
    x_offset:set_visible(true)
    y_offset:set_visible(true)
    center:set_visible(true)
    end

    if script_tabs:get_value() ~= 3 then -- Misc tab
    toggle_clantag:set_visible(false)
    trashtalk_type:set_visible(false)
    menu.logger_type:set_visible(false)
    menu.log_info:set_visible(false)
    else
    toggle_clantag:set_visible(true)
    trashtalk_type:set_visible(true)
    menu.logger_type:set_visible(true)
    menu.log_info:set_visible(true)
    end

    if script_tabs:get_value() ~= 4 then -- UI tab
    screen_ind:set_visible(false)
    watermarkname:set_visible(false)
    watermarkusername:set_visible(false)
    animation_type:set_visible(false)
    auto_resize_width:set_visible(false)
    style_line:set_visible(false)
    chroma_dir:set_visible(false)
    color_line:set_visible(false)
    else
    screen_ind:set_visible(true)
    watermarkname:set_visible(true)
    watermarkusername:set_visible(true)
    animation_type:set_visible(true)
    auto_resize_width:set_visible(true)
    style_line:set_visible(true)
    chroma_dir:set_visible(true)
    color_line:set_visible(true)
    end

end

client.register_callback("create_move", on_create_move)
client.register_callback("paint", on_paint)
фулл паста.
даже индикаторы от sleebu , да . пупсик мой ?
 
Начинающий
Статус
Оффлайн
Регистрация
11 Авг 2022
Сообщения
16
Реакции[?]
0
Поинты[?]
0
не только индикаторы. антиаимы мои полностью
Я делал что бы сразу не несколько луашек вкл а просто 1 вкл и несколько луашкек настраиваешь нежели чем искать её 100 лет
 
Сверху Снизу