Модератор раздела "Создание скриптов для читов"
-
Автор темы
- #1
название прикольное =)
вот ссылка на библиотеку wrapper: https://yougame.biz/threads/339089/
code_language.lua:
--@description: yougame.biz
--@author: uwukson4800
local ui = require 'wrapper'
local entity_extended = require 'gamesense/entity'
local slider = ui.create('lol'):slider('chokelimit', 1, 16, 16)
local animation_fix do
animation_fix = {}
animation_fix.anim_data = {
fakelag_states = {},
choke_state = false,
switch_time = 0,
layers = {
[0] = { cycle = 0, weight = 0 }, -- aim_matrix
[1] = { cycle = 0, weight = 0 }, -- weapon_action
[2] = { cycle = 0, weight = 0 }, -- weapon_action_recrouch
[3] = { cycle = 0, weight = 0 }, -- adjust
[4] = { cycle = 0, weight = 0 }, -- movement_move
[5] = { cycle = 0, weight = 0 }, -- movement_strafe
[6] = { cycle = 0, weight = 0 }, -- movement_strafechange
[7] = { cycle = 0, weight = 0 }, -- whole_body
[8] = { cycle = 0, weight = 0 }, -- flashed
[9] = { cycle = 0, weight = 0 }, -- flinch
[10] = { cycle = 0, weight = 0 }, -- aliveloop
[11] = { cycle = 0, weight = 0 }, -- jump
[12] = { cycle = 0, weight = 0 }, -- land
[13] = { cycle = 0, weight = 0 }, -- move_blend_walk
[14] = { cycle = 0, weight = 0 }, -- move_blend_run
[15] = { cycle = 0, weight = 0 }, -- move_blend_crouch
},
server_states = {}
}
local function lerp(a, b, t)
return a + (b - a) * t
end
animation_fix.setup_command = function(cmd)
local me = entity.get_local_player()
if not me then return end
local self_index = entity_extended.new(me)
if not self_index:get_anim_state() then return end
local current_time = globals.tickcount()
local vel_x, vel_y = entity.get_prop(me, 'm_vecVelocity')
local velocity = math.sqrt(vel_x * vel_x + vel_y * vel_y)
if current_time - animation_fix.anim_data.switch_time > slider:get() then
animation_fix.anim_data.choke_state = not animation_fix.anim_data.choke_state
animation_fix.anim_data.switch_time = current_time
end
local server_state = {
time = current_time,
velocity = velocity,
layers = {}
}
for i = 0, 15 do
local layer = self_index:get_anim_overlay(i)
if layer then
server_state.layers[i] = {
cycle = layer.cycle,
weight = layer.weight
}
end
end
table.insert(animation_fix.anim_data.server_states, server_state)
if #animation_fix.anim_data.server_states > 64 then
table.remove(animation_fix.anim_data.server_states, 1)
end
local fakelag_state = {
time = current_time,
velocity = velocity,
layers = server_state.layers,
choked = animation_fix.anim_data.choke_state
}
table.insert(animation_fix.anim_data.fakelag_states, fakelag_state)
if #animation_fix.anim_data.fakelag_states > 128 then
table.remove(animation_fix.anim_data.fakelag_states, 1)
end
end
animation_fix.pre_render = function()
local me = entity.get_local_player()
if not me then return end
local self_index = entity_extended.new(me)
if not self_index:get_anim_state() then return end
local states = animation_fix.anim_data.fakelag_states
local server_states = animation_fix.anim_data.server_states
if #states < 2 or #server_states < 2 then return end
local should_rebuild = slider:get() <= 2
if should_rebuild then
local current_time = globals.realtime()
local state1 = server_states[#server_states - 1]
local state2 = server_states[#server_states]
local t = (current_time - state1.time) / (state2.time - state1.time)
t = math.min(1, math.max(0, t))
for i = 0, 15 do
local layer = self_index:get_anim_overlay(i)
if layer and state1.layers[i] and state2.layers[i] then
layer.cycle = lerp(state1.layers[i].cycle, state2.layers[i].cycle, t)
layer.weight = lerp(state1.layers[i].weight, state2.layers[i].weight, t)
end
end
else
local reference_state = nil
for i = #states, 1, -1 do
if not states[i].choked then
reference_state = states[i]
break
end
end
if reference_state and animation_fix.anim_data.choke_state then
for i = 0, 15 do
local layer = self_index:get_anim_overlay(i)
if layer and reference_state.layers[i] then
layer.cycle = reference_state.layers[i].cycle
layer.weight = reference_state.layers[i].weight
end
end
end
end
end
end
client.set_event_callback('setup_command', animation_fix.setup_command)
client.set_event_callback('pre_render', animation_fix.pre_render)