LUA скрипт [GS] Skeleton on LocalPlayer

Новичок
Статус
Оффлайн
Регистрация
14 Окт 2023
Сообщения
1
Реакции[?]
1
Поинты[?]
1K
Сделал простенький скрипт который добавляет скелетон на локал плеера.
SS -
Пожалуйста, авторизуйтесь для просмотра ссылки.



code_language.lua:
local vector = require 'vector'

local ref = {
    Thirdperson = {ui.reference('visuals', 'Effects', 'Force third person (alive)')}
}

local Visuals = {}

Visuals.ui = {
    Skeleton = ui.new_checkbox('visuals', 'Colored models', 'Skeleton'),
    SkeletonColor = ui.new_color_picker('visuals', 'Colored models', 'Skeleton Color', 255,255,255,255),
}

local IdOfHitboxes = {
    {0, 1, 6, 5, 4, 3, 2},
    {14, 18, 17, 1},
    {13, 16, 15, 1},
    {12, 10, 8, 2},
    {11, 9, 7, 2}
}

local alpha = 0
local increment = 5
local delay = 0.001
local iterations = 255 / increment
local nextUpdateTime = globals.curtime() + delay
function animation(state)
    if state == true and alpha < 255 then
        if globals.curtime() >= nextUpdateTime then
            alpha = alpha + increment
            if alpha >= 255 then
                alpha = 255
            end
            nextUpdateTime = globals.curtime() + delay
        end
    elseif state == false and alpha > 0 then
        if globals.curtime() >= nextUpdateTime then
            alpha = alpha - increment
            if alpha <= 0 then
                alpha = 0
            end
            nextUpdateTime = globals.curtime() + delay
        end
    end

    return alpha
end
function Skeleton()

    local lp = entity.get_local_player()
    if not entity.is_alive(lp) then return end
    if ui.get(ref.Thirdperson[1]) == false then return end if ui.get(ref.Thirdperson[2]) == false then return end
    local alpha = animation(ui.get(Visuals.ui.Skeleton))       
    local r,g,b,a = ui.get(Visuals.ui.SkeletonColor)
    for k = 2, 5 do
        for i = 1, 3 do
            local hitbox    = vector(entity.hitbox_position(lp, IdOfHitboxes[k][i]))
            local hitbox2   = vector(entity.hitbox_position(lp, IdOfHitboxes[k][i+1]))
            local x, y      = renderer.world_to_screen(hitbox.x, hitbox.y, hitbox.z)
            local x2, y2    = renderer.world_to_screen(hitbox2.x, hitbox2.y, hitbox2.z)
            renderer.line(x, y, x2, y2, r,g,b,a/(255/alpha))
        end
    end
    for i = 1, 6 do
        local hitbox    = vector(entity.hitbox_position(lp, IdOfHitboxes[1][i]))
        local hitbox2   = vector(entity.hitbox_position(lp, IdOfHitboxes[1][i+1]))
        local x, y      = renderer.world_to_screen(hitbox.x, hitbox.y, hitbox.z)
        local x2, y2    = renderer.world_to_screen(hitbox2.x, hitbox2.y, hitbox2.z)
        renderer.line(x, y, x2, y2, r,g,b,a/(255/alpha))
    end   
end
client.set_event_callback('paint', function()
    Skeleton()
end)
 
Сверху Снизу