forked from ticzz/Aimware-v5-luas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AntiServerCrasher[MM].lua
60 lines (42 loc) · 2.03 KB
/
AntiServerCrasher[MM].lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---modified by Csmit195 for NiggaFish47
--Og credits to meeoww or his profile (https://aimware.net/forum/user/394521)
--OG thread https://aimware.net/forum/thread/153961
ffi.cdef[[
typedef void*(__thiscall* getnetchannel_t)(void*); // engineclient 78
typedef void(__thiscall* set_timeout_t)(void*, float, bool); // netchan 31
typedef void* (__cdecl* tCreateInterface)(const char* name, int* returnCode);
void* GetProcAddress(void* hModule, const char* lpProcName);
void* GetModuleHandleA(const char* lpModuleName);
]]
local function GetInterface(dll_name, interface_name)
local CreateInterface = ffi.cast("tCreateInterface", ffi.C.GetProcAddress(ffi.C.GetModuleHandleA(dll_name), "CreateInterface"));
local interface = CreateInterface(interface_name, ffi.new("int*"));
return interface;
end
local engineclient = ffi.cast(ffi.typeof("void***"), GetInterface("engine.dll", "VEngineClient014"));
local getnetchannel = ffi.cast("getnetchannel_t", engineclient[0][78]);
local netchannel = {}
do
function vfunc_wrapper(type, index)
return function(...)
-- only did this for netchannel, you can probably extend it to make it a proper wrapper
local netchannel = ffi.cast(ffi.typeof("void***"), getnetchannel(engineclient));
local fn = ffi.cast(type, netchannel[0][index]);
return fn(netchannel, ...);
end
end
netchannel.set_timeout = vfunc_wrapper("void(__thiscall*)(void*, float, bool)", 31);
end
gui.Button(gui.Reference("Misc", "General", "Bypass"), "Anticrash", function()
if not engine.GetServerIP() then return end;
netchannel.set_timeout(3600, true);
end);
local function player_connect_full( Event )
if ( Event:GetName() == 'player_connect_full' ) then
netchannel.set_timeout(3600, true)
end
end
client.AllowListener( 'player_connect_full' )
callbacks.Register( 'FireGameEvent', 'AWKS', player_connect_full )
--***********************************************--
print("♥♥♥ " .. GetScriptName() .. " loaded without Errors ♥♥♥")