-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathUniversalOffset.lua
132 lines (104 loc) · 3.89 KB
/
UniversalOffset.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
--// supg's universal cursor offset //--
--// Vars
local Lib = loadstring(dx9.Get("https://raw.githubusercontent.com/soupg/DXLibUI/main/main.lua"))()
local debug = false
--// Release Recalibrate / Blacklist
if Lib.Key == "[F5]" and _G.supg ~= nil then
Lib:Notify("Recalibrating...", 2, {255,255,100})
if _G.supg.Offset ~= nil and not debug then _G.offset_blacklist[_G.supg.Offset] = true end
_G.supg = nil
end
--// Debug Blacklist
if Lib.Key == "[F6]" and _G.supg ~= nil and debug then
if _G.supg.Offset ~= nil then
_G.offset_blacklist[_G.supg.Offset] = true
Lib:Notify("Blacklisted Offset: "..dx9.GetName(_G.supg.Offset).." | ".._G.supg.Offset, 5, {255,100,100})
_G.supg = nil
else
Lib:Notify("Nothing to blacklist!", 2, {255,0,0})
end
end
--// Creating Globals
if _G.supg == nil then
_G.supg = {
Offset = nil,
OldMouse = nil,
OldPos = {},
}
end
if _G.offset_blacklist == nil then
_G.offset_blacklist = {}
end
local Offset = _G.supg.Offset
local OldMouse = _G.supg.OldMouse
local OldPos = _G.supg.OldPos
if Offset == nil then
--// Get Descendants (which are image lables)
function GetDescendants(instance)
local children = {}
--// Checks if v is imagelabel and is near mouse
function FovCheck(v)
if dx9.GetImageLabelPosition(v) then
local v = dx9.GetImageLabelPosition(v)
local x = (dx9.GetMouse().x - v.x) * (dx9.GetMouse().x - v.x)
local y = (dx9.GetMouse().y - v.y) * (dx9.GetMouse().y - v.y)
if math.floor(math.sqrt(x + y)) < 500 then
return true
end
end
return false
end
--// Loops through descendants
for _, child in ipairs(dx9.GetChildren(instance)) do
if FovCheck(child) and not _G.offset_blacklist[child] then table.insert(children, child) end
if #dx9.GetChildren(child) > 0 then
for i,v in pairs(GetDescendants(child)) do
if FovCheck(v) and not _G.offset_blacklist[v] then table.insert(children, v) end
end
end
end
--// Returns descendants
return children
end
end
if Offset == nil and OldMouse ~= nil then
dx9.SetAimbotValue("x", 0)
dx9.SetAimbotValue("y", 0)
for i,v in next, OldPos do
if (dx9.GetImageLabelPosition(i).x ~= v.x or dx9.GetImageLabelPosition(i).y ~= v.y) and (OldMouse.x - dx9.GetMouse().x == v.x - dx9.GetImageLabelPosition(i).x) and (OldMouse.y - dx9.GetMouse().y == v.y - dx9.GetImageLabelPosition(i).y) then
if debug then Lib:Notify("Crosshair: "..dx9.GetName(i).." | Pos: "..v.x..", "..v.y, 5, {100,255,100}) else Lib:Notify("Crosshair Found: "..dx9.GetName(i).." | Press [F5] to blacklist offset and recalibrate", 5, {100,255,100}) end
Offset = i
break
end
end
elseif Offset ~= nil then
--// Adjusting Aim if cursor detected
local pos = dx9.GetImageLabelPosition(Offset)
dx9.SetAimbotValue("x", pos.x - dx9.GetMouse().x)
dx9.SetAimbotValue("y", pos.y - dx9.GetMouse().y)
else
dx9.SetAimbotValue("x", 0)
dx9.SetAimbotValue("y", 0)
end
if Offset == nil then
--// Storing Values
OldMouse = dx9.GetMouse()
--local reset = true
for _,v in pairs(GetDescendants(dx9.FindFirstChildOfClass(dx9.FindFirstChild(dx9.FindFirstChildOfClass(dx9.GetDatamodel(), "Players"), dx9.get_localplayer().Info.Name), "PlayerGui"))) do
--if Offset ~= nil and v == Offset then reset = false end
OldPos[v] = dx9.GetImageLabelPosition(v)
end
end
_G.supg.Offset = Offset
_G.supg.OldMouse = OldMouse
_G.supg.OldPos = OldPos
--// Debug
if debug then
Log("DEBUG ENABLED")
Log("")
Log("Blacklisted Offsets:")
for i,v in pairs(_G.offset_blacklist) do
Log(dx9.GetName(i))
end
Log("---")
end