Вопрос [FT] помощь с аним брейкером.

Начинающий
Статус
Оффлайн
Регистрация
19 Июл 2022
Сообщения
118
Реакции[?]
26
Поинты[?]
11K
Привет. Хочу попросить помощи с этим скриптом. Он меняет аним фикс не только у тебя, но и у других игроков (у всех других людей тоже поднимается питч и т.д.) В скрипте есть проверка на локал плеера, я даже чуть чуть дополнил ее, но скрипту похуй. Прошу помощи, в том как это можно пофиксить
code_language.lua:
-- local ffi = require "ffi"

local on_ground_ticks = 0

local sigs = {
    get_pose_params = {"client.dll", "55 8B EC 8B 45 08 57 8B F9 8B 4F 04 85 C9 75 15"} -- https://github.com/perilouswithadollarsign/cstrike15_src/blob/master/public/studio.cpp#L931
}

local offsets = {
    animstate = 0x9960, -- m_bIsScoped - 20
    m_pStudioHdr = 0x2950, -- https://github.com/frk1/hazedumper/blob/master/csgo.json#L55
    landing_anim = 0x109,
}

local bind_argument = function(fn, arg)
    return function(...)
        return fn(arg, ...)
    end
end

local interface_type = ffi.typeof("uintptr_t**")

local i_client_entity_list = ffi.cast(interface_type, utils.find_interface("client.dll", "VClientEntityList003"))
local get_client_entity = bind_argument(ffi.cast("void*(__thiscall*)(void*, int)", i_client_entity_list[0][3]), i_client_entity_list)

local get_pose_parameters = ffi.cast( "struct {char pad[8]; float m_flStart; float m_flEnd; float m_flState;}*(__thiscall* )( void*, int )", utils.find_pattern(unpack(sigs.get_pose_params)))

local cache = {}

local set_layer = function(player_ptr, layer, start_val, end_val)

    player_ptr = ffi.cast("unsigned int", player_ptr)

    if player_ptr == 0x0 then
        return false
    end

    local studio_hdr = ffi.cast("void**", player_ptr + offsets.m_pStudioHdr)[0]

    if studio_hdr == nil then
        return false
    end

    local pose_params = get_pose_parameters(studio_hdr, layer)

    if pose_params == nil then
        return
    end

    if cache[layer] == nil then
        cache[layer] = {}

        cache[layer].m_flStart = pose_params.m_flStart
        cache[layer].m_flEnd = pose_params.m_flEnd

        cache[layer].m_flState = pose_params.m_flState

        cache[layer].installed = false
        return true
    end

    if start_val ~= nil and not cache[layer].installed then

        pose_params.m_flStart   = start_val
        pose_params.m_flEnd     = end_val

        pose_params.m_flState   = (pose_params.m_flStart + pose_params.m_flEnd) / 2

        cache[layer].installed = true
        return true
    end
    
    if cache[layer].installed then

        pose_params.m_flStart   = cache[layer].m_flStart
        pose_params.m_flEnd     = cache[layer].m_flEnd

        pose_params.m_flState   = cache[layer].m_flState

        cache[layer].installed = false

        return true
    end

    return false
end

local setup = function(cmd)

    local local_player = get_client_entity(engine.get_local_player())

    if local_player == nil then
        return
    end

    if not local_player then
        return
    end
    local animstate = ffi.cast( "void**", ffi.cast("unsigned int", local_player) + offsets.animstate)[0]

    if animstate == nil then
        return
    end

    animstate = ffi.cast("unsigned int", animstate)

    if animstate == 0x0 then
        return
    end

    local landing_anim = ffi.cast("bool*", animstate + offsets.landing_anim)[0]

    if landing_anim == nil then
        return
    end

    for k, _ in pairs(cache) do
        set_layer(local_player, k)
    end

    set_layer(local_player, 0, -180, -179) -- leg movement -- m_flPoseParamter 0

    set_layer(local_player, 6, 0.9, 1) -- falling anim -- m_flPoseParamter 6

    if on_ground_ticks > 12 and landing_anim then
        set_layer(local_player, 12, 0.999, 1) -- pitch -- m_flPoseParamter 12
    end
end

local on_destroy = function()

    local local_player = get_client_entity(engine.get_local_player())

    if local_player == nil then
        return
    end

    if not local_player then
        return
    end

    for k, _ in pairs(cache) do
        set_layer(local_player, k)
    end

end

function on_create_move(cmd)
    -- print(bit.band(cmd:get_buttons(), csgo.in_jump) == 0)

    setup(cmd)

    local local_player = entities.get_entity(engine.get_local_player())
    if local_player == nil then
        return
    end

    if not local_player then
        return
    end

    local on_ground = bit.band(local_player:get_prop("m_fFlags"),1)
    if on_ground == 1 then
        on_ground_ticks = on_ground_ticks + 1
    else
        on_ground_ticks = 0
    end

    -- print(on_ground_ticks)
end
function on_shutdown()
    on_destroy()
end
 
Сверху Снизу