LUA скрипт [nixware] better paimon gif

life is cheap, death is free!
Эксперт
Статус
Оффлайн
Регистрация
9 Дек 2019
Сообщения
1,603
Реакции[?]
517
Поинты[?]
2K
взято из:
Пожалуйста, авторизуйтесь для просмотра ссылки.
(тема моя, бугурт не уместен)

Оригинальный сурс/original source
Пожалуйста, авторизуйтесь для просмотра ссылки.


Чутка почистил код, теперь пролага на запуске нет
Что изменилось? добавил чекбокс для только в меню, и чекбокс для позиции в зависимости от курсора

Код:
local frames = 52 -- if u want change gif, paste here your frame count of gif
local alpha = 0
local counter = 0
local next_frame = 0
local pos = { x = 0, y = 0 }
local screen = engine.get_screen_size()
local wantedvisible = ui.add_check_box("Only in menu", "paimon_menu", false)
local cursorbased = ui.add_check_box("Cursos pos", "paimon_cursor", false)
local misc_paimon_scale = ui.add_slider_int('scale', 'misc_paimon_scale', 1, 10, 2)
local pos_x = ui.add_slider_int('pos x', 'misc_pos_x', 1, screen.x, 150)
local pos_y = ui.add_slider_int('pos y', 'misc_pos_y', 1, screen.y, 400)

client.register_callback('paint', function()
    cursorbased:set_visible(wantedvisible:get_value())
    pos_x:set_visible(not cursorbased:get_value())
    pos_y:set_visible(not cursorbased:get_value())
end)

local function render_image(image, x, y, w, h)
    renderer.texture(image, vec2_t.new(x, y), vec2_t.new(x + w, y + h), color_t.new(255, 255, 255, alpha))
end

local function clamp(value, min, max)
    if value > max then return max end
    if value < min then return min end
    return value
end

client.register_callback('paint', function ()

    if wantedvisible:get_value() then
        if not ui.is_visible() and alpha > 0 then
            alpha = clamp(alpha - 5, 0, 255)
        else if ui.is_visible() and alpha < 255 then
            alpha = clamp(alpha + 5, 0, 255)
        end end

        if not ui.is_visible() and alpha < 1 then
            return
        end
    else
        alpha = 255
    end
    local cursor = renderer.get_cursor_pos()

    if cursorbased:get_value() and ui.is_visible() then
        pos.x = cursor.x + 50
        pos.y = cursor.y - 150
    else
        pos.x = pos_x:get_value()
        pos.y = pos_y:get_value()
    end

    local time = math.floor(globalvars.get_current_time() * 1000)

    if next_frame - time > 30 then
        next_frame = 0
    end

    if next_frame - time < 1 then
        counter = counter + 1

        next_frame = time + 30
    end
    local frame = renderer.setup_texture("nix/paimon_gif/paimon_00" .. tostring((counter % frames)) .. ".png")
    local scale = clamp(misc_paimon_scale:get_value(), 1, 10)

    local w = math.floor(397 / scale)
    local h = math.floor(465 / scale)

    render_image(
        frame,
        clamp(pos.x, 0, screen.x - w),
        clamp(pos.y, 0, screen.y - h),
        w,
        h
    )
end)
 

Вложения

Легенда форума
Статус
Оффлайн
Регистрация
16 Сен 2018
Сообщения
4,004
Реакции[?]
1,947
Поинты[?]
7K
local frame = renderer.setup_texture("nix/paimon_gif/paimon_00" .. tostring((counter % frames)) .. ".png") local scale = clamp(misc_paimon_scale:get_value(), 1, 10) local w = math.floor(397 / scale) local h = math.floor(465 / scale) render_image( frame, clamp(pos.x, 0, screen.x - w), clamp(pos.y, 0, screen.y - h), w, h
Так а зачем… Даже сливали все либы со скита, там значит должен быть гиф декод
 
life is cheap, death is free!
Эксперт
Статус
Оффлайн
Регистрация
9 Дек 2019
Сообщения
1,603
Реакции[?]
517
Поинты[?]
2K
Так а зачем… Даже сливали все либы со скита, там значит должен быть гиф декод
Честно, я во все это не вникал, я переписал тупо потому что там были проёбы в виде поиска картинок через кмд, и только в меню
 
Сверху Снизу