local bit = require("bit")
local ffi = require("ffi")
local client = client
ffi.cdef[[
typedef struct {
char pad_0[0x14];
int m_nFlags;
char pad_1[0x10];
void* m_pParent;
int m_nValue;
float m_fValue;
char* m_pszString;
} ConVar;
]]
local original_flags, original_nValue, original_fValue
local sv_cheats_ptr
local function bypass_cheat_protection()
local ICvar = client.create_interface("vstdlib.dll", "VEngineCvar007")
if not ICvar then return end
local find_var = ffi.cast("void*(__thiscall*)(void*, const char*)", ffi.cast("void***", ICvar)[0][15])
sv_cheats_ptr = ffi.cast("ConVar*", find_var(ICvar, "sv_cheats"))
if not sv_cheats_ptr then return end
original_flags = sv_cheats_ptr.m_nFlags
original_nValue = sv_cheats_ptr.m_nValue
original_fValue = sv_cheats_ptr.m_fValue
sv_cheats_ptr.m_nFlags = bit.band(sv_cheats_ptr.m_nFlags, bit.bnot(0x8000))
sv_cheats_ptr.m_nValue = 1
sv_cheats_ptr.m_fValue = 1.0
client.log("sv_cheats bypass hardcoded by notpilesos")
end
local function restore_original_values()
if sv_cheats_ptr then
sv_cheats_ptr.m_nFlags = original_flags
sv_cheats_ptr.m_nValue = original_nValue
sv_cheats_ptr.m_fValue = original_fValue
client.log("Original values restored")
end
end
local function on_shutdown()
pcall(restore_original_values)
end
client.set_event_callback("shutdown", on_shutdown)
pcall(bypass_cheat_protection)