LUA скрипт [Spirthack] - Carnage.ua

ЧВК EB_LAN
Эксперт
Статус
Оффлайн
Регистрация
26 Янв 2021
Сообщения
1,547
Реакции[?]
517
Поинты[?]
191K
Делал 28.07.2022, не обращайте на щиткод итд итп, у меня кодстайл давно уже другой, просто нашёл свою солянку старую на спиртхак, я даже с референсами не умел работать я в ахуей
code_language.lua:
--[[
    [28.07.2022] - Full recode of the script and simplification of the base for further work.
--]]

-- Main --

    -- Globalvars --
    local screensize = EngineClient.GetScreenSize()
    local styles_box = {"Default", "Rounded"}
    local styles_circles = {"Default", "Outline"}
    local styles_fakelag = {"Extended", "Fluctate", "Massive", "Random"}
    -- Globalvars --

    -- Script includes --

        -- Math --
        local Math = {data = {}}
        -- Math --

    -- Script includes --

    -- Anti-Aim --
        -- Fake flick --
        local fakeflick = Menu.Switch("Anti-Aim", "Fake flick", false)
        local fakeflick_size = Menu.SliderInt("Anti-Aim", "Fake flick [Angle amount]", 90, 0, 90)
        local fakeflick_tick = Menu.SliderInt("Anti-Aim", "Fake flick [After ticks]", 15, 0 , 16)
        -- Fake flick --

        -- Fakelags --
        Menu.ColorEdit("Anti-Aim", " ", Color.new(1.0, 1.0, 1.0, 1.0), function()end)
        local fakelag = Menu.Switch("Anti-Aim", "Custom Fake Lag", false)
        local fakelag_mode = Menu.Combo("Anti-Aim", "Fake Lag Mode", styles_fakelag, 0)
        -- Fakelags --
    -- Anti-Aim --

    -- Render --
        -- Watermark --
        local watermark = Menu.SwitchColor("Render", "Watermark", false, Color.new(1.0, 1.0, 1.0, 1.0))
        local watermark_style = Menu.Combo("Render", "Style", styles_box, 0)
        local watermark_rounding = Menu.SliderInt("Render", "Rounding", 4, 0 , 10)
        local text = "Carnage.ua | stable | User: " .. Cheat.GetCheatUserName()
        local textSize = Render.CalcTextSize(text, 11)
        local position = Vector2.new(screensize.x, 15)
        local indent = Vector2.new(10, 5)
        -- Watermark --

        -- Keybinds --
        Menu.ColorEdit("Render", " ", Color.new(1.0, 1.0, 1.0, 1.0), function()end)
        local keybind = Menu.SwitchColor("Render", "Keybinds", false, Color.new(1.0, 1.0, 1.0, 1.0))
        local keybind_style = Menu.Combo("Render", "Style ", styles_box, 0)
        local keybind_rounding = Menu.SliderInt("Render", "Rounding ", 4, 0 , 10)
        local keybind_background = Menu.Switch("Render", "Background", false)
        local keybind_pos_x = Menu.SliderInt("Render", "Keybinds [Pos X]", 5, 1, screensize.x)
        local keybind_pos_y = Menu.SliderInt("Render", "Keybinds [Pos Y]", 200, 1, screensize.y)
        local drag = false
        local width = 0
        -- Keybinds --

        -- Custom autopeek --
        Menu.ColorEdit("Render", " ", Color.new(1.0, 1.0, 1.0, 1.0), function()end)
        local custom_autopeek = Menu.SwitchColor("Render", "Custom Autopeek", false, Color.new(1.0, 1.0, 1.0, 1.0))
        local autopeek_style = Menu.Combo("Render", "Autopeek Style", styles_circles, 0)
        local autopeek_rectangles = Menu.SliderInt("Render", "Autopeek Corners", 6, 3 , 20)    
        local autopeek_size = Menu.SliderInt("Render", "Autopeek Size", 10, 1 , 25)
        local autopeek_pos
        -- Custom autopeek --

        -- Custom smoke/molotov --
        Menu.ColorEdit("Render", " ", Color.new(1.0, 1.0, 1.0, 1.0), function()end)
        local custom_molotov = Menu.SwitchColor("Render","Molotov Circle",false,Color.new(1, 0.47, 0.47))
        local custom_smoke = Menu.SwitchColor("Render","Smoke Circle",false,Color.new(0.47,0.47,1))
        local custom_smoke_molotov_style = Menu.Combo("Render", "Smoke/Molotov Circle Style", styles_circles, 0)
        -- Custom smoke/molotov --

    -- Render --

    -- World --
        -- Sunset mode --
        local sunset_mode = Menu.Switch("World", "Sunset Mode", false)
        local ui_rotation_x = Menu.SliderInt("World", "Sun [Pos X]", 30, -120, 120)
        local ui_rotation_y = Menu.SliderInt("World", "Sun [Pos Y]", 100, -120, 120)
        local sun_rotation_override = CVar.FindVar("cl_csm_rot_override")
        local sun_rotation_x = CVar.FindVar("cl_csm_rot_x")
        local sun_rotation_y = CVar.FindVar("cl_csm_rot_y")
        -- Sunset mode --

        -- FOG Effects --
        Menu.ColorEdit("World", " ", Color.new(1.0, 1.0, 1.0, 1.0), function()end)
        local fog = Menu.SwitchColor("World", "Fog Effects", false, Color.new(1, 1, 1, 1))
        local fog_start_distance = Menu.SliderInt("World", "Start Distance", 250, 0, 2500)
        local fog_end_distance = Menu.SliderInt("World", "End Distance", 1250, 0, 2500)
        local fog_density = Menu.SliderInt("World", "Density", 55, 0, 100)
        -- FOG Effects --
    -- World --

    -- Ui reference --
    local Ui = {
        YawBase = Menu.FindVar("Ragebot", "Anti Aim", "Main", "Yaw"),
        YawOffset = Menu.FindVar("Ragebot", "Anti Aim", "Main", "Yaw Add"),
        JitterMode = Menu.FindVar("Ragebot", "Anti Aim", "Main", "Jitter"),
        JitterOffset = Menu.FindVar("Ragebot", "Anti Aim", "Main", "Jitter Angle"),
        DesyncAmount = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Body Yaw Limit"),
        LBYMode = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Lower Body Yaw"),
        Slowwalk = Menu.FindVar("Ragebot", "Anti Aim", "Misc", "Slow Walk"),
        Inverter = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Inverter"),
        AvoidOverlap = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Avoid Overlap"),
        DesyncJitter = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Jitter Sides"),
        DesyncDirection = Menu.FindVar("Ragebot", "Anti Aim", "Fake Angle", "Auto Inverter"),
        Doubletap = Menu.FindVar("Ragebot", "Aimbot", "Exploits", "Double Tap"),
        Hideshots = Menu.FindVar("Ragebot", "Aimbot", "Exploits", "Hide Shots"),
        FakelagLimit = Menu.FindVar("Ragebot", "Anti Aim", "Misc", "Fake Lag Value"),
        Autopeek = Menu.FindVar("OTHER", "Main", "Automatization", "Auto Peek")
    }
    -- Ui reference --

    -- Font reference --
    local Font = {
       Tahoma = Render.InitFont("Tahoma", 15),
       Verdana = Render.InitFont("Verdana", 15),
       SmallestPixel = Render.InitFont("Smallest Pixel-7", 10)
    }
    -- Font reference --

-- Main --



-- Math functions --

    -- Clamp --
    function clamp(x, min, max)

        if min > max then
            return math.min(math.max(x, max), min)
        else
            return math.min(math.max(x, min), max)
        end
                       
        return x
    end
    -- Clamp --

    -- Linear interpolation --
    function linear_interpolation(start, end_pos, time)
        return (end_pos - start) * time + start
    end
    -- Linear interpolation --

    -- Lerp value setter --
    Math.lerp_set = function(name, value, time)
        if Math.data[name] == nil then
            Math.data[name] = value
        end
   
        Math.data[name] = Math.lerp(Math.data[name], value, time)
   
        return Math.data[name]
    end
    -- Lerp value setter --

    -- Lerp --
    Math.lerp = function(start, end_pos, time)
        if type(start) == 'userdata' then
            local color_data = {0, 0, 0, 0}
            for i, color_key in ipairs({'r', 'g', 'b', 'a'}) do color_data[i] = Math.lerp(start[color_key], end_pos[color_key], time) end
   
            return Color.new(unpack(color_data))
        end
                               
        --[[
            Color Animation
            local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
            local color = Math.new('test color', val and Color.new(1, 1, 1) or Color.new(0, 0, 0), 0.005)  --Anim Color
           
            Move Animation
            local val = return true/false or GlobalVars.realtime % 4 > 2  --Anim enabler
            local y = Math.lerp_set('test y', val and 400 or 500, 0.007)   --Anim Strafe setup              
            local pos = Vector2.new(200, y) --Anim Strafe start
        ]]--
                               
        time = time or 0.005
        time = clamp(GlobalVars.frametime * time * 175.0, 0.01, 1.0)
   
        return linear_interpolation(start, end_pos, time)
    end
    -- Lerp --

    -- Custom split --
    function string.customsplit(inputstr, sep)
        if sep == nil then sep = "%s" end
        local t={}
        for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
            table.insert(t, str)
        end
        return t
    end
    -- Custom split --

-- Math functions --



-- Render --
    -- Watermark --
    local function Watermark()
        if watermark:Get() then
            if watermark_style:Get() == 0 then
                Render.BoxFilled(Vector2.new(position.x - indent.x, position.y - indent.y), Vector2.new(position.x - textSize.x - indent.x - 6, position.y + textSize.y + indent.y), Color.new(0, 0, 0, watermark:GetColor().a))
                Render.BoxFilled(Vector2.new(position.x - indent.x, position.y - indent.y), Vector2.new(position.x - textSize.x - indent.x - 6, position.y - 7), Color.new(watermark:GetColor().r, watermark:GetColor().g, watermark:GetColor().b, 1.0))
            end
            if watermark_style:Get() == 1 then
                Render.BoxFilled(Vector2.new(position.x - textSize.x - indent.x - 6, position.y - indent.y), Vector2.new(position.x - indent.x, position.y + textSize.y + indent.y), Color.new(0, 0, 0, watermark:GetColor().a), watermark_rounding:Get())
                Render.Box(Vector2.new(position.x - textSize.x - indent.x - 6, position.y - indent.y), Vector2.new(position.x - indent.x, position.y + textSize.y + indent.y), Color.new(watermark:GetColor().r, watermark:GetColor().g, watermark:GetColor().b, 1.0), watermark_rounding:Get())
            end
        Render.Text(text, Vector2.new(position.x - textSize.x - indent.x - 3, position.y), Color.new(1, 1, 1, 1), 11)
        end
    end
    -- Watermark --

    -- Keybinds --
    local function render_conteiner(x, y, w, h, name, color, box_alpha, font_size, font)
        local name_size = Render.CalcTextSize(name, font_size)
        local add_y_box = 0
        local binds = Cheat.GetBinds()                    
        for i = 1, #binds do add_y_box = add_y_box + 16 end
                               
        if keybind_style:Get() == 0 then
            keybind_rounding:SetVisible(false)
            keybind_background:SetVisible(true)                        
            Render.BoxFilled(Vector2.new(x, y), Vector2.new(x - 80 + w, y + h + 5), Color.new(0.1, 0.1, 0.1, keybind:GetColor().a))                    
            if keybind_background:Get() then
                Render.BoxFilled(Vector2.new(x, y + h + add_y_box + 7), Vector2.new(x - 80 + w, y + h + 5), Color.new(0.2, 0.2, 0.2, keybind:GetColor().a - 0.3))
            end              
            Render.BoxFilled(Vector2.new(x, y), Vector2.new(x - 80 + w, y + 2), Color.new(keybind:GetColor().r, keybind:GetColor().g, keybind:GetColor().b, 1))
            Render.Text(name, Vector2.new(x - 40 + w / 2 - name_size.x / 2, y + 4), Color.new(1, 1, 1), font_size)
          end
                               
        if keybind_style:Get() == 1 then
            keybind_rounding:SetVisible(true)      
            keybind_background:SetVisible(false)                    
            Render.BoxFilled(Vector2.new(x, y), Vector2.new(x - 80 + w, y + h + 5), Color.new(0.1, 0.1, 0.1, keybind:GetColor().a), keybind_rounding:Get())
            Render.Box(Vector2.new(x, y), Vector2.new(x - 80 + w, y + h + 5), Color.new(keybind:GetColor().r, keybind:GetColor().g, keybind:GetColor().b, 1.0), keybind_rounding:Get())
            Render.Text(name, Vector2.new(x - 40 + w / 2 - name_size.x / 2, y + 3), Color.new(1, 1, 1), font_size)
        end

    end
   
    local function Keybinds()
        local X, Y = keybind_pos_x:Get(), keybind_pos_y:Get()
        if not keybind:Get() then return end
                       
        local add_y = 0
     
        local mouse = Cheat.GetMousePos()

        local function render_binds(binds)
            if not binds:IsActive() then return end

            local max_width = 0
            local statetext = "[" .. binds:GetValue() .. "]"

            width = math.max(200, max_width)

            add_y = add_y + 16
             
            local bind_state_size = Render.CalcTextSize(statetext, 10)
            local bind_name_size = Render.CalcTextSize(binds:GetName(), 10)

            Render.Text(binds:GetName(), Vector2.new(X + 5, Y + add_y + 5), Color.new(1, 1, 1, 1), 10)
            Render.Text(statetext, Vector2.new(X - 84 + (width - bind_state_size.x), Y + add_y + 5), Color.new(1, 1, 1, 1), 10)
                 
            local bind_width = bind_state_size.x + bind_name_size.x + 10
               
            if bind_width > 80 then if bind_width > max_width then max_width = bind_width end end
        end

        render_conteiner(X, Y, width, 13, "keybinds", color, Color.new(0, 0, 0, 0.3), 10)

        if Cheat.IsKeyDown(1) then
            if mouse.x >= X and mouse.y >= Y and mouse.x <= X + width and mouse.y <= Y + 18 or drag then
                if not drag then
                    drag = true
                else
                    keybind_pos_x:Set(mouse.x - math.floor(width / 2))
                    keybind_pos_y:Set(mouse.y - 8)
                end
            end
        else
            drag = false
        end
   
        local binds = Cheat.GetBinds()
           
        for i = 1, #binds do render_binds(binds[i]) end          
    end
    -- Keybinds --

    -- Custom autopeek --
    local function CustomAutopeek()
        local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())                          
        local autopeek_enabled = Ui.Autopeek:Get() and custom_autopeek:Get()
        local autopeek_size_anim = Math.lerp_set('autopeek size', autopeek_enabled and autopeek_size:Get() or 1, 0.05)                    
        if autopeek_enabled then
                   
            if autopeek_pos == nil then autopeek_pos = localplayer:GetRenderOrigin() end
                   
            if Ui.Autopeek:Get() then
                if autopeek_style:Get() == 0 then
                    Render.Circle3DFilled(autopeek_pos, autopeek_rectangles:Get(), autopeek_size_anim, custom_autopeek:GetColor())
                end
                                   
                if autopeek_style:Get() == 1 then
                    Render.Circle3D(autopeek_pos, autopeek_rectangles:Get(), autopeek_size_anim, custom_autopeek:GetColor())
                end          
            end
                   
        else
            autopeek_pos = nil
        end
    end
    -- Custom autopeek --

    -- Custom smoke/molotov --
    local function CustomSmokeMolotov()
        local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
        local localplayer_pos = localplayer:GetProp("m_vecOrigin", 0)

        if custom_smoke:Get() then
            local smoke_on_ground = EntityList.GetEntitiesByName("CSmokeGrenadeProjectile")

            if smoke_on_ground == nil then return end

            for i = 1, #smoke_on_ground do
                local smoke_origin = smoke_on_ground[i]:GetProp("m_vecOrigin", 0)
                if smoke_on_ground[i]:GetProp("m_bDidSmokeEffect", 0) and localplayer_pos:DistTo(smoke_origin) < 9999999999 then
                    if custom_smoke_molotov_style:Get() == 0 then
                        Render.Circle3DFilled(smoke_origin, 58, 125, custom_smoke:GetColor())
                    else
                        Render.Circle3D(smoke_origin, 58, 125, custom_smoke:GetColor())
                    end    
                end
            end
        end

        if custom_molotov:Get() then
            local molotov_on_ground = EntityList.GetEntitiesByName("CInferno")

            if molotov_on_ground == nil then return end

            for i = 1, #molotov_on_ground do
                local molotov_origin = molotov_on_ground[i]:GetProp("m_vecOrigin", 0)

                if localplayer_pos:DistTo(molotov_origin) < 9999999999 then
                    if custom_smoke_molotov_style:Get() == 0 then
                        Render.Circle3DFilled(molotov_origin, 58, 145, custom_molotov:GetColor())
                    else
                        Render.Circle3D(molotov_origin, 58, 145, custom_molotov:GetColor())
                    end
                end
            end
        end
    end
    -- Custom smoke/molotov --

-- Render --


-- Anti-Aim --

    -- Fake flick --
    local function Fakeflick()  
        if not Ui.Doubletap:Get() and Ui.Hideshots:Get() then
            return
        end

        if fakeflick:Get() == true then
            if GlobalVars.tickcount % fakeflick_tick:Get() == 0 then
                Ui.YawOffset:Set(Ui.Inverter:Get() and -fakeflick_size:Get() or fakeflick_size:Get())
            else
                Ui.YawOffset:Set(0)
            end
        end
    end
    -- Fake flick --

    -- Fakelag --
    local function CustomFakelag()
        if not fakelag:Get() then return end

        local choke = 0

        if fakelag_mode:Get() == 0 then choke = 15 end

        if fakelag_mode:Get() == 1 then
            local fluctatetime = math.floor(GlobalVars.realtime * 16) % 14
            local adaptiveticks = math.random(2,4)

            if fluctatetime > adaptiveticks then
                choke = 15
            else
                choke = 0
            end
        end

        if fakelag_mode:Get() == 2 then
            local fluctatetime = math.floor(GlobalVars.realtime * 15) % 3
            choke = 14 + fluctatetime
        end
       
        if fakelag_mode:Get() == 3 then choke = math.random(2, 15) end

        Ui.FakelagLimit:Set(choke)
    end
    -- Fakelag --

-- Anti-Aim --


-- World --
    -- Sunset mode --
    local function SunsetMode()  
        sun_rotation_override:SetInt(sunset_mode:Get() and 1 or 0)
        sun_rotation_x:SetInt(sunset_mode:Get() and ui_rotation_x:Get() or 0)
        sun_rotation_y:SetInt(sunset_mode:Get() and ui_rotation_y:Get() or 0)
    end
    -- Sunset mode --

    -- FOG Effects --
    local function FogEffects(stage)
        if stage ~= 5 then return end
        if not fog:Get() then CVar.FindVar("fog_override"):SetInt(0) return end
        if CVar.FindVar("fog_override"):GetInt() ~= 1 then CVar.FindVar("fog_override"):SetInt(1) end
        if CVar.FindVar("fog_start"):GetInt() ~= fog_start_distance:Get() then CVar.FindVar("fog_start"):SetInt(fog_start_distance:Get()) end
        if CVar.FindVar("fog_end"):GetInt() ~= fog_end_distance:Get() then CVar.FindVar("fog_end"):SetInt(fog_end_distance:Get()) end
        if CVar.FindVar("fog_maxdensity"):GetInt() ~= fog_density:Get() then CVar.FindVar("fog_maxdensity"):SetFloat(fog_density:Get()/100) end
        EngineClient.ExecuteClientCmd("fog_color " .. fog:GetColor().r * 255 .. " "..fog:GetColor().g * 255 .. " "..fog:GetColor().b * 255)
    end
    -- FOG Effects --
-- World --


-- Hooks --
local function hook_draw()
    keybind_pos_x:SetVisible(false)
    keybind_pos_y:SetVisible(false)

    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())      
    if not localplayer then return end

    -- Render --
    Watermark()
    Keybinds()
    CustomAutopeek()
    CustomSmokeMolotov()
    -- Render --

    -- Anti-Aim --
    Fakeflick()
    CustomFakelag()
    -- Anti-Aim --
end

local function hook_prediction()
   local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
   if not localplayer then return end

   SunsetMode()
end

local function hook_frame_stage(stage)
    local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
    if not localplayer then return end

    FogEffects(stage)
end

Cheat.RegisterCallback("frame_stage", hook_frame_stage)
Cheat.RegisterCallback("createmove", hook_createmove)
Cheat.RegisterCallback("draw", hook_draw)
Cheat.RegisterCallback("prediction", hook_prediction)
Cheat.RegisterCallback("pre_prediction", hook_pre_prediction)
EngineClient.ExecuteClientCmd("clear")
 
Сверху Снизу