forked from ticzz/Aimware-v5-luas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomatic Resolver onoff.lua
132 lines (100 loc) · 4.51 KB
/
Automatic Resolver onoff.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
--[===[
Made by superyu'#7167
How it works:
We will loop through the entity list and check for packet choking, desync is done by choking and thus a desyncing player will choke packets.
If a player chokes packets the Simtime won't update, if we check if the simtime is equal to the last ticks simtime then the entity is choking packets.
We will use this information to enable/disable the resolver.
Thanks to corrada for finding critical bug.
--]===]
--- Gui Stuff
local pos = gui.Reference("Ragebot", "Aimbot", "Extra")
local enabled = gui.Checkbox(pos, "rbot_autoresolver", "Automatic Resolver", 0)
local warningEnabled = gui.Checkbox(pos, "rbot_autoresolver_warning", "Desync Warning", 0)
local listEnabled = gui.Checkbox(pos, "rbot_autoresolver_list", "Desync List", 0)
--- Tables.
local isDesyncing = {};
local lastSimtime = {};
local desyncCooldown = {};
--- Variables
local lastTick = 0;
local pLocal = entities.GetLocalPlayer();
local resolverTextCount = 0;
local sampleTextWidth, sampleTextHeight
--- Hooks
local function drawHook()
pLocal = entities.GetLocalPlayer();
if listEnabled:GetValue() then
if engine.GetMapName() ~= "" then
draw.Text(2, 400, gui.GetValue("rbot.accuracy.posadj.resolver") and "Desyncing Players - Resolver: On" or "Desyncing Players - Resolver: Off")
end
sampleTextWidth, sampleTextHeight = draw.GetTextSize("Sample Text")
end
if enabled:GetValue() then
resolverTextCount = 0;
for pEntityIndex, pEntity in pairs(entities.FindByClass("CCSPlayer")) do
if pEntity:GetTeamNumber() ~= pLocal:GetTeamNumber() and pEntity:IsPlayer() and pEntity:IsAlive() then
if globals.TickCount() > lastTick then
if lastSimtime[pEntityIndex] ~= nil then
if pEntity:GetProp("m_flSimulationTime") == lastSimtime[pEntityIndex] then
isDesyncing[pEntityIndex] = true;
desyncCooldown[pEntityIndex] = globals.TickCount();
else
if desyncCooldown[pEntityIndex] ~= nil then
if desyncCooldown[pEntityIndex] < globals.TickCount() - 128 then
isDesyncing[pEntityIndex] = false;
end
else
isDesyncing[pEntityIndex] = false;
end
end
end
lastSimtime[pEntityIndex] = pEntity:GetProp("m_flSimulationTime")
end
if engine.GetMapName() ~= "" then
if isDesyncing[pEntityIndex] then
if listEnabled:GetValue() then
local pos = 410 + (sampleTextHeight * resolverTextCount)
draw.Text(2, pos, pEntity:GetName())
end
resolverTextCount = resolverTextCount+1
end
end
end
end
lastTick = globals.TickCount();
if resolverTextCount ~= 0 then
gui.SetValue("rbot.accuracy.posadj.resolver", 1);
else
gui.SetValue("rbot.accuracy.posadj.resolver", 0);
end
end
end
local function aimbotTargetHook(pEntity)
if enabled:GetValue() then
if not isDesyncing[pEntity:GetIndex()] then
gui.SetValue("rbot.accuracy.posadj.resolver", 0);
else
gui.SetValue("rbot.accuracy.posadj.resolver", 1);
end
end
end
local function drawEspHook(builder)
if warningEnabled:GetValue() then
local pEntity = builder:GetEntity()
if pEntity:IsPlayer() and pEntity:IsAlive() and pEntity:GetTeamNumber() ~= pLocal:GetTeamNumber() then
if isDesyncing[pEntity:GetIndex()] then
builder:Color(255, 25, 25, 255)
builder:AddTextBottom("Desync")
else
builder:Color(255, 255, 25, 255)
builder:AddTextBottom("No Desync")
end
end
end
end
--- Callbacks
callbacks.Register("Draw", drawHook)
callbacks.Register("AimbotTarget", aimbotTargetHook)
callbacks.Register("DrawESP", drawEspHook)
--***********************************************--
print("♥♥♥ " .. GetScriptName() .. " loaded without Errors ♥♥♥")