Модератор раздела "Создание скриптов для читов"
-
Автор темы
- #1
code_language.lua:
--#region: client-side nickname
do
local native_BaseLocalClient_base = ffi.cast("uintptr_t**", utils.opcode_scan("engine.dll", "A1 ? ? ? ? 0F 28 C1 F3 0F 5C 80 ? ? ? ? F3 0F 11 45 ? A1 ? ? ? ? 56 85 C0 75 04 33 F6 EB 26 80 78 14 00 74 F6 8B 4D 08 33 D2 E8 ? ? ? ? 8B F0 85 F6", 1))
local player_info_t = ffi.typeof([[
struct {
int64_t unknown;
int64_t steamID64;
char szName[128];
int userId;
char szSteamID[20];
char pad_0x00A8[0x10];
unsigned long iSteamID;
char szFriendsName[128];
bool fakeplayer;
bool ishltv;
unsigned int customfiles[4];
unsigned char filesdownloaded;
}
]])
local native_GetStringUserData = utils.get_vfunc(11, ffi.typeof("$*(__thiscall*)(void*, int, int*)", player_info_t))
local previous_name = nil
local function apply_nickname(name)
local local_player = entity.get_local_player()
if not local_player then return end
local native_BaseLocalClient = native_BaseLocalClient_base[0][0]
if not native_BaseLocalClient then return end
local native_UserInfoTable = ffi.cast("void***", native_BaseLocalClient + 0x52C0)[0]
if not native_UserInfoTable then return end
local data = native_GetStringUserData(native_UserInfoTable, local_player:get_index() - 1, nil)
if not data then return end
local this_name = ffi.string(data[0].szName)
if name ~= this_name and previous_name == nil then
previous_name = this_name
end
ffi.copy(data[0].szName, name, #name + 1)
end
local was_applied = false
local function callback()
local chosen_nick = input:get():sub(0, 32)
input:set(chosen_nick)
if not checkbox:get() or #chosen_nick == 0 then
if was_applied then
was_applied = false
apply_nickname(previous_name or panorama.MyPersonaAPI.GetName())
previous_name = nil
end
return
end
was_applied = true
apply_nickname(chosen_nick)
end
checkbox:set_callback(callback)
callbacks.add("net_update_start", callback)
callbacks.add("net_update_end", callback)
callback()
end
--#region: end