forked from zzerexx/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUniversalEspPerformance.lua
More file actions
364 lines (344 loc) · 9.82 KB
/
UniversalEspPerformance.lua
File metadata and controls
364 lines (344 loc) · 9.82 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
if game.GameId == 1168263273 then
game:GetService("StarterGui"):SetCore("SendNotification",{
Title = "Universal Esp",
Text = "Universal Esp is detected on Bad Business! Please use a different script to prevent getting banned.",
Duration = 5
})
return
end
for _,v in next, getconnections(game:GetService("ScriptContext").Error) do
v:Disable()
end
if not Drawing then
game:GetService("Players").LocalPlayer:Kick("\n\nUniversal Esp\nYour exploit does not have a Drawing Library!\n")
return
end
if UESP then
UESP:Destroy()
end
local ZIndexEnabled = pcall(function()
local a = Drawing.new("Square")
a.Visible = false
task.delay(0.1,function()
a:Remove()
end)
a.ZIndex = 1
end)
local players = game:GetService("Players")
local player = players.LocalPlayer
local camera = workspace.CurrentCamera
local uis = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Drawingnew = Drawing.new
local Fonts = Drawing.Fonts
local tableinsert = table.insert
local WorldToViewportPoint = camera.WorldToViewportPoint
local CFramenew = CFrame.new
local Vector2new = Vector2.new
local fromRGB = Color3.fromRGB
local mathfloor = math.floor
local lower = string.lower
local osclock = os.clock
local next = next
local typeof = typeof
local FindFirstChild = game.FindFirstChild
local GetMouseLocation = uis.GetMouseLocation
local GameId = game.GameId
local OBJECTS, VISIBLE, ID = {}, true, 0
local gids = { -- game ids
['arsenal'] = 111958650,
['pf'] = 113491250,
['pft'] = 115272207, -- pf test place
['pfu'] = 1256867479, -- pf unstable branch
['bb'] = 1168263273,
}
local zindex = {
['Boxes'] = 1,
['Names'] = 2
}
local omega, beta, black = fromRGB(255,116,38), fromRGB(38,125,255), fromRGB(0,0,0)
local getchar, gethealth, ts, characters, teams
if GameId == (gids.pf or gids.pft or gids.pfu) then
for _,v in next, getgc(true) do
if typeof(v) == "table" and rawget(v, "getbodyparts") then
getchar = rawget(v, "getbodyparts")
elseif typeof(v) == "table" and rawget(v, "getplayerhealth") then
gethealth = rawget(v, "getplayerhealth")
end
end
elseif GameId == gids.bb then
for _,v in next, getgc(true) do
if typeof(v) == "table" and rawget(v, "InitProjectile") and rawget(v, "TS") then
ts = rawget(v, "TS")
characters = ts.Characters
teams = ts.Teams
end
end
end
local oldfuncs = {}
function IsAlive(plr)
local humanoid = FindFirstChild(plr.Character or game, "Humanoid")
if plr.Character and humanoid and humanoid.Health > 0 then
return true
elseif getchar then
return getchar(plr) ~= nil
elseif ts then
return characters:GetCharacter(plr) ~= nil
end
return false
end
oldfuncs.alive = IsAlive
function GetChar(plr)
if getchar then
local a = getchar(plr)
if a ~= nil then
return a.torso.Parent
end
elseif ts then
return characters:GetCharacter(plr)
elseif plr.Character ~= nil then
return plr.Character
end
return nil
end
oldfuncs.character = GetChar
function GetHealth(plr)
local a = plr.Character
local humanoid = FindFirstChild(a or game, "Humanoid")
if gethealth then
return {mathfloor(gethealth(plr,plr)),100}
elseif ts then
a = characters:GetCharacter(plr)
if FindFirstChild(a, "Health") then
return {mathfloor(a.Health.Value), mathfloor(a.Health.MaxHealth.Value)}
end
elseif GameId == gids.arsenal then
a = plr.NRPBS
return {mathfloor(a.Health.Value), mathfloor(a.MaxHealth.Value)}
elseif a ~= nil and humanoid then
return {mathfloor(humanoid.Health), mathfloor(humanoid.MaxHealth)}
end
return {100,100}
end
oldfuncs.health = GetHealth
function GetTeam(plr)
if ts then
return teams:GetPlayerTeam(plr)
end
return plr.Team
end
oldfuncs.team = GetTeam
function IsFFA()
local t = {}
for _,v in next, players:GetPlayers() do
if v.Team == nil then return true end
local team = v.Team.Name
if not t[team] then
tableinsert(t, team)
end
end
return #t == 1
end
function ApplyZIndex(obj,name)
if ZIndexEnabled then
local idx = zindex[name]
for _,v in next, obj do
v.ZIndex = idx
end
end
end
function SetProp(obj,prop,value)
for _,v in next, obj do
v[prop] = value
end
end
function ternary(condition,val1,val2)
if condition then
return val1
end
return val2
end
function Box(plr)
ID += 1
local type = "Boxes"
local objects = {
Box = Drawingnew("Quad"),
Outline = Drawingnew("Quad")
}
SetProp(objects, "Visible", false)
SetProp(objects, "Filled", false)
objects.Box.Thickness = 1
objects.Outline.Thickness = 3
ApplyZIndex(objects, type)
objects.Outline.ZIndex = 0
local a = {Object = objects, Type = type, Player = plr, Destroyed = false, Id = ID}
function a:Remove()
if a.Destroyed then return end
objects.Box:Remove()
objects.Outline:Remove()
a.Destroyed = true
end
OBJECTS[ID] = a
end
function Name(plr)
ID += 1
local type = "Names"
local objects = {
Name = Drawingnew("Text"),
Data = Drawingnew("Text")
}
SetProp(objects, "Visible", false)
SetProp(objects, "Center", true)
SetProp(objects, "Outline", true)
SetProp(objects, "OutlineColor", black)
SetProp(objects, "Font", Fonts.UI)
ApplyZIndex(objects, type)
local a = {Object = objects, Type = type, Player = plr, Destroyed = false, Id = ID}
function a:Remove()
if a.Destroyed then return end
objects.Name:Remove()
objects.Data:Remove()
a.Destroyed = true
end
OBJECTS[ID] = a
end
local lastupdate = osclock()
function update()
if osclock() - lastupdate < 0.01 then
return
end
lastupdate = osclock()
for _,v in next, OBJECTS do
if not v.Destroyed then
if v.Player == nil then
v:Remove()
end
local plr, obj, type = v.Player, v.Object, v.Type -- objects shit
local cf, size, mid, inViewport, tl, tr, bl, br -- boxes shit
local tlx, tly, trx, try, blx, bly, brx, bry -- boxes corner axes shit
local team, myteam, teamcolor -- team shit
local ffa, ccf, char, health, maxhealth, mag, mousemag, render -- other shit
if VISIBLE and plr and IsAlive(plr) then
local hp = GetHealth(plr)
ffa, ccf, char, health, maxhealth = IsFFA(), camera.CFrame.Position, GetChar(plr), hp[1], hp[2]
cf, size = char:GetBoundingBox()
team, myteam, teamcolor = GetTeam(plr), GetTeam(player), plr.TeamColor.Color
mag = (ccf - cf.Position).Magnitude
render = ffa or (not ffa and team ~= myteam) and mag <= 300
if render then
size /= 2
local x, y = size.X, size.Y
mid, inViewport = WorldToViewportPoint(camera, cf.Position)
tl = WorldToViewportPoint(camera, (cf * CFramenew(-x, y, 0)).Position)
tr = WorldToViewportPoint(camera, (cf * CFramenew( x, y, 0)).Position)
bl = WorldToViewportPoint(camera, (cf * CFramenew(-x, -y, 0)).Position)
br = WorldToViewportPoint(camera, (cf * CFramenew( x, -y, 0)).Position)
tlx, tly = tl.X, tl.Y
trx, try = tr.X, tr.Y
blx, bly = bl.X, bl.Y
brx, bry = br.X, br.Y
mousemag = (GetMouseLocation(uis) - Vector2new(mid.X, mid.Y)).Magnitude
end
end
if VISIBLE then
if plr and IsAlive(plr) then
SetProp(obj, "Visible", render)
if inViewport and render then
local color = (ts and team == "Omega" and omega or team == "Beta" and beta) or teamcolor
local transparency = (mousemag <= 75 and 0.25) or 1
SetProp(obj, "Transparency", transparency)
SetProp(obj, "Color", color)
if type == "Boxes" then
local box, out = obj.Box, obj.Outline
local A = Vector2new(trx, try)
local B = Vector2new(tlx, tly)
local C = Vector2new(blx, bly)
local D = Vector2new(brx, bry)
box.PointA = A
box.PointB = B
box.PointC = C
box.PointD = D
out.Color = black
out.PointA = A
out.PointB = B
out.PointC = C
out.PointD = D
elseif type == "Names" then
local name, data = obj.Name, obj.Data
local h,l = (tly > try and tly) or try, (tly < try and tly) or try
name.Position = Vector2new(tlx + (trx - tlx) / 2, (h + (l - h) / 2) - 20)
data.Position = Vector2new(blx + (brx - blx) / 2, bly + (bry - bly) / 2)
name.Text = plr.Name
data.Text = "[ "..mathfloor((health / maxhealth) * 100).."% ]"
end
end
end
if not inViewport then
SetProp(obj, "Visible", false)
end
else
SetProp(obj, "Visible", false)
end
end
end
end
local conn2 = RunService.RenderStepped:Connect(update)
local conn3 = uis.InputBegan:Connect(function(i,gp)
if not gp and i.KeyCode == Enum.KeyCode.RightAlt then
VISIBLE = not VISIBLE
end
end)
function doshit(v)
Box(v)
Name(v)
end
for _,v in next, players:GetPlayers() do
if v ~= player then
doshit(v)
end
end
local conn4 = players.PlayerAdded:Connect(doshit)
local esp = {}
local destroyed = false
function esp:SetFunction(a,f)
assert(typeof(a) == "string",("Universal Esp: bad argument to #1 'SetFunction' (string expected, got %s)"):format(typeof(a)))
assert(typeof(f) == "function",("Universal Esp: bad argument to #2 'SetFunction' (function expected, got %s)"):format(typeof(f)))
a = lower(a)
assert(oldfuncs[a] ~= nil,"Universal Esp: bad argument to #1 'SetFunction' (invalid function)")
if a == "alive" then -- ik it looks like shit stfu
IsAlive = f
elseif a == "character" then
GetChar = f
elseif a == "health" then
GetHealth = f
elseif a == "team" then
GetTeam = f
end
end
function esp:ResetFunction(a)
assert(typeof(a) == "string",("Universal Esp: bad argument to #1 'SetFunction' (string expected, got %s)"):format(typeof(a)))
a = lower(a)
assert(oldfuncs[a] ~= nil,"Universal Esp: bad argument to #1 'SetFunction' (invalid function)")
local f = oldfuncs[a]
if a == "alive" then
IsAlive = f
elseif a == "character" then
GetChar = f
elseif a == "health" then
GetHealth = f
elseif a == "team" then
GetTeam = f
end
end
function esp:Destroy()
if destroyed then return end
conn2:Disconnect()
conn3:Disconnect()
conn4:Disconnect()
for _,v in next, OBJECTS do
v:Remove()
end
destroyed = true
end
getgenv().UESP = esp
return esp