Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Crack Lua Neverlose sigma local glow

Забаненный
Забаненный
Статус
Оффлайн
Регистрация
16 Фев 2022
Сообщения
51
Реакции
27
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
Expand Collapse Copy
local ffi = require("ffi")

local function ReadUInt(address)
    return ffi.cast("unsigned int*", address)[0]
end

local function GetItemIndex(targetTable, item)
    for i=1,table.getn(targetTable) do
        if targetTable[i] == item then
            return i
        end
    end
end

local clientEntityList = Utils.CreateInterface("client.dll", "VClientEntityList003")
local engineClient = Utils.CreateInterface("engine.dll", "VEngineClient014")

ffi.cdef[[
    struct Vector
    {
        float r, g, b;
    };

    struct CAllocator_GlowObjectDefinition_t //Haven't done a lot of research but templates don't seem to work with ffi.cdef so I'm left with this
    {
        struct GlowObjectDefinition_t *m_pMemory;
        int m_nAllocationCount;
        int m_nGrowSize;
    };

    struct CUtlVector_GlowObjectDefinition_t
    {
        struct CAllocator_GlowObjectDefinition_t m_Memory;
        int m_Size;
        struct GlowObjectDefinition_t *m_pElements;
    };

    struct GlowObjectDefinition_t
    {
        int m_nNextFreeSlot;
        void *m_pEntity;
        struct Vector m_vGlowColor;
        float m_flGlowAlpha;
        char pad01[16];
        bool m_bRenderWhenOccluded;
        bool m_bRenderWhenUnoccluded;
        bool m_bFullBloomRender;
        char pad02;
        int m_nFullBloomStencilTestValue;
        int m_nRenderStyle;
        int m_nSplitScreenSlot;
        //Total size: 0x38 bytes
    };

    struct CGlowObjectManager
    {
        struct CUtlVector_GlowObjectDefinition_t m_GlowObjectDefinitions;
        int m_nFirstFreeSlot;
    };
]]

local GetGlowObjectManager_t = "struct CGlowObjectManager*(__cdecl*)()"
local RegisterGlowObject_t = "int(__thiscall*)(struct CGlowObjectManager*, void*, const struct Vector&, bool, bool, int)"
local GetClientEntity_t = "void*(__thiscall*)(void*, int)"
local IsInGame_t = "bool(__thiscall*)(void*)"

local RegisterGlowObject = ffi.cast("unsigned int", Utils.PatternScan("client.dll", "E8 ? ? ? ? 89 03 EB 02"))
RegisterGlowObject = ffi.cast(RegisterGlowObject_t, RegisterGlowObject + 5 + ReadUInt (RegisterGlowObject + 1))
local GetGlowObjectManager = ffi.cast(GetGlowObjectManager_t, Utils.PatternScan("client.dll", "A1 ? ? ? ? A8 01 75 4B"))
local GetClientEntityRaw = ffi.cast(GetClientEntity_t, ReadUInt(ReadUInt(ffi.cast("unsigned int", clientEntityList)) + 3 * 4))
local IsInGameRaw = ffi.cast(IsInGame_t, ReadUInt(ReadUInt(ffi.cast("unsigned int", engineClient)) + 26 * 4))

local glowObjectIndexes = { }
local GLOW_STYLES = { "Default", "Rim Glow 3D", "Edge Highlight", "Edge Highlight Pulse" }

local cfgGlowToggle = Menu.SwitchColor("Local Player Glow", "Enable", false, Color.new(1.0, 1.0, 1.0, 1.0))
local cfgGlowStyle = Menu.Combo("Local Player Glow", "Style", GLOW_STYLES, 0)

local oldColor = {r = 1.0, g = 1.0, b = 1.0, a = 1.0}

local function GetClientEntity(index)
    return GetClientEntityRaw(clientEntityList, index)
end

local function IsInGame()
    return IsInGameRaw(engineClient)
end

local function CreateGlowObject(ent, color, alpha, style)
    local glowObjectManager = GetGlowObjectManager()
    local index = RegisterGlowObject(glowObjectManager, ffi.cast("void*", ent), ffi.new("struct Vector", color), true, true, -1)
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_vGlowColor = color
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_flGlowAlpha = alpha
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_nRenderStyle = style
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_bRenderWhenOccluded = true
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_bRenderWhenUnoccluded = true
    table.insert(glowObjectIndexes, index)
end

local function SetGlowObjectColor(index, color, alpha)
    local glowObjectManager = GetGlowObjectManager()
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_vGlowColor = color
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_flGlowAlpha = alpha
end

local function SetGlowObjectRender(index, status)
    local glowObjectManager = GetGlowObjectManager()
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_bRenderWhenOccluded = status
    glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[index].m_bRenderWhenUnoccluded = status
end

local function InitGlowObjects()
    local localPlayer = GetClientEntity(EngineClient.GetLocalPlayer())
    local style = cfgGlowStyle:Get()
  
    CreateGlowObject(localPlayer, { 1.0, 0.0, 0.0 }, 1.0, 0)
    CreateGlowObject(localPlayer, { 0.0, 0.0, 0.0 }, 0.0, 1)
    CreateGlowObject(localPlayer, { 0.0, 0.0, 0.0 }, 0.0, 2)
    CreateGlowObject(localPlayer, { 0.0, 0.0, 0.0 }, 0.0, 3)
    
    for i=1, table.getn(glowObjectIndexes) do
        local color = cfgGlowToggle:GetColor()
        if not cfgGlowToggle:GetBool() or style + 1 ~= i then
            SetGlowObjectRender(glowObjectIndexes[i], false)
        else
            SetGlowObjectRender(glowObjectIndexes[i], true)
        end
        SetGlowObjectColor(glowObjectIndexes[i], { color.r, color.g, color.b }, color.a)
    end
end

local function RemoveGlowObjects()
    local glowObjectManager = GetGlowObjectManager()
    for i=1, table.getn(glowObjectIndexes) do
        glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[glowObjectIndexes[i]].m_nNextFreeSlot = glowObjectManager.m_nFirstFreeSlot
        glowObjectManager.m_GlowObjectDefinitions.m_Memory.m_pMemory[glowObjectIndexes[i]].m_pEntity = ffi.cast("void*", 0)
        glowObjectManager.m_nFirstFreeSlot = glowObjectIndexes[i]
    end
    glowObjectIndexes = { }
end

local function HandleEvents(event)
    if event:GetName() == "player_connect_full"  then
        local localIndex = EngineClient.GetLocalPlayer()
        local connectedIndex = EntityList.GetPlayerForUserID(event:GetInt("userid", 0)):EntIndex()

        if localIndex == connectedIndex then
            InitGlowObjects()
        end
    end
end

local function OnPaintUI()
    if IsInGame() then
        local color = cfgGlowToggle:GetColor()
        if color.r ~= oldColor.r or color.g ~= oldColor.g or color.b ~= oldColor.b or color.a ~= oldColor.a then
            for i=1, table.getn(glowObjectIndexes) do
                SetGlowObjectColor(glowObjectIndexes[i], { color.r, color.g, color.b }, color.a)
            end

            oldColor = {r = color.r, g = color.g, b = color.b, a = color.a}
        end
    elseif glowObjectIndexes[1] ~= nil then
        RemoveGlowObjects()
    end
end


local function OnUIRenderElementChanged(value)
    local style = cfgGlowStyle:Get()

    for i=1, table.getn(glowObjectIndexes) do
        if not cfgGlowToggle:GetBool() or style + 1 ~= i then
            SetGlowObjectRender(glowObjectIndexes[i], false)
        else
            SetGlowObjectRender(glowObjectIndexes[i], true)
        end
    end
end

if IsInGame() then
    InitGlowObjects()
end

cfgGlowToggle:RegisterCallback(OnUIRenderElementChanged)
cfgGlowStyle:RegisterCallback(OnUIRenderElementChanged)
Cheat.RegisterCallback("destroy", RemoveGlowObjects)
Cheat.RegisterCallback("draw", OnPaintUI)
Cheat.RegisterCallback("events", HandleEvents)
Код:
Expand Collapse Copy
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Оптимизации 0.
Только эти чамсы хавают фпс 30-50
 
Назад
Сверху Снизу