LUA скрипт [SpirtHack] RGB Trail.

Статус
В этой теме нельзя размещать новые ответы.
Новичок
Новичок
Статус
Оффлайн
Регистрация
27 Окт 2021
Сообщения
1
Реакции
1
Привет! Искал на форуме SpirtHack'а и не нашел Trail, пришлось писать самому. Надеюсь оцените)
RZwe2KbnPIA.jpg
Ссылка на Скачивание:
Пожалуйста, авторизуйтесь для просмотра ссылки.
V1.0
C++:
Expand Collapse Copy
local enable = Menu.Switch("MonixLITE","Enable Trail", false)
local enableSphere = Menu.Switch("MonixLITE","Enable Sphere", false)
local lifetime = Menu.SliderInt("MonixLITE","LifeTime", 100, 10, 1000)

local trails = {}
local i = 1

local function hsv_to_rgb(h, s, v)
    local r, g, b

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

    i = i % 6

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

    return Color.new(r, g, b)
end

function drawTrail()
    if enable:Get() == false then return end
    local local_player = EntityList.GetLocalPlayer()
    if not local_player or local_player:GetProp("m_lifeState") ~= false then return end
    local local_player_origin = local_player:GetProp("m_vecOrigin")
    local netchann_info = EngineClient.GetNetChannelInfo()
    local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
    local tickcount_pred = GlobalVars.tickcount + latency
    table.insert(trails,
        {
            x = local_player_origin.x,
            y = local_player_origin.y,
            z = local_player_origin.z,
            time = tickcount_pred + lifetime:Get()
        }
    )
end

function drawTrails()
    if enable:Get() == false then return end
    local hue_offset = 0
    hue_offset = ((GlobalVars.realtime * (2 * 50)) + i) % 360
    hue_offset = math.min(360, math.max(0, hue_offset))
    local r, g, b = hsv_to_rgb(hue_offset / 360, 1, 1).r, hsv_to_rgb(hue_offset / 360, 1, 1).g, hsv_to_rgb(hue_offset / 360, 1, 1).b
    clr = Color.new(r, g, b)

    for i = 2, #trails do
        local netchann_info = EngineClient.GetNetChannelInfo()
        local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
        local tickcount_pred = GlobalVars.tickcount + latency
        if trails[i-1].time > tickcount_pred then
            local position1 = Render.WorldToScreen(Vector.new(trails[i].x, trails[i].y, trails[i].z))
            local position2 = Render.WorldToScreen(Vector.new(trails[i-1].x, trails[i-1].y, trails[i-1].z))
            Render.Line(Vector2.new(position1.x, position1.y), Vector2.new(position2.x, position2.y), clr)
            Render.Line(Vector2.new(position1.x+1, position1.y+1), Vector2.new(position2.x+1, position2.y+1), clr)
            Render.Line(Vector2.new(position1.x+2, position1.y+2), Vector2.new(position2.x+2, position2.y+2), clr)
            if enableSphere:Get() == true then Render.Circle3DFilled(Vector.new(trails[#trails].x, trails[#trails].y, trails[#trails].z), 25, 3, clr) end
        end
    end
end

Cheat.RegisterCallback("draw", function()
    drawTrail()
    drawTrails()
end)
V2.0
C++:
Expand Collapse Copy
local enable = Menu.Switch("MonixLITE","Enable Trail", false)
local enableSphere = Menu.Switch("MonixLITE","Enable Sphere", false)
local lifetime = Menu.SliderInt("MonixLITE","LifeTime", 100, 10, 500)

local trails = {}
local i = 1

local function hsv_to_rgb(h, s, v)
    local r, g, b

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

    i = i % 6

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

    return Color.new(r, g, b)
end

function drawTrail()
    if enable:Get() == false then return end
    local local_player = EntityList.GetLocalPlayer()
    if not local_player or local_player:GetProp("m_lifeState") ~= false then return end
    local local_player_origin = local_player:GetProp("m_vecOrigin")
    local netchann_info = EngineClient.GetNetChannelInfo()
    local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
    local tickcount_pred = GlobalVars.tickcount + latency
    table.insert(trails,
        {
            x = local_player_origin.x,
            y = local_player_origin.y,
            z = local_player_origin.z,
            time = tickcount_pred + lifetime:Get()
        }
    )
end

function drawTrails()
    if enable:Get() == false then return end
    local hue_offset = 0
    hue_offset = ((GlobalVars.realtime * (2 * 50)) + i) % 360
    hue_offset = math.min(360, math.max(0, hue_offset))
    local r, g, b = hsv_to_rgb(hue_offset / 360, 1, 1).r, hsv_to_rgb(hue_offset / 360, 1, 1).g, hsv_to_rgb(hue_offset / 360, 1, 1).b
    clr = Color.new(r, g, b)
    for i = 2, #trails do
        local netchann_info = EngineClient.GetNetChannelInfo()
        local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
        local tickcount_pred = GlobalVars.tickcount + latency
        if trails[i-1].time > tickcount_pred then
            local position1 = Render.WorldToScreen(Vector.new(trails[i].x, trails[i].y, trails[i].z))
            local position2 = Render.WorldToScreen(Vector.new(trails[i-1].x, trails[i-1].y, trails[i-1].z))
            Render.Line(Vector2.new(position1.x, position1.y), Vector2.new(position2.x, position2.y), clr)
            Render.Line(Vector2.new(position1.x+1, position1.y+1), Vector2.new(position2.x+1, position2.y+1), clr)
            Render.Line(Vector2.new(position1.x+2, position1.y+2), Vector2.new(position2.x+2, position2.y+2), clr)
            if enableSphere:Get() == true then Render.Circle3DFilled(Vector.new(trails[#trails].x, trails[#trails].y, trails[#trails].z), 25, 3, clr) end
        end
    end
    if #trails > lifetime:Get() then
        for a = 1, lifetime:Get() do
            table.remove(trails, a)
        end
    end
end

Cheat.RegisterCallback("draw", function()
    drawTrail()
    drawTrails()
end)
 
Последнее редактирование:
Я может быть тупой, но для чего нужен RGB Trail? Чисто для красоты что ли?
 
Во первых
Пожалуйста, авторизуйтесь для просмотра ссылки.

Во вторых зачем тебе своя функция hsv to rgb если она по дефу в Чите есть? Color.HSLA(…)
 
Во первых
Пожалуйста, авторизуйтесь для просмотра ссылки.

Во вторых зачем тебе своя функция hsv to rgb если она по дефу в Чите есть?
ну взял с вантапа чел переписал, не умеет ведь сам
Во первых
Пожалуйста, авторизуйтесь для просмотра ссылки.

Во вторых зачем тебе своя функция hsv to rgb если она по дефу в Чите есть?
ща сделаю на бимсах
 
Во первых
Пожалуйста, авторизуйтесь для просмотра ссылки.

Во вторых зачем тебе своя функция hsv to rgb если она по дефу в Чите есть? Color.HSLA(…)
Спасибо, не знал.
Но все ровно буду менять функцию, так как хочу сделать более красиво. Простите за недоработки, я новичок в этом.
 
Спасибо ,теперь я красивый
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху Снизу