-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
1154 lines (942 loc) · 51.2 KB
/
main.lua
File metadata and controls
1154 lines (942 loc) · 51.2 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
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--// DXLib //--
--// Presets for supg's smol brain to rember
local Game = dx9.GetDatamodel();
local Workspace = dx9.FindFirstChildOfClass(Game,"Workspace");
local Mouse = dx9.GetMouse();
local LocalPlayer = dx9.get_localplayer();
local Players = dx9.get_players()
local Screen = {
x = dx9.size().width;
y = dx9.size().height;
}
--// Initiating Library
if _G.dxl == nil then
_G.dxl = {
--// Console Vars
Location = {1000, 150}; -- Dynamic
Size = {dx9.size().width / 2.95, dx9.size().height / 1.21}; -- Static
FontColor = {255,255,255}; -- Static + [Changeable]
MainColor = {25,25,25}; -- Static + [Changeable]
BackgroundColor = {15,15,15}; -- Static + [Changeable]
AccentColor = {255,100,255}; -- Static + [Changeable]
OutlineColor = {40,40,40}; -- Static + [Changeable]
Black = {0,0,0}; -- Static
ErrorColor = {255,100,100};
WinMouseOffset = nil;
StoredLogs = {};
Open = true;
Hovering = false;
--// Storing older functions and stuff :3
LoadstringCaching = {};
GetCaching = {};
OldLoadstring = loadstring;
OldGet = dx9.Get;
OldPrint = print;
OldError = error;
--// Sleep
Threads = {};
--// Dragging
Dragging = false;
--// Character Stuff (saved for optimization)
PlayerFolder = nil;
--// Rainbow
CurrentRainbowColor = {255,255,255};
RainbowHue = 0;
};
end
--// Rainbow Tick
do
if dxl.RainbowHue > 1530 then
dxl.RainbowHue = 0
else
dxl.RainbowHue = dxl.RainbowHue + 3
end
if dxl.RainbowHue <= 255 then
dxl.CurrentRainbowColor = {255, dxl.RainbowHue, 0}
elseif dxl.RainbowHue <= 510 then
dxl.CurrentRainbowColor = {510 - dxl.RainbowHue, 255, 0}
elseif dxl.RainbowHue <= 765 then
dxl.CurrentRainbowColor = {0, 255, dxl.RainbowHue - 510}
elseif dxl.RainbowHue <= 1020 then
dxl.CurrentRainbowColor = {0, 1020 - dxl.RainbowHue, 255}
elseif dxl.RainbowHue <= 1275 then
dxl.CurrentRainbowColor = {dxl.RainbowHue - 1020, 0, 255}
elseif dxl.RainbowHue <= 1530 then
dxl.CurrentRainbowColor = {255, 0, 1530 - dxl.RainbowHue}
end
end
--// Threads (temp)
local ThreadCount = 0
function sleep(v, index)
ThreadCount = ThreadCount + 1
assert(type(v) == "number" and v >= 0, "[DXL Error] sleep: First Argument needs to be a number above 0!")
if v == 0 then
dxl.Threads[ThreadCount] = nil
--ThreadCount = ThreadCount - 1
return true
end
local total_seconds = (os.date("*t").hour * 3600) + (os.date("*t").min * 60) + (os.date("*t").sec)
if dxl.Threads[ThreadCount] == nil then
local largest_end = total_seconds
if index ~= nil then
for i,f in pairs(dxl.Threads) do
if f.Index == index then
if f.End > largest_end then
largest_end = f.End
end
end
end
end
dxl.Threads[ThreadCount] = {
End = largest_end + v;
Index = index;
}
else
if total_seconds >= dxl.Threads[ThreadCount].End then
dxl.Threads[ThreadCount] = nil
--ThreadCount = ThreadCount - 1
return true
end
end
return false
end
--[[
██████╗ █████╗ ███████╗██╗ ██████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗
██╔══██╗██╔══██╗██╔════╝██║██╔════╝ ██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝
██████╔╝███████║███████╗██║██║ █████╗ ██║ ██║██╔██╗ ██║██║ ███████╗
██╔══██╗██╔══██║╚════██║██║██║ ██╔══╝ ██║ ██║██║╚██╗██║██║ ╚════██║
██████╔╝██║ ██║███████║██║╚██████╗ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████║
╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝
]]
--// Not sure if each screen is a different size (dx9.size) so I'm using this to use % instead of Pixels to click / move to screen coords
function dxl.GetCoords(wts)
assert(type(wts) == "table" and #wts == 2, "[DXL Error] GetCoords: First Argument needs to be a table with 2 values!")
--// Divides my screen size by my input coords to get %, then turns the % into a screen coord that corisponds with the client's screen size
return {(Screen.x / (1920 / wts[1])), (Screen.y / (1017 / wts[2]))}
end
--[[
██████╗ ██████╗ ██╗ ██╗███╗ ██╗██████╗ █████╗ ██████╗ ██╗ ██╗ ██████╗██╗ ██╗███████╗ ██████╗██╗ ██╗
██╔══██╗██╔═══██╗██║ ██║████╗ ██║██╔══██╗██╔══██╗██╔══██╗╚██╗ ██╔╝ ██╔════╝██║ ██║██╔════╝██╔════╝██║ ██╔╝
██████╔╝██║ ██║██║ ██║██╔██╗ ██║██║ ██║███████║██████╔╝ ╚████╔╝ ██║ ███████║█████╗ ██║ █████╔╝
██╔══██╗██║ ██║██║ ██║██║╚██╗██║██║ ██║██╔══██║██╔══██╗ ╚██╔╝ ██║ ██╔══██║██╔══╝ ██║ ██╔═██╗
██████╔╝╚██████╔╝╚██████╔╝██║ ╚████║██████╔╝██║ ██║██║ ██║ ██║ ╚██████╗██║ ██║███████╗╚██████╗██║ ██╗
╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝
]]
function dxl.isMouseInArea(area)
assert(type(area) == "table" and #area == 4, "[DXL Error] isMouseInArea: First Argument needs to be a table with 4 values!")
if dx9.GetMouse().x > area[1] and dx9.GetMouse().y > area[2] and dx9.GetMouse().x < area[3] and dx9.GetMouse().y < area[4] then
return true
else
return false
end
end
--[[
██████╗ ███████╗████████╗ ██████╗ ██╗███████╗████████╗ █████╗ ███╗ ██╗ ██████╗███████╗
██╔════╝ ██╔════╝╚══██╔══╝ ██╔══██╗██║██╔════╝╚══██╔══╝██╔══██╗████╗ ██║██╔════╝██╔════╝
██║ ███╗█████╗ ██║ ██║ ██║██║███████╗ ██║ ███████║██╔██╗ ██║██║ █████╗
██║ ██║██╔══╝ ██║ ██║ ██║██║╚════██║ ██║ ██╔══██║██║╚██╗██║██║ ██╔══╝
╚██████╔╝███████╗ ██║ ██████╔╝██║███████║ ██║ ██║ ██║██║ ╚████║╚██████╗███████╗
╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝
]]
function dxl.GetDistance(v, i)
local v1 = {}
local v2 = {}
if type(i) == "table" then
if i['x'] ~= nil and i['y'] ~= nil and i['z'] ~= nil then
v1 = i
else
assert(type(i) == "table" and #i == 3, "[DXL Error] GetDistance: Second Argument needs to be a table with 3 values!")
v1['x'] = i[1]
v1['y'] = i[2]
v1['z'] = i[3]
end
elseif type(i) == "number" then
assert(type(i) == "number" and dx9.GetPosition(i), "[DXL Error] GetDistance: Second Argument needs to be a number (pointer)!")
v1 = dx9.GetPosition(i);
else
error("[DXL Error] GetDistance: Second Argument needs to be a table (with position values) or number (instance)!\n".. debug.traceback().."\n")
return;
end
if type(v) == "table" then
if v['x'] ~= nil and v['y'] ~= nil and v['z'] ~= nil then
v2 = v
else
assert(type(v) == "table" and #v == 3, "[DXL Error] GetDistance: First Argument needs to be a table with 3 values!")
v2['x'] = v[1]
v2['y'] = v[2]
v2['z'] = v[3]
end
elseif type(v) == "number" then
assert(type(v) == "number" and dx9.GetPosition(v), "[DXL Error] GetDistance: First Argument needs to be a number (pointer)!")
v2 = dx9.GetPosition(v);
else
error("[DXL Error] GetDistance: First Argument needs to be a table (with position values) or number (instance)!\n".. debug.traceback().."\n")
return;
end
local a = (v1.x-v2.x)*(v1.x-v2.x);
local b = (v1.y-v2.y)*(v1.y-v2.y);
local c = (v1.z-v2.z)*(v1.z-v2.z);
return math.floor(math.sqrt(a+b+c)+0.5);
end
--// Get Distance From Player
function dxl.GetDistanceFromPlayer(v)
return dxl.GetDistance(v, dx9.get_localplayer().Position)
end
--[[
██╗ ██╗███████╗ █████╗ ██╗ ████████╗██╗ ██╗██████╗ █████╗ ██████╗
██║ ██║██╔════╝██╔══██╗██║ ╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔══██╗
███████║█████╗ ███████║██║ ██║ ███████║██████╔╝███████║██████╔╝
██╔══██║██╔══╝ ██╔══██║██║ ██║ ██╔══██║██╔══██╗██╔══██║██╔══██╗
██║ ██║███████╗██║ ██║███████╗██║ ██║ ██║██████╔╝██║ ██║██║ ██║
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
{TargetPosition = {x, y, z}, Size = {x, y}, HP = hp, MaxHP = max_hp, Scale = false, Offset = {x, y}}
]]
function dxl.HealthBar(params)
--// Variable Insurance
local size = params.Size or {120, 5}
local size_x = size[1]
local size_y = size[2]
local maxhp = params.MaxHP or 100
local scale = params.Scale or false
local offset = params.Offset or {0,0}
--// Error Handling
local pos = {}
if params.TargetPosition.x and params.TargetPosition.y and params.TargetPosition.z and type(params.TargetPosition.x) == "number" and type(params.TargetPosition.y) == "number" and type(params.TargetPosition.z) == "number" then
pos = {params.TargetPosition.x, params.TargetPosition.y, params.TargetPosition.z}
elseif params.TargetPosition[1] and params.TargetPosition[2] and params.TargetPosition[3] and type(params.TargetPosition[1]) == "number" and type(params.TargetPosition[2]) == "number" and type(params.TargetPosition[3]) == "number" then
if #params.TargetPosition == 3 then
pos = {params.TargetPosition[1], params.TargetPosition[2], params.TargetPosition[3]}
else
error("[DXL Error] HealthBar: TargetPosition Argument needs to contain 3 number values! (x, y, z)\n".. debug.traceback().."\n")
return;
end
else
error("[DXL Error] HealthBar: TargetPosition Argument needs to contain 3 number values! (x, y, z)\n".. debug.traceback().."\n")
return;
end
assert(type(pos) == "table" and #pos == 3, "[DXL Error] HealthBar: TargetPosition Argument needs to be a table with 3 values!")
assert(type(params.HP) == "number", "[DXL Error] HealthBar: HP Argument needs to be a number!")
local hp = params.HP
if not scale then
local wts = dx9.WorldToScreen(pos);
local x = wts.x
local y = wts.y
--// A lot of math stuff, dont mess with it unless u know what ur doing
local temp = ((size_x - 2) / ( maxhp/math.max(0, math.min(maxhp, hp))));
dx9.DrawFilledBox({x - (size_x/2) + offset[1], y + offset[2]}, {x + (size_x/2) + offset[1], y - size_y + offset[2]}, {0,0,0});
dx9.DrawFilledBox({x - ((size_x/2) - 1) + offset[1], y - 1 + offset[2]}, {x - ((size_x/2) - 1) + temp + offset[1], y - (size_y - 1) + offset[2]}, {255 - 255 / (maxhp / hp), 255 / (maxhp / hp), 0});
else
size_x = size_x / 10
size_y = size_y / 10
--// AIDS BELOW (WATCH OUT) (WARNING) (DANGER)
local wts1 = dx9.WorldToScreen({pos[1] - (size_x/2), pos[2] - (size_y/2), pos[3]});
local wts2 = dx9.WorldToScreen({pos[1] + (size_x/2), pos[2] + (size_y/2), pos[3]});
--// A lot of math stuff, dont mess with it unless u know what ur doing
--local temp = ((size_x - 2) / ( maxhp/math.max(0, math.min(maxhp, hp))));
dx9.DrawFilledBox({wts1.x, wts1.y}, {wts2.x, wts2.y}, {0,0,0});
dx9.DrawFilledBox({wts1.x + 1, wts1.y - 1}, {wts2.x - 1 , wts2.y + 1}, {255 - 255 / (maxhp / hp), 255 / (maxhp / hp), 0});
end
end
--[[
██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗
╚════██╗██╔══██╗ ██╔══██╗██╔═══██╗╚██╗██╔╝
█████╔╝██║ ██║ ██████╔╝██║ ██║ ╚███╔╝
╚═══██╗██║ ██║ ██╔══██╗██║ ██║ ██╔██╗
██████╔╝██████╔╝ ██████╔╝╚██████╔╝██╔╝ ██╗
╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
]]
--// Huge thanks to Siydge#6955 for this
function dxl.Box3d(pos1, pos2, box_color)
--// Error Handling
assert(type(pos1) == "table" and #pos1 == 3, "[DXL Error] Box3d: First Argument needs to be a table with 3 position values!")
assert(type(pos2) == "table" and #pos2 == 3, "[DXL Error] Box3d: Second Argument needs to be a table with 3 position values!")
assert(type(box_color) == "table" and #box_color == 3, "[DXL Error] Box3d: Third Argument needs to be a table with 3 RGB values!")
local box_matrix = {
1,1,1,-1,1,1,
-1,1,1,-1,-1,1,
1,1,1,1,-1,1,
1,-1,1,-1,-1,1,
1,1,-1,1,1,1,
1,-1,-1,1,-1,1,
1,1,-1,1,-1,-1,
1,1,-1,-1,1,-1,
-1,-1,-1,-1,1,-1,
1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,1,
-1,1,-1,-1,1,1,
}
local x = pos1[1] - pos2[1]
local y = pos1[2] - pos2[2]
local z = pos1[3] - pos2[3]
local size = {x, y, z}
dx9.Box3d(box_matrix, {(pos1[1] + pos2[1]) / 2, (pos1[2] + pos2[2]) / 2, (pos1[3] + pos2[3]) / 2}, {0, 0, 0}, size, box_color)
end
--[[
██████╗ ██████╗ ██╗ ██╗██████╗ ██████╗
██╔══██╗██╔═══██╗╚██╗██╔╝╚════██╗██╔══██╗
██████╔╝██║ ██║ ╚███╔╝ █████╔╝██║ ██║
██╔══██╗██║ ██║ ██╔██╗ ██╔═══╝ ██║ ██║
██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
]]
function dxl.Box2d(pos_list, box_color)
--// Error Handling
assert(type(pos_list) == "table" and #pos_list == 4, "[DXL Error] Box3d: First Argument needs to be a table with 4 values!")
assert(type(box_color) == "table" and #box_color == 3, "[DXL Error] Box3d: Second Argument needs to be a table with 3 RGB values!")
assert(type(pos_list[1]) == "table" and #pos_list[1] == 3, "[DXL Error] Box3d: First Argument needs to be a table with 4 x,y,z values!")
assert(type(pos_list[2]) == "table" and #pos_list[2] == 3, "[DXL Error] Box3d: First Argument needs to be a table with 4 x,y,z values!")
assert(type(pos_list[3]) == "table" and #pos_list[3] == 3, "[DXL Error] Box3d: First Argument needs to be a table with 4 x,y,z values!")
assert(type(pos_list[4]) == "table" and #pos_list[4] == 3, "[DXL Error] Box3d: First Argument needs to be a table with 4 x,y,z values!")
local TL = dx9.WorldToScreen(pos_list[1])
local TR = dx9.WorldToScreen(pos_list[2])
local BL = dx9.WorldToScreen(pos_list[3])
local BR = dx9.WorldToScreen(pos_list[4])
dx9.DrawLine({TL.x, TL.y}, {TR.x, TR.y}, box_color) -- Top
dx9.DrawLine({BL.x, BL.y}, {BR.x, BR.y}, box_color) -- Bottom
dx9.DrawLine({TR.x, TR.y}, {BR.x, BR.y}, box_color) -- Right
dx9.DrawLine({BL.x, BL.y}, {TL.x, TL.y}, box_color) -- Left
end
--[[
██████╗ ██████╗ ██╗ ██╗ ███████╗███████╗██████╗
██╔══██╗██╔═══██╗╚██╗██╔╝ ██╔════╝██╔════╝██╔══██╗
██████╔╝██║ ██║ ╚███╔╝ █████╗ ███████╗██████╔╝
██╔══██╗██║ ██║ ██╔██╗ ██╔══╝ ╚════██║██╔═══╝
██████╔╝╚██████╔╝██╔╝ ██╗ ███████╗███████║██║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝
]]
--// BOX BoxESP
function dxl.BoxESP(params) -- params = {*Target = model, Color = {r,g,b}, Healthbar = false, Distance = false, Nametag = false, Tracer = false, TracerType = 1, BoxType = 1}
local target = params.Target or nil
local box_color = params.Color or {255,255,255}
local healthbar = params.Healthbar or false
local distance = params.Distance or false
local nametag = params.Nametag or false
local tracer = params.Tracer or false
local tracertype = params.TracerType or 1 --// 1 = near-bottom, 2 = bottom, 3 = top, 4 = mouse
local box_type = params.BoxType or 1 --// 1 = corners, 2 = 2d box, 3 = 3d box
--// Error Handling
assert(type(tracertype) == "number" and (tracertype == 1 or tracertype == 2 or tracertype == 3 or tracertype == 4), "[DXL Error] BoxESP: TracerType Argument needs to be a number! (1 - 4)")
assert(type(box_type) == "number" and (box_type == 1 or box_type == 2 or box_type == 3), "[DXL Error] BoxESP: BoxType Argument needs to be a number! (1 - 3)")
assert(type(target) == "number" and dx9.GetChildren(target) ~= nil, "[DXL Error] BoxESP: Target Argument needs to be a number (pointer) to character!")
assert(type(box_color) == "table" and #box_color == 3, "[DXL Error] BoxESP: Color Argument needs to be a table with 3 RGB values!")
if dx9.FindFirstChild(target, "HumanoidRootPart") and dx9.GetPosition(dx9.FindFirstChild(target, "HumanoidRootPart")) then
local torso = dx9.GetPosition(dx9.FindFirstChild(target, "HumanoidRootPart"))
local HeadPosY = torso.y + 2.5
local LegPosY = torso.y - 3.5
local Top = dx9.WorldToScreen({torso.x , HeadPosY, torso.z})
local Bottom = dx9.WorldToScreen({torso.x , LegPosY, torso.z})
local height = Top.y - Bottom.y
local width = (height / 2)
width = width / 1.2
--// Draw Box
if box_type == 1 then --// cormers
dx9.DrawLine({Top.x + width + 2, Top.y}, {Top.x + (width/2) + 2, Top.y}, box_color) -- TopLeft 1
dx9.DrawLine({Top.x + width + 2, Top.y}, {Top.x + width + 2, Top.y - (height/4)}, box_color) -- TopLeft 2
dx9.DrawLine({Bottom.x - width, Top.y}, {Bottom.x - (width/2), Top.y}, box_color) -- TopRight 1
dx9.DrawLine({Bottom.x - width, Top.y}, {Bottom.x - width, Top.y - (height/4)}, box_color) -- TopRight 2
dx9.DrawLine({Top.x + width + 2, Bottom.y}, {Top.x + (width/2) + 2, Bottom.y}, box_color) -- BottomLeft 1
dx9.DrawLine({Top.x + width + 2, Bottom.y}, {Top.x + width + 2, Bottom.y + (height/4)}, box_color) -- BottomLeft 2
dx9.DrawLine({Bottom.x - width, Bottom.y}, {Bottom.x - (width/2), Bottom.y}, box_color) -- BottomRight 1
dx9.DrawLine({Bottom.x - width, Bottom.y}, {Bottom.x - width, Bottom.y + (height/4)}, box_color) -- BottomRight 2
elseif box_type == 2 then
dx9.DrawBox({Bottom.x - width, Top.y}, {Top.x + width, Bottom.y}, box_color)
else
dxl.Box3d({torso.x - 2, HeadPosY, torso.z - 2}, {torso.x + 2, LegPosY, torso.z + 2}, box_color)
end
if healthbar then
if dx9.FindFirstChild(target, "Humanoid") then
local tl = {Top.x + width - 5, Top.y + 1}
local br = {Top.x + width - 1, Bottom.y - 1}
local humanoid = dx9.FindFirstChild(target, "Humanoid")
local hp = dx9.GetHealth(humanoid)
local maxhp = dx9.GetMaxHealth(humanoid)
--// A lot of math stuff, dont mess with it unless u know what ur doing
local addon = ( (height + 2) / ( maxhp/math.max(0, math.min(maxhp, hp))) )
dx9.DrawBox({tl[1] - 1, tl[2] - 1}, {br[1] + 1, br[2] + 1}, box_color) -- Outer
dx9.DrawFilledBox({tl[1], tl[2]}, {br[1], br[2]}, {0,0,0}) -- Inner Black
dx9.DrawFilledBox({tl[1] + 1, br[2] - 1}, {br[1] - 1, (br[2] + addon + 1) }, {255 - 255 / (maxhp / hp), 255 / (maxhp / hp), 0}) -- Inner
else
error("[DXL Error] BoxESP: Target has no humanoid, healthbar not added!")
end
end
if distance then
local dist = ""..dxl.GetDistanceFromPlayer(torso)
dx9.DrawString({Bottom.x - (dx9.CalcTextWidth(dist) / 2), Bottom.y}, box_color, dist)
end
if nametag then
local name = dx9.GetName(target)
dx9.DrawString({Top.x - (dx9.CalcTextWidth(name) / 2), Top.y - 20}, box_color, name)
end
if tracer then
local loc -- Location of tracer start
if tracertype == 1 then
loc = {dx9.size().width / 2, dx9.size().height / 1.1}
elseif tracertype == 2 then
loc = {dx9.size().width / 2, dx9.size().height}
elseif tracertype == 3 then
loc = {dx9.size().width / 2, 1}
else
loc = {dx9.GetMouse().x, dx9.GetMouse().y}
end
dx9.DrawLine(loc, {Top.x + width + (((Bottom.x - width) - (Top.x + width)) / 2), Bottom.y}, box_color)
end
else
error("[DXL Error] BoxESP: Passed in target has no HumanoidRootPart!")
end
end
--[[
██████╗ █████╗ ███╗ ███╗███████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗
██╔════╝ ██╔══██╗████╗ ████║██╔════╝ ██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝
██║ ███╗███████║██╔████╔██║█████╗ █████╗ ██║ ██║██╔██╗ ██║██║ ███████╗
██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ╚════██║
╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████║
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝
]]
function dxl.Game(...)
local a = dx9.GetDatamodel()
for c, d in pairs({...}) do
a = dx9.FindFirstChild(a, d)
end
return a
end
--// Troll Command
--[[
function dxl.Troll()
if sleep(3, "core1") then
dx9.MouseMove(dxl.GetCoords({20, 1040}))
dx9.Mouse1Click()
end
if sleep(1, "core1") then
dx9.MouseMove(dxl.GetCoords({20, 990}))
dx9.Mouse1Click()
end
if sleep(1, "core1") then
dx9.MouseMove(dxl.GetCoords({20, 910}))
--dx9.Mouse1Click()
end
end
]]
--// Get Descendants
function dxl.GetDescendants(instance)
assert(type(instance) == "number" and dx9.GetChildren(instance) ~= nil, "[DXL Error] GetDescendants: First Argument needs to be a number (pointer)!")
local children = {}
for _, child in ipairs(dx9.GetChildren(instance)) do
table.insert(children, child)
if #dx9.GetChildren(child) > 0 then
for i,v in pairs(dxl.GetDescendants(child)) do
table.insert(children, v)
end
end
end
return children
end
--// Get Descendants of Class
function dxl.GetDescendantsOfClass(instance, class)
assert(type(instance) == "number" and dx9.GetChildren(instance) ~= nil, "[DXL Error] GetDescendantsOfClass: First Argument needs to be a number (pointer)!")
assert(type(class) == "string", "[DXL Error] GetDescendantsOfClass: Second Argument needs to be a string (class name)!")
local children = {}
for i,v in pairs(dxl.GetDescendants(instance)) do
if dx9.GetType(v) == class then
table.insert(children, v)
end
end
return children
end
--// Get Closest Part
function dxl.GetClosestPart(target)
assert(type(target) == "number" and dx9.GetChildren(target) ~= nil, "[DXL Error] GetClosestPart: First Argument needs to be a number (pointer)!")
local closest_part
local valid_classes = {
Part = true;
MeshPart = true;
Accessory = true;
TrussPart = true;
WedgePart = true;
CornerWedgePart = true;
SpecialMesh = true;
BlockMesh = true;
};
for i,v in pairs(dxl.GetDescendants(target)) do
if valid_classes[dx9.GetType(v)] then
if closest_part == nil then
closest_part = v
end
if dxl.GetDistanceFromPlayer(dx9.GetPosition(v)) < dxl.GetDistanceFromPlayer(dx9.GetPosition(closest_part)) then
closest_part = v;
end
end
end
return closest_part;
end
--[[
██████╗ ██╗ █████╗ ██╗ ██╗███████╗██████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗
██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔══██╗ ██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝
██████╔╝██║ ███████║ ╚████╔╝ █████╗ ██████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ ███████╗
██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██╔══╝ ██╔══██╗ ██╔══╝ ██║ ██║██║╚██╗██║██║ ╚════██║
██║ ███████╗██║ ██║ ██║ ███████╗██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████║
╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝
]]
--// Get Local Player Name
function dxl.GetLocalPlayerName()
return dx9.get_localplayer().Info.Name
end
--// Get Local Player
function dxl.GetLocalPlayer()
return dx9.FindFirstChild(dx9.FindFirstChildOfClass(dx9.GetDatamodel(), "Players"), dx9.get_localplayer().Info.Name)
end
--// Get PlayerGui of Local Player
function dxl.GetLocalPlayerGUI()
return dxl.Game("Players", dxl.GetLocalPlayerName(),"PlayerGui")
end
--// Get Player
function dxl.GetPlayer(name)
return dx9.FindFirstChild(dx9.FindFirstChildOfClass(dx9.GetDatamodel(), "Players"), name)
end
--// Get Player PlayerFolder (doesent work for some games)
function dxl.GetPlayerFolder()
if dxl.PlayerFolder ~= nil then return dxl.PlayerFolder end
for i,v in pairs(dxl.GetDescendants(dx9.FindFirstChildOfClass(dx9.GetDatamodel(), "Workspace"))) do
if dx9.GetName(v) == dxl.GetLocalPlayerName() and dx9.GetType(v) == "Model" then
dxl.PlayerFolder = dx9.GetParent(v)
return dx9.GetParent(v)
end
end
end
--// Get Local Character
function dxl.GetLocalCharacter()
return dx9.GetCharacter(dx9.FindFirstChild(dx9.FindFirstChildOfClass(dx9.GetDatamodel(), "Players"), dx9.get_localplayer().Info.Name))
end
--[[
███╗ ███╗██╗███████╗ ██████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗
████╗ ████║██║██╔════╝██╔════╝ ██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝
██╔████╔██║██║███████╗██║ █████╗ ██║ ██║██╔██╗ ██║██║ ███████╗
██║╚██╔╝██║██║╚════██║██║ ██╔══╝ ██║ ██║██║╚██╗██║██║ ╚════██║
██║ ╚═╝ ██║██║███████║╚██████╗ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████║
╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝
]]
--// Json To Table
function dxl.JsonToTable(json)
assert(type(json) == "string", "[DXL Error] JsonToTable: First Argument needs to be a string!")
return loadstring("return "..json:gsub('("[^"]-"):','[%1]='))()
end
--// Better Loadstring
function dxl.loadstring(string)
assert(type(string) == "string", "[DXL Error] loadstring: First Argument needs to be a string!")
if dxl.LoadstringCaching[string] == nil then
dxl.LoadstringCaching[string] = dxl.OldLoadstring(string)
else
return dxl.LoadstringCaching[string]
end
end
_G.loadstring = dxl.loadstring
--// Better Get
function dxl.Get(string)
assert(type(string) == "string", "[DXL Error] Get: First Argument needs to be a string!")
if dxl.GetCaching[string] == nil then
dxl.GetCaching[string] = dxl.OldGet(string)
else
return dxl.GetCaching[string]
end
end
_G.dx9.Get = dxl.Get
--// Better Console
function dxl.ShowConsole(useless_variable_used_to_hook_dx9_show_console_function_and_still_work_with_this_function)
if not useless_variable_used_to_hook_dx9_show_console_function_and_still_work_with_this_function and useless_variable_used_to_hook_dx9_show_console_function_and_still_work_with_this_function ~= nil then return end
if dxl.isMouseInArea({dxl.Location[1] + dxl.Size[1] - 27, dxl.Location[2] + 3, dxl.Location[1] + dxl.Size[1] - 5, dxl.Location[2] + 19}) then
if dx9.isLeftClick() then
dxl.Open = not dxl.Open;
end
dxl.Hovering = true
else
dxl.Hovering = false
end
--// Left Click Held
if dx9.isLeftClickHeld() then
--// Drag Func
if dxl.Dragging or dxl.isMouseInArea({dxl.Location[1] - 5, dxl.Location[2] - 10, dxl.Location[1] + dxl.Size[1] + 5, dxl.Location[2] + 30}) then
if not dxl.Dragging then dxl.Dragging = true end
if dxl.WinMouseOffset == nil then
dxl.WinMouseOffset = {dx9.GetMouse().x - dxl.Location[1], dx9.GetMouse().y - dxl.Location[2]}
end
dxl.Location = {dx9.GetMouse().x - dxl.WinMouseOffset[1], dx9.GetMouse().y - dxl.WinMouseOffset[2]}
end
else
dxl.Dragging = false
dxl.WinMouseOffset = nil
end
if dxl.Open then
dx9.DrawFilledBox({dxl.Location[1] - 1, dxl.Location[2] - 1}, {dxl.Location[1] + dxl.Size[1] + 1, dxl.Location[2] + dxl.Size[2] + 1}, dxl.Black) --// Outline
dx9.DrawFilledBox(dxl.Location, {dxl.Location[1] + dxl.Size[1], dxl.Location[2] + dxl.Size[2]}, dxl.AccentColor) --// Accent
dx9.DrawFilledBox({dxl.Location[1] + 1, dxl.Location[2] + 1}, {dxl.Location[1] + dxl.Size[1] - 1, dxl.Location[2] + dxl.Size[2] - 1}, dxl.MainColor) --// Main Outer (light gray)
dx9.DrawFilledBox({dxl.Location[1] + 5, dxl.Location[2] + 20}, {dxl.Location[1] + dxl.Size[1] - 5, dxl.Location[2] + dxl.Size[2] - 5}, dxl.BackgroundColor) --// Main Inner (dark gray)
dx9.DrawBox({dxl.Location[1] + 5, dxl.Location[2] + 20}, {dxl.Location[1] + dxl.Size[1] - 5, dxl.Location[2] + dxl.Size[2] - 5}, dxl.OutlineColor) --// Main Inner Outline
dx9.DrawBox({dxl.Location[1] + 6, dxl.Location[2] + 21}, {dxl.Location[1] + dxl.Size[1] - 6, dxl.Location[2] + dxl.Size[2] - 6}, dxl.Black) --// Main Inner Outline Black
dx9.DrawString(dxl.Location, dxl.FontColor, " DXLib Console | Mouse: "..Mouse.x..", "..Mouse.y)
for i,v in pairs(dxl.StoredLogs) do
if string.sub(v, 1, 9) == "ERROR_TAG" then
dx9.DrawString({dxl.Location[1] + 10, dxl.Location[2] + 5 + i*18}, dxl.ErrorColor, string.sub(v, 10, -1))
else
dx9.DrawString({dxl.Location[1] + 10, dxl.Location[2] + 5 + i*18}, dxl.FontColor, v)
end
end
else
dx9.DrawFilledBox({dxl.Location[1] + 300, dxl.Location[2] - 1}, {dxl.Location[1] + dxl.Size[1] + 1, dxl.Location[2] + 23}, dxl.Black) --// Outline
dx9.DrawFilledBox({dxl.Location[1] + 301, dxl.Location[2]}, {dxl.Location[1] + dxl.Size[1], dxl.Location[2] + 22}, dxl.AccentColor) --// Accent
dx9.DrawFilledBox({dxl.Location[1] + 302, dxl.Location[2] + 1}, {dxl.Location[1] + dxl.Size[1] - 1, dxl.Location[2] + 21}, dxl.MainColor) --// Main Outer (light gray)
dx9.DrawString({dxl.Location[1] + 300, dxl.Location[2]}, dxl.FontColor, " DXLib Console")
end
if dxl.Hovering then
dx9.DrawFilledBox({dxl.Location[1] + dxl.Size[1] - 27, dxl.Location[2] + 3}, {dxl.Location[1] + dxl.Size[1] - 5, dxl.Location[2] + 19}, dxl.AccentColor) --// Outline
else
dx9.DrawFilledBox({dxl.Location[1] + dxl.Size[1] - 27, dxl.Location[2] + 3}, {dxl.Location[1] + dxl.Size[1] - 5, dxl.Location[2] + 19}, dxl.Black) --// Outline
end
dx9.DrawFilledBox({dxl.Location[1] + dxl.Size[1] - 26, dxl.Location[2] + 4}, {dxl.Location[1] + dxl.Size[1] - 6, dxl.Location[2] + 18}, dxl.OutlineColor) --// Inner Line
dx9.DrawFilledBox({dxl.Location[1] + dxl.Size[1] - 25, dxl.Location[2] + 5}, {dxl.Location[1] + dxl.Size[1] - 7, dxl.Location[2] + 17}, dxl.MainColor) --// Inner
dx9.DrawString({dxl.Location[1] + dxl.Size[1] - 20, dxl.Location[2] - 2}, dxl.FontColor, "_")
function dxl.error(...)
local temp = "";
for i,v in pairs({...}) do
temp = temp..tostring(v).." "
end
local split_string = {};
if string.gmatch(temp, "([^\n]+)") ~= nil then
for i in ( string.gmatch(temp, "([^\n]+)") ) do
table.insert(split_string, i)
end
end
if split_string == {} then
if #dxl.StoredLogs < 45 then
table.insert(dxl.StoredLogs, "ERROR_TAG"..temp)
else
table.insert(dxl.StoredLogs, "ERROR_TAG"..temp)
for i,v in pairs(dxl.StoredLogs) do
dxl.StoredLogs[i] = dxl.StoredLogs[i + 1]
end
end
else
for i,v in pairs(split_string) do
if #dxl.StoredLogs < 45 then
table.insert(dxl.StoredLogs, "ERROR_TAG"..v)
else
table.insert(dxl.StoredLogs, "ERROR_TAG"..v)
for i,v in pairs(dxl.StoredLogs) do
dxl.StoredLogs[i] = dxl.StoredLogs[i + 1]
end
end
end
end
end
function print_table(node) -- https://stackoverflow.com/a/42062321/19113503
local cache, stack, output = {},{},{}
local depth = 1
local output_str = "{\n"
while true do
local size = 0
for k,v in pairs(node) do
size = size + 1
end
local cur_index = 1
for k,v in pairs(node) do
if (cache[node] == nil) or (cur_index >= cache[node]) then
if (string.find(output_str,"}",output_str:len())) then
output_str = output_str .. ",\n"
elseif not (string.find(output_str,"\n",output_str:len())) then
output_str = output_str .. "\n"
end
-- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
table.insert(output,output_str)
output_str = ""
local key
if (type(k) == "number" or type(k) == "boolean") then
key = "["..tostring(k).."]"
else
key = "['"..tostring(k).."']"
end
if (type(v) == "number" or type(v) == "boolean") then
output_str = output_str .. string.rep('\t',depth) .. key .. " = "..tostring(v)
elseif (type(v) == "table") then
output_str = output_str .. string.rep('\t',depth) .. key .. " = {\n"
table.insert(stack,node)
table.insert(stack,v)
cache[node] = cur_index+1
break
else
output_str = output_str .. string.rep('\t',depth) .. key .. " = '"..tostring(v).."'"
end
if (cur_index == size) then
output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
else
output_str = output_str .. ","
end
else
-- close the table
if (cur_index == size) then
output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
end
end
cur_index = cur_index + 1
end
if (size == 0) then
output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
end
if (#stack > 0) then
node = stack[#stack]
stack[#stack] = nil
depth = cache[node] == nil and depth + 1 or depth - 1
else
break
end
end
-- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
table.insert(output,output_str)
output_str = table.concat(output)
return output_str
end
function dxl.print(...)
local temp = "";
for i,v in pairs({...}) do
if type(v) == "table" then
temp = temp..print_table(v).." "
else
temp = temp..tostring(v).." "
end
end
local split_string = {};
if string.gmatch(temp, "([^\n]+)") ~= nil then
for i in ( string.gmatch(temp, "([^\n]+)") ) do
table.insert(split_string, i)
end
end
if split_string == {} then
if #dxl.StoredLogs < 45 then
table.insert(dxl.StoredLogs, temp)
else
table.insert(dxl.StoredLogs, temp)
for i,v in pairs(dxl.StoredLogs) do
dxl.StoredLogs[i] = dxl.StoredLogs[i + 1]
end
end
else
for i,v in pairs(split_string) do
if #dxl.StoredLogs < 45 then
table.insert(dxl.StoredLogs, v)
else
table.insert(dxl.StoredLogs, v)
for i,v in pairs(dxl.StoredLogs) do
dxl.StoredLogs[i] = dxl.StoredLogs[i + 1]
end
end
end
end
end
dxl.StoredLogs = {};
_G.dxl = dxl
end
--// Supg's attempt at making print() actually print as well as output to dxLib console (wish me luck)
function double_print(...)
dxl.OldPrint(...);
dxl.print(...);
end
_G.print = double_print
_G.error = dxl.error
--// Hooking DX9 Functions
if _G.betterdebugrun == nil then
local havethesamestructionchild = {"FindFirstChild","FindFirstChildOfClass","FindFirstDescendant"}
for i,v in pairs(havethesamestructionchild) do
local old = _G["dx9"][v]
_G["dx9"][v] = function(...)
local args = {...}
if type(args[1]) ~= "number" then
dxl.error("[DX9 Error] "..v..": First Argument needs to be a number! (Instance)" .. "\n" .. debug.traceback() .. "\n")
return
end
if type(args[2]) ~= "string" then
dxl.error("[DX9 Error] "..v..": Second Argument needs to be a string!" .. "\n" .. debug.traceback() .. "\n")
return
end
return old(...)
end
end
local havethesamestruction = {"GetName","GetAllParts","GetCFrame","GetChildren","GetPosition","GetParent","GetTeam","GetTeamColour","GetCharacter","GetAdornee","GetType","GetImageLabelPosition","GetNumValue","GetStringValue","GetBoolValue"}
local custommessages = {
["GetCharacter"] = ": First Argument needs to be a player instance!",
["GetTeam"] = ": First Argument needs to be a player instance!",
["GetTeamColour"] = ": First Argument needs to be a player instance!",
["GetNumValue"] = ": First Argument needs to be a IntValue Instance!",
}
for i,v in pairs(havethesamestruction) do
local old = _G["dx9"][v]
_G["dx9"][v] = function(...)
local args = {...}
if type(args[1]) ~= "number" then
local messagethign = custommessages[v] or ": First Argument needs to be a number (Instance)!"
dxl.error("[DX9 Error] "..v..messagethign .. "\n" .. debug.traceback() .. "\n")
return
end
return old(...)
end
end
local old = _G["dx9"]["Teleport"]
_G["dx9"]["Teleport"] = function(...)
local args = {...}
if type(args[1]) ~= "number" then
dxl.error("[DX9 Error] ".."Teleport"..": First Argument needs to be a number! (Instance)" .. "\n" .. debug.traceback() .. "\n")
return
end
if type(args[2]) ~= "table" then
dxl.error("[DX9 Error] ".."Teleport"..": Second Argument needs to be a table!" .. "\n" .. debug.traceback() .. "\n")
return
end
return old(...)
end
local old = _G["dx9"]["SetAimbotValue"]
_G["dx9"]["SetAimbotValue"] = function(...)
local args = {...}
if type(args[1]) ~= "string" then
dxl.error("[DX9 Error] ".."SetAimbotValue"..": First Argument needs to be a string!" .. "\n" .. debug.traceback() .. "\n")
return
end
if type(args[2]) ~= "number" then
dxl.error("[DX9 Error] ".."SetAimbotValue"..": Second Argument needs to be a Number!" .. "\n" .. debug.traceback() .. "\n")
return
end