- Статус
- Оффлайн
- Регистрация
- 1 Фев 2020
- Сообщения
- 1,323
- Реакции
- 518
code_language.lua:
-- t.me/debugoverlay
local ffi = require 'ffi'
ffi.cdef[[
typedef struct {
unsigned short type;
unsigned short needs_interpolate;
void* data;
void* watcher;
} varmap_entry_t;
]]
local slider = ui.create('Interpolation'):slider('Amount', 1, 14, 1)
local native_GetClientEntity = utils.get_vfunc('client.dll', 'VClientEntityList003', 3, 'void*(__thiscall*)(void*, int)')
local native_SetInterpolationAmount = utils.get_vfunc(2, 'void(__thiscall*)(void*, float)')
local interpolation = function(index, amount)
local entity_ptr = native_GetClientEntity(index)
if entity_ptr == nil then
return
end
local entity_addr = ffi.cast('uintptr_t', entity_ptr)
if entity_addr == nil then
return
end
local entries_ptr = ffi.cast('void**', entity_addr + 0x24)[0] -- varmapping -> offset 0x24
if entries_ptr == nil then
return
end
local interp_count = ffi.cast('int32_t*', entity_addr + 0x24 + 0x14)[0] -- varmapping_t -> interpolated_count
local entries = ffi.cast('varmap_entry_t*', entries_ptr)
for i = 0, interp_count do
local entry = entries[i]
local data_offset = ffi.cast('uintptr_t', entry.data) - entity_addr
if data_offset == 172 and entry.watcher ~= nil then -- origin ( 172 -> 0xAC )
native_SetInterpolationAmount(entry.watcher, globals.tickinterval * amount)
return
end
end
end
events.net_update_end:set(function()
local me = entity.get_local_player()
if me == nil then
return
end
entity.get_players(false, false, function(player)
if player ~= me then
local index = player:get_index()
interpolation(index, slider:get())
end
end)
end)