-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.lua
More file actions
757 lines (629 loc) · 20.3 KB
/
source.lua
File metadata and controls
757 lines (629 loc) · 20.3 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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
-- custom version of ui lib
local ui = loadstring(game:HttpGet("https://raw.githubusercontent.com/kitodoescode/Bracket/main/BracketV34.lua"))()
-- game objects/services
local players = game:GetService("Players")
local runservice = game:GetService("RunService")
local camera = workspace.CurrentCamera
configuration = {
visuals = {
masterswitch = false,
checks = {
client = false,
dead = false,
team = false,
neutral_as_enemy = false,
visible = false,
distance = false,
health = false,
max_dist = 1000,
min_health = 20,
},
box = {
enabled = false,
outline = false,
color = Color3.new(134, 86, 255),
},
name = {
enabled = false,
outline = false,
color = Color3.new(156, 117, 255),
},
distance = {
enabled = false,
outline = false,
color = Color3.new(156, 117, 255),
},
skeleton = {
enabled = false,
outline = false,
color = Color3.new(134, 86, 255),
dots = {
enabled = false,
outline = false,
color = Color3.new(134, 86, 255),
}
}
}
}
-- our local vars
local esp_objects = {}
local date = os.date("%d-%m-%y")
local last
local lp = players.LocalPlayer
local lp_char = lp.Character
local bone_connections_r6 = {
{"Head", "Torso"},
{"Torso", "Right Arm"},
{"Torso", "Left Arm"},
{"Torso", "Right Leg"},
{"Torso", "Left Leg"}
}
local bone_connections_r15 = {
{"Head", "UpperTorso"},
{"UpperTorso", "LowerTorso"},
{"LowerTorso", "LeftUpperLeg"},
{"LowerTorso", "RightUpperLeg"},
{"LeftUpperLeg", "LeftLowerLeg"},
{"LeftLowerLeg", "LeftFoot"},
{"RightUpperLeg", "RightLowerLeg"},
{"RightLowerLeg", "RightFoot"},
{"UpperTorso", "LeftUpperArm"},
{"UpperTorso", "RightUpperArm"},
{"LeftUpperArm", "LeftLowerArm"},
{"LeftLowerArm", "LeftHand"},
{"RightUpperArm", "RightLowerArm"},
{"RightLowerArm", "RightHand"}
}
local all_bones_r6 = {
"Head",
"Torso",
"Right Arm",
"Left Arm",
"Right Leg",
"Left Leg"
}
local all_bones_r15 = {
"Head",
"UpperTorso",
"LowerTorso",
"RightUpperLeg",
"LeftUpperLeg",
"RightLowerLeg",
"LeftLowerLeg",
"RightFoot",
"LeftFoot",
"RightUpperArm",
"LeftUpperArm",
"RightLowerArm",
"LeftLowerArm",
"RightHand",
"LeftHand"
}
-- helper for ui toggle colorpickers
local function color3_to_hsvar(col3: Color3)
h, s, v = col3:ToHSV()
return { h, s, v, 0, false }
end
local window = ui:Window({Name = "eternal | @kitodoescode"})
do
local watermark =
window:Watermark(
{
Title = "eternal | @kitodoescode | " .. date,
Enabled = true,
Fixed = true -- custom
}
)
last = tick()
runservice.Heartbeat:Connect(
function()
-- update date ( checking every one second )
local curr = tick()
if curr - last >= 1 then
date = os.date("%d-%m-%y")
watermark.Title = "eternal | @kitodoescode | " .. date
end
end
)
end
local vt = window:Tab({
Name = "visuals"
})
local basics = vt:Section({
Name = "basics",
})
basics:Toggle({
Name = "masterswitch",
Value = false,
Callback = function(val) configuration.visuals.masterswitch = val end
})
local bt = basics:Toggle({
Name = "Box",
Value = false,
Callback = function(val) configuration.visuals.box.enabled = val end
})
bt:Colorpicker({
Value = color3_to_hsvar(Color3.new(1, 1, 1)),
Callback = function(hsvar, col3) configuration.visuals.box.color = col3 end
})
basics:Toggle({
Name = "Box Outline",
Value = false,
Callback = function(val) configuration.visuals.box.outline = val end
})
local nt = basics:Toggle({
Name = "Name",
Value = false,
Callback = function(val) configuration.visuals.name.enabled = val end
})
nt:Colorpicker({
Value = color3_to_hsvar(Color3.new(1, 1, 1)),
Callback = function(hsvar, col3) configuration.visuals.name.color = col3 end
})
basics:Toggle({
Name = "Name Outline",
Value = false,
Callback = function(val) configuration.visuals.name.outline = val end
})
local dt = basics:Toggle({
Name = "Distance",
Value = false,
Callback = function(val) configuration.visuals.distance.enabled = val end
})
dt:Colorpicker({
Value = color3_to_hsvar(Color3.new(1, 1, 1)),
Callback = function(hsvar, col3) configuration.visuals.distance.color = col3 end
})
basics:Toggle({
Name = "Distance Outline",
Value = false,
Callback = function(val) configuration.visuals.distance.outline = val end
})
local st = basics:Toggle({
Name = "Skeleton",
Value = false,
Callback = function(val) configuration.visuals.skeleton.enabled = val end
})
st:Colorpicker({
Value = color3_to_hsvar(Color3.new(1, 1, 1)),
Callback = function(hsvar, col3) configuration.visuals.skeleton.color = col3 end
})
basics:Toggle({
Name = "Skeleton Outline",
Value = false,
Callback = function(val) configuration.visuals.skeleton.outline = val end
})
local sdt = basics:Toggle({
Name = "Skeleton Dots",
Value = false,
Callback = function(val) configuration.visuals.skeleton.dots.enabled = val end
})
sdt:Colorpicker({
Value = color3_to_hsvar(Color3.new(1, 1, 1)),
Callback = function(hsvar, col3) configuration.visuals.skeleton.dots.color = col3 end
})
basics:Toggle({
Name = "Skeleton Dots Outline",
Value = false,
Callback = function(val) configuration.visuals.skeleton.dots.outline = val end
})
local st = window:Tab({
Name = "settings",
})
local checks = st:Section({
Name = "checks",
Side = "Left",
})
checks:Toggle({
Name = "Client Check",
Value = false,
Callback = function(val) configuration.visuals.checks.client = val end
})
checks:Toggle({
Name = "Dead Check",
Value = false,
Callback = function(val) configuration.visuals.checks.dead = val end
})
checks:Toggle({
Name = "Team Check",
Value = false,
Callback = function(val) configuration.visuals.checks.team = val end
})
local naet = checks:Toggle({
Name = "Neutral As Enemy",
Value = false,
Callback = function(val) configuration.visuals.checks.neutral_as_enemy = val end
})
naet:Tooltip("If you and another player are both in neutral team, this will make them be considered an enemy.")
checks:Toggle({
Name = "Visible Check",
Value = false,
Callback = function(val) configuration.visuals.checks.visible = val end
})
checks:Toggle({
Name = "Distance Check",
Value = false,
Callback = function(val) configuration.visuals.checks.distance = val end
})
checks:Toggle({
Name = "Health Check",
Value = false,
Callback = function(val) configuration.visuals.checks.health = val end
})
local dist = checks:Slider({
Name = "Distance Check Value",
Min = 0,
Max = 5000,
Value = 1000,
Precise = 1,
Callback = function(val)
configuration.visuals.checks.max_dist = val
end
})
dist:Tooltip("This is the maximum distance till which a player will be considered an enemy.")
local ht = checks:Slider({
Name = "Health Check Value",
Min = 0,
Max = 100,
Value = 20,
Precise = 1,
Callback = function(val)
configuration.visuals.checks.min_health = val
end
})
ht:Tooltip("This is the minimum health which is required for a player to be considered as an enemy.")
st:AddConfigSection("eternal", "Right")
-- helper for drawing objects
local function draw(type, options)
local obj = Drawing.new(type)
for n, v in pairs(options) do
obj[n] = v
end
return obj
end
-- helper for w2s obv
local function world_to_screen(world)
return camera:WorldToViewportPoint(world)
end
local function is_visible(player)
local char = player.Character
if not char then return false end
local any_visible = false
local origin = camera.CFrame.Position
local rp = RaycastParams.new()
rp.FilterType = Enum.RaycastFilterType.Exclude
rp.FilterDescendantsInstances = {char, lp_char}
for _, child in pairs(char:GetChildren()) do
if not child:IsA("BasePart") then continue end
local direction = child.Position - origin
local res = workspace:Raycast(origin, direction, rp)
if res == nil then any_visible = true break end
end
return any_visible
end
local function get_player_bounds(player)
local char = player and player.Character
if not char then return false end
local vertices = {
Vector3.new(1,1,1), Vector3.new(1,1,-1), Vector3.new(1,-1,1),
Vector3.new(1,-1,-1), Vector3.new(-1,1,1), Vector3.new(-1,1,-1),
Vector3.new(-1,-1,1), Vector3.new(-1,-1,-1)
}
local min_x = math.huge
local min_y = math.huge
local max_x = -math.huge
local max_y = -math.huge
local valid = false
for _, child in ipairs(char:GetChildren()) do
if not child:IsA("BasePart") then continue end
local cf = child.CFrame
local sz = child.Size
for _, v in vertices do
local world = cf * Vector3.new(v.x * sz.x / 2, v.y * sz.y / 2, v.z * sz.z / 2)
local screen = world_to_screen(world)
min_x = math.min(min_x, screen.x)
min_y = math.min(min_y, screen.y)
max_x = math.max(max_x, screen.x)
max_y = math.max(max_y, screen.y)
valid = true
end
end
local top_left = Vector2.new(min_x, min_y)
local bottom_right = Vector2.new(max_x, max_y)
return valid, top_left, bottom_right
end
-- function to add esp objects and connections on a player
local function add_player_esp(player)
if esp_objects[player] then
return
end
local box = draw("Square", {
Visible = false,
Color = Color3.new(1, 1, 1),
Size = Vector2.new(0, 0),
Thickness = 1,
ZIndex = 4
})
local box_outline = draw("Square", {
Visible = false,
Color = Color3.new(0, 0, 0),
Size = Vector2.new(0, 0),
Thickness = 3,
ZIndex = 3
})
local name = draw("Text", {
Visible = false,
Color = Color3.new(1, 1, 1),
Text = player.Name,
Center = true,
Outline = true,
OutlineColor = Color3.new(0, 0, 0),
ZIndex = 4
})
local distance = draw("Text", {
Visible = false,
Color = Color3.new(1, 1, 1),
Text = "[ 0.0m ]",
Center = true,
Outline = true,
OutlineColor = Color3.new(0, 0, 0),
ZIndex = 4
})
local skeleton = {lines = {}, joints = {}, bone_connections = nil, bone_set = nil, rig_detected = false}
local objects = {box = box, box_outline = box_outline, name = name, distance = distance, skeleton = skeleton}
local function hide_esp_objects()
objects.box.Visible = false
objects.box_outline.Visible = false
objects.name.Visible = false
objects.distance.Visible = false
for _, bone_table in ipairs(objects.skeleton.lines) do
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
end
for _, joint_table in ipairs(objects.skeleton.joints) do
joint_table.dot.Visible = false
joint_table.outline.Visible = false
end
end
local connection =
runservice.RenderStepped:Connect(
function()
if not configuration.visuals.masterswitch then
hide_esp_objects()
return
end
local same_player = player == lp
if configuration.visuals.checks.client and same_player then
hide_esp_objects()
return
end
if configuration.visuals.checks.team and not same_player then
local lp_team = lp.Team
local p_team = player.Team
local same_team = p_team ~= nil and p_team == lp_team
if same_team then
hide_esp_objects()
return
end
local both_neutral = lp_team == nil and p_team == nil
if both_neutral and not configuration.visuals.checks.neutral_as_enemy then
hide_esp_objects()
return
end
end
local char = player.Character
if not char then
hide_esp_objects()
return
end
local humanoid = char and char:FindFirstChildOfClass("Humanoid")
if configuration.visuals.checks.dead and (not humanoid or humanoid.Health <= 0 or humanoid:GetState() == Enum.HumanoidStateType.Dead) then
hide_esp_objects()
return
end
if configuration.visuals.checks.health and humanoid.Health < configuration.visuals.checks.min_health then
hide_esp_objects()
return
end
local hrp = char and char:FindFirstChild("HumanoidRootPart")
local head = char and char:FindFirstChild("Head")
if not hrp or not head then
hide_esp_objects()
return
end
local our_pos
if not lp_char:FindFirstChild("HumanoidRootPart") then
our_pos = workspace.CurrentCamera.CFrame.Position
else
our_pos = lp_char.HumanoidRootPart.Position
end
local distance = (our_pos - hrp.Position).Magnitude
if configuration.visuals.checks.distance and distance > configuration.visuals.checks.max_dist then
hide_esp_objects()
return
end
if configuration.visuals.checks.visible and not is_visible(player) then
hide_esp_objects()
return
end
if not objects.skeleton.rig_detected then
local humanoid = char:FindFirstChild("Humanoid")
if humanoid.RigType == Enum.HumanoidRigType.R6 then
objects.skeleton.bone_connections = bone_connections_r6
objects.skeleton.bone_set = all_bones_r6
else
objects.skeleton.bone_connections = bone_connections_r15
objects.skeleton.bone_set = all_bones_r15
end
objects.skeleton.rig_detected = true
for idx, bone_joint in pairs(objects.skeleton.bone_connections) do
local from_bone, to_bone = bone_joint[1], bone_joint[2]
local joint = draw("Line", {
Visible = false,
Color = Color3.new(1, 1, 1),
Thickness = 1,
ZIndex = 2
})
local joint_outline = draw("Line", {
Visible = false,
Color = Color3.new(0, 0, 0),
Thickness = 3,
ZIndex = 1
})
objects.skeleton.lines[idx] = {
joint = joint,
joint_outline = joint_outline,
from_bone = from_bone,
to_bone = to_bone
}
end
for _, bone_name in pairs(objects.skeleton.bone_set) do
local dot = draw("Circle", {
Visible = false,
Color = Color3.new(1, 1, 1),
Thickness = 1,
Radius = 2,
Filled = true,
ZIndex = 4
})
local outline = draw("Circle", {
Visible = false,
Color = Color3.new(0, 0, 0),
Radius = 3,
Filled = true,
ZIndex = 3
})
table.insert(objects.skeleton.joints, {dot = dot, outline = outline, bone = bone_name})
end
end
local _, visible = world_to_screen(hrp.Position)
if not visible then
hide_esp_objects()
return
end
local head_pos, _ = world_to_screen(head.Position + Vector3.new(0, 0.5, 0))
--[[
local hrp_pos, _ = world_to_screen(hrp.Position - Vector3.new(0, 3, 0))
local w = math.abs(head_pos.y - hrp_pos.y) * 1.05
local h = math.abs(head_pos.y - hrp_pos.y) * 1.25
local top_left = Vector2.new(head_pos.x - (w / 2), hrp_pos.y - (h * 0.925))
]]
local valid, top_left, bottom_right = get_player_bounds(player)if not valid then
hide_esp_objects()
return
end
local w = bottom_right.x - top_left.x
local h = bottom_right.y - top_left.y
objects.box.Size = Vector2.new(w, h)
objects.box.Position = top_left
objects.box.Visible = configuration.visuals.box.enabled
objects.box.Color = configuration.visuals.box.color
objects.box_outline.Size = Vector2.new(w, h)
objects.box_outline.Position = top_left
objects.box_outline.Visible = configuration.visuals.box.outline
local top_center = Vector2.new(head_pos.x, top_left.y - 20)
objects.name.Position = top_center
objects.name.Visible = configuration.visuals.name.enabled
objects.name.Outline = configuration.visuals.name.outline
objects.name.Color = configuration.visuals.name.color
local bottom_center = Vector2.new(head_pos.x, top_left.y + h + 10)
objects.distance.Text = string.format("[ %.1fm ]", distance)
objects.distance.Position = bottom_center
objects.distance.Visible = configuration.visuals.distance.enabled
objects.distance.Outline = configuration.visuals.distance.outline
objects.distance.Color = configuration.visuals.distance.color
if objects.skeleton.rig_detected then
for _, bone_table in ipairs(objects.skeleton.lines) do
local from_bone, to_bone =
char:FindFirstChild(bone_table.from_bone),
char:FindFirstChild(bone_table.to_bone)
if not from_bone or not to_bone then
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
return
end
local from_pos, from_visibility = world_to_screen(from_bone.Position)
local to_pos, to_visibility = world_to_screen(to_bone.Position)
if not from_visibility or not to_visibility then
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
return
end
bone_table.joint.From = Vector2.new(from_pos.x, from_pos.y)
bone_table.joint.To = Vector2.new(to_pos.x, to_pos.y)
bone_table.joint.Visible = configuration.visuals.skeleton.enabled
bone_table.joint.Color = configuration.visuals.skeleton.color
bone_table.joint_outline.From = Vector2.new(from_pos.x, from_pos.y)
bone_table.joint_outline.To = Vector2.new(to_pos.x, to_pos.y)
bone_table.joint_outline.Visible = configuration.visuals.skeleton.outline
end
for _, joint_table in ipairs(objects.skeleton.joints) do
local bone = char:FindFirstChild(joint_table.bone)
if not bone then
joint_table.dot.Visible = false
joint_table.outline.Visiblie = false
end
local bone_pos, bone_visibility = world_to_screen(bone.Position)
if not bone_visibility then
joint_table.dot.Visible = false
joint_table.outline.Visible = false
end
joint_table.dot.Position = Vector2.new(bone_pos.x, bone_pos.y)
joint_table.dot.Visible = configuration.visuals.skeleton.dots.enabled
joint_table.dot.Color = configuration.visuals.skeleton.dots.color
joint_table.outline.Position = Vector2.new(bone_pos.x, bone_pos.y)
joint_table.outline.Visible = configuration.visuals.skeleton.dots.outline
end
end
end
)
local connections = {connection}
esp_objects[player] = {objects = objects, connections = connections}
end
-- function to remove esp objects and connections from player
local function remove_player_esp(player)
local player_table = esp_objects[player]
if not player_table then
return
end
for _, connection in pairs(player_table.connections) do
if connection.Connected then
connection:Disconnect()
end
end
for name, draw_object in pairs(player_table.objects) do
if name == "skeleton" then
for _, b in ipairs(player_table.objects.skeleton.lines) do
b.joint:Destroy()
b.joint_outline:Destroy()
end
for _, b in ipairs(player_table.objects.skeleton.joints) do
b.dot:Destroy()
b.outline:Destroy()
end
else
draw_object:Destroy()
end
end
player_table = nil
end
-- adding esp objects and connections on all current player
for _, p in pairs(players:GetPlayers()) do
add_player_esp(p)
end
-- add esp objects and connections on any new player that joined
players.PlayerAdded:Connect(
function(player)
player.CharacterAdded:Connect(
function()
add_player_esp(player)
end
)
end
)
-- remove esp objects and connections from any new player that left
players.PlayerRemoving:Connect(
function(player)
remove_player_esp(player)
end
)