forked from kektram/Keks-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kek's menu.lua
6937 lines (6641 loc) · 287 KB
/
Kek's menu.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
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
-- Kek's menu version 0.4.4.1
-- Copyright © 2020-2021 Kektram
if type(kek_menu) == "table" and kek_menu.version then
menu.notify("Kek's menu is already loaded! Intentional error.", "Initialization cancelled.", 3, 211)
error("Keks menu was already loaded!")
end
local original_package_path = package.path
package.path = utils.get_appdata_path("PopstarDevs", "").."\\2Take1Menu\\scripts\\kek_menu_stuff\\kekMenuLibs\\?.lua"
local essentials
if utils.file_exists(utils.get_appdata_path("PopstarDevs", "").."\\2Take1Menu\\scripts\\kek_menu_stuff\\kekMenuLibs\\Essentials.lua") then
essentials = require("Essentials")
else
menu.notify("Missing a library file.", "Error", 3, 6)
error("Missing a library file.")
end
collectgarbage("incremental", 110, 100, 10)
math.randomseed(math.floor(os.clock()) + os.time())
for i = 1, math.random(100, 10000) do
local e = math.random(1, 2)
end
-- Var init
local u = {}
local o = {
home = utils.get_appdata_path("PopstarDevs", "").."\\2Take1Menu\\",
kek_menu_stuff_path = utils.get_appdata_path("PopstarDevs", "").."\\2Take1Menu\\scripts\\kek_menu_stuff\\",
listeners = {
["player_leave"] = {},
["player_join"] = {},
["chat"] = {},
["exit"] = {}
},
nethooks = {}
}
local general_settings = {}
local toggle = {}
local valuei = {}
local entities_you_have_control_of = {}
local player_feat_ids = {}
local people_stat_detected = {}
local hotkey_features = {}
local hotkey_control_keys_update = true
kek_menu = {
lang = {},
toggle = {},
settings = {},
default_settings = {},
ptfx = {},
what_object = "?",
ped_text = "?",
your_vehicle_entity_ids = {},
ENTITY_PED_LIMIT = 45,
ENTITY_VEHICLE_LIMIT = 50,
ENTITY_OBJECT_LIMIT = 210,
PTFX_LIMIT = 180,
version = "0.4.4.1",
update_autoexec = false
}
setmetatable(kek_menu.toggle, {
__index = function(t, index)
return toggle[index]
end,
__newindex = function()
essentials.log_error("Tried to modify kek_menu.toggle. This table is read-only.")
end
})
setmetatable(kek_menu.lang, {
__index = function(t, index)
local str = (index:match("(.+) §") or index):gsub("\\n", "\n")
kek_menu.lang[index] = str
return str
end,
__pairs = function(t)
return next, t
end
})
function kek_menu.add_feature(name, Type, parent, func)
if type(func) == "function" then
return menu.add_feature(name, Type, parent, function(f)
if type(f) == "userdata" then
func(f)
end
end)
else
return menu.add_feature(name, Type, parent)
end
end
function kek_menu.add_player_feature(name, Type, parent, func)
if type(func) == "function" then
return menu.add_player_feature(name, Type, parent, function(f, pid)
if type(f) == "userdata" then
func(f, pid)
end
end)
else
return menu.add_player_feature(name, Type, parent)
end
end
-- Language init
do
if not utils.file_exists(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\language.ini") then
local file = io.open(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\language.ini", "w+")
essentials.file(file, "write", "English.txt")
essentials.file(file, "close")
end
kek_menu.what_language = essentials.get_file_string("scripts\\kek_menu_stuff\\kekMenuLibs\\Languages\\language.ini", "*l")
if kek_menu.what_language ~= "English.txt" and utils.file_exists(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\"..kek_menu.what_language) then
for line in essentials.get_file_string("scripts\\kek_menu_stuff\\kekMenuLibs\\Languages\\"..kek_menu.what_language, "*a"):gmatch("([^\n]*)\n?") do
local temp_entry = line:match("§(.+)")
if temp_entry then
temp_entry = temp_entry:gsub("%s", "")
local str = line:match("§(.+)")
if str then
str = str:gsub("\\n", "\n")
str = str:gsub("\\\\\"", "\\\"")
kek_menu.lang[line:match("(.+)§").."§"] = str
end
end
end
end
end
-- Library versions
local lib_versions = {
"1.3.1", -- Vehicle mapper
"1.2.1", -- Ped mapper
"1.2.1", -- Object mapper
"1.2.5", -- Globals
"1.0.2", -- Weapon mapper
"0.4.2", -- Location mapper
"1.0.5", -- Key mapper
"1.0.0", -- Drive style mapper
"2.0.0", -- Menyoo spawner
"1.3.0", -- Essentials
"1.1.4", -- Kek entity functions
"1.0.4", -- Kek's trolling entities
"0.1.2", -- Custom vehicle mods
"1.0.0", -- Admin mapper
"1.0.6" -- Vehicle saver
}
-- Validity check
for i, k in pairs({
"",
"kekMenuData",
"profiles",
"kekMenuLogs",
"kekMenuLibs",
"Player history",
"kekMenuLibs\\Languages",
"Chat judger profiles",
"Chatbot profiles"
}) do
if not utils.dir_exists(o.kek_menu_stuff_path..k) then
utils.make_dir(o.kek_menu_stuff_path..k)
end
end
local lang = kek_menu.lang
setmetatable(lang, {
__index = function(t, index)
local str = (index:match("(.+) §") or index):gsub("\\n", "\n")
lang[index] = str
return str
end,
__pairs = function(t)
return next, t
end
})
for i, k in pairs(
{
"Vehicle mapper",
"Ped mapper",
"Object mapper",
"Globals",
"Weapon mapper",
"Location mapper",
"Key mapper",
"Drive style mapper",
"Menyoo spawner",
"Essentials",
"Kek's entity functions",
"Kek's trolling entities",
"custom upgrades",
"Admin mapper",
"Vehicle saver"
}) do
if not utils.file_exists(o.kek_menu_stuff_path.."kekMenuLibs\\"..k..".lua") then
essentials.msg(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"], 6, true)
error(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"])
end
local file = io.open(o.home.."scripts\\kek_menu_stuff\\kekMenuLibs\\"..k..".lua")
local str = essentials.file(file, "read", "*l")
essentials.file(file, "close")
if not str or str:match(": (.+)") ~= lib_versions[i] then
essentials.msg(lang["There's a library file which is the wrong version, please reinstall kek's menu. §"], 6, true)
error(lang["There's a library file which is the wrong version, please reinstall kek's menu. §"])
end
end
local weapon_mapper = require("Weapon mapper")
local location_mapper = require("Location mapper")
local key_mapper = require("Key mapper")
local drive_style_mapper = require("Drive style mapper")
local globals = require("Globals")
local vehicle_mapper = require("Vehicle mapper")
local ped_mapper = require("Ped mapper")
local object_mapper = require("Object mapper")
local menyoo = require("Menyoo spawner")
local kek_entity = require("Kek's entity functions")
local troll_entity = require("Kek's trolling entities")
local custom_upgrades = require("Custom upgrades")
local admin_mapper = require("Admin mapper")
local vehicle_saver = require("Vehicle saver")
package.path = original_package_path
for i, k in pairs({
"kekMenuData\\custom_chat_judge_data.txt",
"kekMenuLogs\\Blacklist.log",
"kekMenuData\\Kek's chat bot.txt",
"kekMenuData\\Spam text.txt",
"kekMenuLogs\\All players.log"
}) do
if not utils.file_exists(o.kek_menu_stuff_path..k) then
local file = io.open(o.kek_menu_stuff_path..k, "w+")
essentials.file(file, "close")
end
end
for i, file_name in pairs({
"kekMenuLibs\\data\\Truck.xml"
}) do
if not utils.file_exists(o.kek_menu_stuff_path..file_name) then
essentials.msg("["..file_name.."]: "..lang["Missing necessarry file. Please reinstall. Read the README that comes with the script for more information. §"], 6, true)
error(lang["Missing necessarry file. Please reinstall. Read the README that comes with the script for more information. §"])
end
end
if not utils.dir_exists(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\Vehicle names") then
essentials.msg(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"], 6, true, 6)
error(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"])
else
for i, file_name in pairs({
"Chinese",
"English",
"French",
"German",
"Korean",
"Spanish"
}) do
if not utils.file_exists(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\Vehicle names\\"..file_name..".lua") then
essentials.msg(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"], 6, true, 6)
error(lang["You're missing a file in kekMenuLibs. Please reinstall Kek's menu. §"])
end
end
end
-- Managers
u.new_session_timer = utils.time_ms()
do
local my_pid = player.player_id()
o.listeners["player_leave"]["timer"] = event.add_event_listener("player_leave", function(event)
if my_pid == event.player then
u.new_session_timer = utils.time_ms() + 15000
my_pid = player.player_id()
end
end)
end
local threads = {}
function kek_menu.create_thread(func, value)
local count = 0
for i, thread in pairs(threads) do
if menu.has_thread_finished(thread) then
menu.delete_thread(thread)
threads[i] = nil
else
count = count + 1
end
end
local thread = -1
if count < 850 then
thread = menu.create_thread(function(value)
func(value)
end, value)
threads[#threads + 1] = thread
end
return thread
end
-- Update entity pools
function table.update_entity_pools(dont_yield)
if not dont_yield then
system.yield(0)
end
local temp_table = {}
local ped_count, misc_count, object_count = 0, 0, 0
local veh_count = 0
for Entity, weight in pairs(entities_you_have_control_of) do
if network.has_control_of_entity(Entity) then
if entity.is_entity_a_vehicle(Entity) then
for pid = 0, 31 do
if player.get_player_vehicle(pid) == Entity then
goto skip
end
end
veh_count = veh_count + weight
temp_table[Entity] = weight
::skip::;
elseif entity.is_entity_a_ped(Entity) then
if not ped.is_ped_a_player(Entity) then
ped_count = ped_count + weight
temp_table[Entity] = weight
end
elseif entity.is_entity_an_object(Entity) then
object_count = object_count + weight
temp_table[Entity] = weight
end
misc_count = misc_count + weight
end
end
entities_you_have_control_of = temp_table
return
ped_count <= kek_menu.ENTITY_PED_LIMIT,
ped_count,
misc_count <= 125,
object_count < kek_menu.ENTITY_OBJECT_LIMIT,
veh_count < kek_menu.ENTITY_VEHICLE_LIMIT
end
-- User interface(parents)
-- Global
local str = essentials.get_file_string("scripts\\kek_menu_stuff\\keksettings.ini", "*a")
if str:match("Script quick access=(%a%a%a%a)") == "true" then
u.kekMenu = 0
else
u.kekMenu = kek_menu.add_feature(lang["Kek's menu §"], "parent", 0).id
end
u.session_trolling = kek_menu.add_feature(lang["Session trolling §"], "parent", u.kekMenu)
u.session_malicious = kek_menu.add_feature(lang["Session malicious §"], "parent", u.kekMenu)
u.kek_utilities = kek_menu.add_feature(lang["Kek's utilities §"], "parent", u.kekMenu)
u.self_options = kek_menu.add_feature(lang["Self options §"], "parent", u.kekMenu)
u.weapons_self = kek_menu.add_feature(lang["Weapons §"], "parent", u.self_options.id)
u.player_history = kek_menu.add_feature(lang["Player history §"], "parent", u.kekMenu)
u.chat_stuff = kek_menu.add_feature(lang["Chat §"], "parent", u.kekMenu)
kek_menu.add_feature(lang["Send clipboard to chat §"], "action", u.chat_stuff.id, function()
essentials.send_message(utils.from_clipboard())
end)
u.chat_spammer = kek_menu.add_feature(lang["Chat spamming §"], "parent", u.chat_stuff.id)
u.custom_chat_judger = kek_menu.add_feature(lang["Custom chat judger §"], "parent", u.chat_stuff.id)
u.chat_bot = kek_menu.add_feature(lang["Chat bot §"], "parent", u.chat_stuff.id)
u.chat_commands = kek_menu.add_feature(lang["Chat commands §"], "parent", u.chat_stuff.id)
u.gvehicle = kek_menu.add_feature(lang["Vehicle §"], "parent", u.kekMenu)
u.vehicleSettings = kek_menu.add_feature(lang["Vehicle settings §"], "parent", u.gvehicle.id)
u.settingsUI = kek_menu.add_feature(lang["General settings §"], "parent", u.kekMenu)
u.profiles = kek_menu.add_feature(lang["Settings §"], "parent", u.settingsUI.id)
u.script_loader = kek_menu.add_feature(lang["Script loader §"], "parent", u.settingsUI.id)
u.hotkey_settings = kek_menu.add_feature(lang["Hotkey settings §"], "parent", u.settingsUI.id)
u.language_config = kek_menu.add_feature(lang["Language configuration §"], "parent", u.settingsUI.id)
u.ai_drive = kek_menu.add_feature(lang["Ai driving §"], "parent", u.gvehicle.id)
u.drive_style_cfg = kek_menu.add_feature(lang["Drive style §"], "parent", u.gvehicle.id)
u.protections = kek_menu.add_feature(lang["Protections §"], "parent", u.self_options.id)
u.modder_detection = kek_menu.add_feature(lang["Modder detection §"], "parent", u.kekMenu)
u.flagsTolog = kek_menu.add_feature(lang["Modder logging settings §"], "parent", u.modder_detection.id)
u.flagsToKick = kek_menu.add_feature(lang["Auto kick tag settings §"], "parent", u.modder_detection.id)
u.modder_detection_settings = kek_menu.add_feature(lang["Which modder detections are on §"], "parent", u.modder_detection.id)
u.vehicle_friendly = kek_menu.add_feature(lang["Vehicle peaceful §"], "parent", u.gvehicle.id)
u.vehicle_blacklist = kek_menu.add_feature(lang["Vehicle blacklist §"], "parent", u.gvehicle.id)
-- Player
if str:match("Script quick access=(%a%a%a%a)") == "true" then
u.kekMenuP = 0
else
u.kekMenuP = kek_menu.add_player_feature(lang["Kek's menu §"], "parent", 0).id
end
u.malicious_player_features = kek_menu.add_player_feature(lang["Malicious §"], "parent", u.kekMenuP).id
u.player_trolling_features = kek_menu.add_player_feature(lang["Trolling §"], "parent", u.kekMenuP).id
u.script_stuff = kek_menu.add_player_feature(lang["Scripts §"], "parent", u.kekMenuP).id
u.pWeapons = kek_menu.add_player_feature(lang["Weapons §"], "parent", u.kekMenuP).id
u.player_misc_features = kek_menu.add_player_feature(lang["Misc §"], "parent", u.kekMenuP).id
u.player_vehicle_features = kek_menu.add_player_feature(lang["Vehicle §"], "parent", u.kekMenuP).id
-- Useful functions
-- Request control
function kek_menu.get_control_of_entity(Entity, time_to_wait, no_condition)
if utils.time_ms() > u.new_session_timer and entity.is_an_entity(Entity) and not network.has_control_of_entity(Entity) and (not entity.is_entity_a_ped(Entity) or not ped.is_ped_a_player(Entity)) then
if not time_to_wait then
time_to_wait = 500
end
local types = {
[4] = 1,
[3] = 5,
[5] = 4
}
if no_condition or select(types[entity.get_entity_type(Entity)], table.update_entity_pools(time_to_wait == 0)) then
local time = utils.time_ms() + time_to_wait
network.request_control_of_entity(Entity)
while not network.has_control_of_entity(Entity) and entity.is_an_entity(Entity) and time > utils.time_ms() do
system.yield(0)
end
end
if network.has_control_of_entity(Entity) then
if not entities_you_have_control_of[Entity] then
entities_you_have_control_of[Entity] = 1
end
return true
end
elseif entity.is_an_entity(Entity) then
return true
end
end
-- Spawn an entity
kek_menu.spawn_ongoing = 0
function kek_menu.spawn_entity(hash, coords_and_heading, give_godmode, set_as_mission, fully_pimp_vehicle_after_spawned, ped_type, dont_disregard_hash_after_spawn, weight, not_dynamic_object, not_networked)
local Entity = 0
if streaming.is_model_valid(hash) and utils.time_ms() > u.new_session_timer then
if not streaming.is_model_an_object(hash) and not streaming.is_model_a_world_object(hash) then
repeat
system.yield(0)
until utils.time_ms() >= kek_menu.spawn_ongoing or utils.time_ms() < u.new_session_timer
end
if utils.time_ms() > u.new_session_timer and (streaming.is_model_an_object(hash) or streaming.is_model_a_world_object(hash) or utils.time_ms() >= kek_menu.spawn_ongoing) then
local status, had_to_request_hash = kek_entity.request_model(hash)
if status then
if not streaming.is_model_an_object(hash) and not streaming.is_model_a_world_object(hash) then
kek_menu.spawn_ongoing = utils.time_ms() + 2500
end
local coords, dir = coords_and_heading()
if type(coords) ~= "userdata" then
if not streaming.is_model_an_object(hash) and not streaming.is_model_a_world_object(hash) then
kek_menu.spawn_ongoing = 0
end
essentials.log_error("Failed to spawn entity.", true)
return Entity
end
local ped_limit_not_reached, num_of_entities, above_misc, object_limit_not_breached, veh_limit_not_breached = table.update_entity_pools()
if streaming.is_model_a_vehicle(hash) and veh_limit_not_breached then
Entity = vehicle.create_vehicle(hash, coords, dir, not_networked ~= true, not_networked == true)
if fully_pimp_vehicle_after_spawned then
kek_entity.max_car(Entity)
end
decorator.decor_set_int(Entity, "MPBitset", 1 << 10)
elseif streaming.is_model_a_ped(hash) and #ped.get_all_peds() < 135 and ped_limit_not_reached then
Entity = ped.create_ped(ped_type, hash, coords, dir, not_networked ~= true, not_networked == true)
elseif streaming.is_model_a_world_object(hash) and object_limit_not_breached then
Entity = object.create_world_object(hash, coords, not not_networked, not not_dynamic_object)
elseif streaming.is_model_an_object(hash) and object_limit_not_breached then
Entity = object.create_object(hash, coords, not not_networked, not not_dynamic_object)
end
if give_godmode then
entity.set_entity_god_mode(Entity, true)
end
if set_as_mission then
entity.set_entity_as_mission_entity(Entity, false, true)
end
if entity.is_an_entity(Entity) then
if not weight then
weight = 1
end
entities_you_have_control_of[Entity] = weight
end
if had_to_request_hash and not dont_disregard_hash_after_spawn then
streaming.set_model_as_no_longer_needed(hash)
end
if not streaming.is_model_an_object(hash) and not streaming.is_model_a_world_object(hash) then
kek_menu.spawn_ongoing = 0
end
end
end
end
return Entity
end
-- Tables
-- Initialize modder flag tables
local keks_custom_modder_flags =
{
["Has-Suspicious-Stats"] = 0,
["Blacklist"] = 0,
["Modded-Spectate"] = 0,
["Modded-Name"] = 0,
["Godmode"] = 0
}
o.modder_flag_setting_properties =
{
{
"Log people with ",
"log: ",
u.flagsTolog,
lang["Log: §"].." "
},
{
"Kick people with ",
"kick: ",
u.flagsToKick,
lang["Kick: §"].." "
}
}
local modIdStuff = {1}
do
local i, int = 1
repeat
local int = 2^i
if int < player.get_modder_flag_ends() then
modIdStuff[#modIdStuff + 1] = int
end
i = i + 1
until int == player.get_modder_flag_ends() or i > 63
for flag_name, flag in pairs(keks_custom_modder_flags) do
local ends = player.get_modder_flag_ends()
local flag_int = player.add_modder_flag(flag_name)
if flag_int == ends then
modIdStuff[#modIdStuff + 1] = flag_int
end
keks_custom_modder_flags[flag_name] = flag_int
end
end
-- Settings stuff
local function add_gen_set(...)
local properties = {...}
general_settings[#general_settings + 1] = properties
kek_menu.default_settings[properties[1]] = properties[2]
end
do
local t = {
{"Force host", false},
{"Automatically check player stats", false},
{"Auto kicker", false},
{"Log modders", true},
{"Blacklist", false},
{"Spawn #vehicle# maxed", true, lang["Spawn vehicles maxed §"]},
{"Delete old #vehicle#", true, lang["Delete old vehicle §"]},
{"Custom chat judger", false},
{"Chat judge reaction", 2},
{"Default vehicle", "krieger"},
{"Exclude friends from attacks #malicious#", true, lang["Exclude friends from attacks §"]},
{"Exclude yourself from trolling", true},
{"Spawn inside of spawned #vehicle#", true, lang["Spawn inside of spawned vehicle §"]},
{"Always f1 wheels on #vehicle#", false, lang["Always spawn with f1 wheels §"]},
{"Auto kicker #notifications#", true, lang["Auto kicker notifications §"], u.modder_detection},
{"Chat judge #notifications#", true, lang["Notifications §"], u.custom_chat_judger},
{"Hotkeys #notifications#", true, lang["Notifications §"], u.hotkey_settings},
{"Vehicle blacklist #notifications#", true, lang["Notifications §"], u.vehicle_blacklist},
{"Blacklist notifications #notifications#", true, lang["Blacklist §"].." "..lang["Notifications §"], u.modder_detection},
{"Always ask what #vehicle#", false, lang["Always ask what vehicle §"]},
{"Air #vehicle# spawn mid-air", true, lang["Spawn air vehicle mid-air §"]},
{"Plate vehicle text", "Kektram"},
{"Vehicle fly speed", 150},
{"Spawn #vehicle# in godmode", false, lang["Spawn vehicles in godmode §"]},
{"Vehicle blacklist", false},
{"Spam text", "Kektram"},
{"Echo chat", false},
{"Modded spectate detection", false},
{"Kick any vote kickers", false},
{"chat bot", false},
{"chat bot delay", 300},
{"Spam speed", 100},
{"Echo delay", 100},
{"Player history", true},
{"Modded name detection", true},
{"Random weapon camos", false},
{"Max number of people to kick in force host", 1},
{"Vehicle clear distance", 500},
{"Ped clear distance", 500},
{"Object clear distance", 500},
{"Pickup clear distance", 500},
{"Sort player history search from newest to oldest", true},
{"Drive style", 557},
{"Cops clear distance", 500},
{"Chat logger", false},
{"Script quick access", false},
{"Chat commands", false},
{"Only friends can use chat commands", false},
{"Send command info every 15th minute", false},
{"Kick #chat command#", false, lang["Kick §"]},
{"Crash #chat command#", false, lang["Crash §"]},
{"apartmentinvite #chat command#", false, lang["Apartment invites §"], " <Number>"},
{"Cage #chat command#", false, lang["Cage player §"]},
{"Kill #chat command#", false, lang["Kill player §"], " <Player>"},
{"clowns #chat command#", false, lang["Clown vans §"]},
{"chopper #chat command#", false, lang["Send attack chopper §"]},
{"neverwanted #chat command#", true, lang["Never wanted §"]},
{"otr #chat command#", true, lang["off the radar §"]},
{"menyoovehicle #chat command#", false, lang["Menyoo vehicle §"], " <Vehicle>"},
{"Spawn #chat command#", true, lang["Spawn vehicle §"], " <Vehicle>"},
{"weapon #chat command#", true, lang["Give weapon §"], " <Weapon name/All>"},
{"removeweapon #chat command#", false, lang["Remove weapon §"], " <Weapon name/All>"},
{"teleport #chat command#", false, lang["Teleport to §"], " <Player/Location>", "or !tp "},
{"Godmode detection", false},
{"Horn boost speed", 25},
{"Horn boost", false},
{"Hotkeys", true},
{"Hotkey mode", 0},
{"Bounty amount", 10000},
{"Friends can't be targeted by chat commands", true},
{"You can't be targeted", true},
{"Auto tp to waypoint", false},
{"Random weapon camos speed", 500},
{"Chance to reply", 100},
{"Aim protection", false},
{"Aim protection mode", 1},
{"Revenge", false},
{"Revenge mode", 1},
{"Anti stuck measures", true},
{"Time OSD", false},
{"Safe mode", true},
{"Personal vehicle spawn preference", 0},
{"Clever bot", false},
{"Tp to player while spectating", false},
{"Display 2take1 notifications", false},
{"Number of notifications to display", 15},
{"Display notify filter", false},
{"Log 2take1 notifications to console", false}
}
for i = 1, #t do
add_gen_set(table.unpack(t[i]))
end
end
-- Init notification toggles
for i, setting_name in pairs(general_settings) do
if setting_name[1]:find("#notifications#", 1, true) then
toggle[setting_name[1]] = kek_menu.add_feature(setting_name[3], "toggle", setting_name[4].id, function(f)
kek_menu.settings[setting_name[1]] = f.on
end)
end
end
-- What flags function
local function get_all_modder_flags(pid, type)
local number_of_flags = 0
local all_flags = ""
if player.is_player_valid(pid) then
for i, k in pairs(modIdStuff) do
if player.is_player_modder(pid, k) then
if kek_menu.settings[type..player.get_modder_flag_text(k)] then
number_of_flags = number_of_flags + 1
end
all_flags = all_flags..player.get_modder_flag_text(k)..", "
end
end
if all_flags ~= "" then
all_flags = all_flags:sub(1, #all_flags - 2)
end
end
return number_of_flags, all_flags
end
-- Mod tag related settings
for index_of_setting_properties, setting_property in pairs(o.modder_flag_setting_properties) do
kek_menu.add_feature(lang["Turn all on or off §"], "action", setting_property[3].id, function()
if essentials.is_any_true(table.move(setting_property[3].children, 2, #setting_property[3].children, 1, {}), function(f)
return f.on
end) then
bool = false
else
bool = true
end
for i = 1, #modIdStuff do
toggle[setting_property[1]..player.get_modder_flag_text(modIdStuff[i])].on = bool
kek_menu.settings[setting_property[1]..player.get_modder_flag_text(modIdStuff[i])] = bool
end
end)
for i = 1, #modIdStuff do
add_gen_set(setting_property[1]..player.get_modder_flag_text(modIdStuff[i]), false)
toggle[setting_property[1]..player.get_modder_flag_text(modIdStuff[i])] = kek_menu.add_feature(setting_property[4]..player.get_modder_flag_text(modIdStuff[i]), "toggle", setting_property[3].id, function(f)
kek_menu.settings[setting_property[1]..player.get_modder_flag_text(modIdStuff[i])] = f.on
end)
end
end
-- Language config
kek_menu.add_feature(lang["Set §"].." ".."English".." "..lang["as default language. §"], "action", u.language_config.id, function(f)
local file = io.open(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\language.ini", "w+")
essentials.file(file, "write", "English.txt")
essentials.file(file, "flush")
essentials.file(file, "close")
essentials.msg("English".." "..lang["was set as the default language. §"], 210, true)
essentials.msg("Reset lua state for language change to apply.", 6, true, 10)
end)
for i, file_name in pairs(utils.get_all_files_in_directory(o.kek_menu_stuff_path.."kekMenuLibs\\Languages", "txt")) do
kek_menu.add_feature(lang["Set §"].." "..file_name:gsub("%.txt$", "").." "..lang["as default language. §"], "action", u.language_config.id, function(f)
local file = io.open(o.kek_menu_stuff_path.."kekMenuLibs\\Languages\\language.ini", "w+")
essentials.file(file, "write", file_name)
essentials.file(file, "flush")
essentials.file(file, "close")
essentials.msg(file_name:gsub("%.txt$", "").." "..lang["was set as the default language. §"], 210, true)
essentials.msg("Reset lua state for language change to apply.", 6, true, 10)
local str = essentials.get_file_string("scripts\\kek_menu_stuff\\kekMenuLibs\\Languages\\"..file_name, "*l")
end)
end
-- Kek's script loader
do
local function update_script_loader_toggle_name()
local str = essentials.get_file_string("scripts\\autoexec.lua", "*a")
if utils.file_exists(o.home.."\\scripts\\autoexec.lua") and str:find("sjhvnciuyu44khdjkhUSx", 1, true) and str:find("if false then return end", 1, true) then
u.toggle_script_loader.name = lang["Turn off script loader §"]
else
u.toggle_script_loader.name = lang["Turn on script loader §"]
end
end
local function update_autoexec(bypass_requirement)
if bypass_requirement or utils.file_exists(o.home.."scripts\\autoexec.lua") then
local str = essentials.get_file_string("scripts\\autoexec.lua", "*a")
if (bypass_requirement and not str:find("sjhvnciuyu44khdjkhUSx", 1, true)) or (str:find("sjhvnciuyu44khdjkhUSx", 1, true) and kek_menu.update_autoexec and str:match("%-%- Version ([%d%.]+)\n") ~= kek_menu.version) then
local file = io.open(o.home.."scripts\\autoexec.lua", "w+")
essentials.file(file, "write", "if false then return end")
essentials.file(file, "write", "\n-- Version "..kek_menu.version)
essentials.file(file, "write", "\n-- sjhvnciuyu44khdjkhUSx\n")
essentials.file(file, "write", "local appdata_path = utils.get_appdata_path(\"PopstarDevs\", \"\")..\"\\\\2Take1Menu\\\\\"\n")
essentials.file(file, "write", "local scripts = {}\n")
essentials.file(file, "write", "for i, k in pairs(scripts) do\n")
essentials.file(file, "write", " if utils.file_exists(appdata_path..\"scripts\\\\\"..k) then\n")
essentials.file(file, "write", " local original_path = package.path\n")
essentials.file(file, "write", " if not require(k:gsub(\"%.lua$\", \"\")) then\n")
essentials.file(file, "write", " menu.notify(\"Failed to load \"..k..\".\", \"\", 3, 6)\n")
essentials.file(file, "write", " end\n")
essentials.file(file, "write", " package.path = original_path\n")
essentials.file(file, "write", " end\n")
essentials.file(file, "write", "end\n")
essentials.file(file, "flush")
essentials.file(file, "close")
end
end
end
u.toggle_script_loader = kek_menu.add_feature("", "action", u.script_loader.id, function(f)
update_autoexec(true)
local str = essentials.get_file_string("scripts\\autoexec.lua", "*a")
if str:find("^if false then return end") then
essentials.modify_entry("scripts\\autoexec.lua", {"if false then return end", "if true then return end"}, true, true)
essentials.msg(lang["Turned off script loader §"], 212, true)
elseif str:find("^if true then return end") then
essentials.modify_entry("scripts\\autoexec.lua", {"if true then return end", "if false then return end"}, true, true)
essentials.msg(lang["Turned on script loader §"], 212, true)
end
update_script_loader_toggle_name()
end)
kek_menu.add_feature(lang["Empty script loader file §"], "action", u.script_loader.id, function()
local file = io.open(o.home.."scripts\\autoexec.lua", "w+")
essentials.file(file, "flush")
essentials.file(file, "close")
update_autoexec(true)
update_script_loader_toggle_name()
essentials.msg(lang["Emptied script loader §"], 212, true)
end)
kek_menu.add_feature(lang["Add script to auto loader §"], "action", u.script_loader.id, function()
update_autoexec(true)
local input, status = essentials.get_input(lang["Type in the name of the lua script to add. §"], "", 128, 0)
if status == 2 then
return
end
input = input:lower():gsub("%.lua$", "")
local file_path, file_name = essentials.get_file("scripts\\", "lua", input)
if not utils.file_exists(o.home.."scripts\\autoexec.lua") then
local file = io.open(o.home.."scripts\\autoexec.lua", "w+")
essentials.file(file, "close")
end
if file_path:match(essentials.remove_special(o.home).."scripts\\(.+)") and not file_path:find("autoexec%.lua$") then
if not essentials.search_for_match_and_get_line("scripts\\autoexec.lua", {file_name}) then
essentials.modify_entry("scripts\\autoexec.lua", {"local scripts = {}", "local scripts = {}\nscripts[#scripts + 1] = \""..file_name.."\""}, true, true)
essentials.msg(lang["Added §"].." "..file_path:match(essentials.remove_special(o.home).."scripts\\(.+)").." "..lang["to script loader §"], 212, true)
else
essentials.msg(file_path:match(essentials.remove_special(o.home).."scripts\\(.+)").." "..lang["is already in the script loader §"], 210, true)
end
else
essentials.msg(lang["Couldn't find file §"], 6, true)
end
update_script_loader_toggle_name()
end)
kek_menu.add_feature(lang["Remove script from auto loader §"], "action", u.script_loader.id, function()
update_autoexec(true)
local input, status = essentials.get_input(lang["Type in the lua script you want to remove. §"], "", 128, 0)
if status == 2 then
return
end
local file_path, file_name = essentials.get_file("scripts\\", "lua", input:lower())
if file_name == "" then
for line in essentials.get_file_string("scripts\\autoexec.lua", "*a"):gmatch("([^\n]*)\n?") do
if line:lower():find(input:lower(), 1, true) then
file_name = line:match("scripts%[#scripts %+ 1%] = \"(.+)\"")
break
end
end
end
local result = 2
if file_name and file_name ~= "" then
result = essentials.modify_entry("scripts\\autoexec.lua", {"scripts[#scripts + 1] = \""..file_name.."\""}, true)
end
if result == 1 then
essentials.msg(lang["Removed §"].." "..file_name:gsub("%.lua$", "").." "..lang["from script loader §"], 140, true)
elseif result == 2 then
essentials.msg(lang["Couldn't find file §"], 6, true)
else
essentials.msg(lang["autoexec doesn't exist §"], 6, true)
end
update_script_loader_toggle_name()
end)
update_autoexec()
update_script_loader_toggle_name()
end
-- Malicious player functions
-- Get host
local function get_people_in_front_of_person_in_host_queue()
if network.network_is_host() then
return {}, {}
end
local hosts, friends = {}, {}
local player_host_priority = player.get_player_host_priority(player.player_id())
for pid = 0, 31 do
if player.is_player_valid(pid) and pid ~= player.player_id() then
if player.get_player_host_priority(pid) <= player_host_priority or player.is_player_host(pid) then
hosts[#hosts + 1] = pid
if network.is_scid_friend(player.get_player_scid(pid)) then
friends[#friends + 1] = pid
end
end
end
end
return hosts, friends
end
local function get_host(use_kick_limiter)
local hosts, friends = get_people_in_front_of_person_in_host_queue()
if kek_menu.settings["Exclude friends from attacks #malicious#"] and #friends > 0 then
essentials.msg(lang["One of the people further in host queue is your friend! Cancelled. §"], 212, true)
return friends, true
elseif use_kick_limiter and #hosts > valuei["Max number of people to kick in force host"].value then
return hosts, false
else
for i, pid in pairs(hosts) do
globals.send_script_event("Netbail kick", pid, {pid, globals.generic_player_global(pid)})
end
end
return {}, false
end
-- Modder detection
-- Godmode detection
toggle["Godmode detection"] = kek_menu.add_feature(lang["Godmode detection §"], "toggle", u.modder_detection_settings.id, function(f)
local tracker = {}
while f.on do
system.yield(0)
for pid = 0, 31 do
if player.is_player_valid(pid)
and player.is_player_god(pid)
and not player.is_player_modder(pid, -1)
and player.player_id() ~= pid
and not entity.is_entity_dead(player.get_player_ped(pid))
and not ai.is_task_active(player.get_player_ped(pid), 440)
and essentials.is_not_friend(pid)
and (not tracker[player.get_player_scid(pid)] or utils.time_ms() > tracker[player.get_player_scid(pid)])
and interior.get_interior_from_entity(player.get_player_ped(pid)) == 0
and kek_entity.is_any_tasks_active(player.get_player_ped(pid), {295, 128, 287, 289, 298, 8}) then
tracker[player.get_player_scid(pid)] = utils.time_ms() + 10000
kek_menu.create_thread(function()
local scid = player.get_player_scid(pid)
local time = utils.time_ms() + 7500
while time > utils.time_ms()
and player.is_player_valid(pid)
and not entity.is_entity_dead(player.get_player_ped(pid))
and not player.is_player_modder(pid, -1)
and not ai.is_task_active(player.get_player_ped(pid), 440)
and interior.get_interior_from_entity(player.get_player_ped(pid)) == 0
and player.is_player_god(pid)
do
system.yield(0)
end
if utils.time_ms() >= time and scid == player.get_player_scid(pid) then
essentials.msg(player.get_player_name(pid).." "..lang["is in godmode. §"], 6, true)
player.set_player_as_modder(pid, keks_custom_modder_flags["Godmode"])
tracker[player.get_player_scid(pid)] = utils.time_ms() + 120000
end
end, nil)
end
end
end
end)
-- Stat detect function
local function suspicious_stats(pid)
if player.is_player_valid(pid)
and globals.get_player_rank(pid) ~= 0
and not people_stat_detected[player.get_player_scid(pid)]
and essentials.is_not_friend(pid)
and pid ~= player.player_id()
and (globals.get_player_money(pid) ~= globals.get_player_money(player.player_id())
or globals.get_player_rank(pid) ~= globals.get_player_rank(player.player_id())
or globals.get_player_kd(pid) ~= globals.get_player_kd(player.player_id())) then
local severity = 0
local what_flags_they_have_text = ""
if globals.get_player_money(pid) > 120000000 or 0 > globals.get_player_money(pid) then
severity = severity + 1
what_flags_they_have_text = what_flags_they_have_text..lang["Has a lot of money. §"].."\n"
end
if globals.get_player_rank(pid) < 0 then
what_flags_they_have_text = what_flags_they_have_text..lang["Has Negative lvl §"].."\n"
severity = severity + 3
end
if globals.get_player_kd(pid) < 0 then
what_flags_they_have_text = what_flags_they_have_text..lang["Has Negative k/d §"].."\n"
severity = severity + 3
end
if globals.get_player_rank(pid) > 1000 then
severity = severity + 1
what_flags_they_have_text = what_flags_they_have_text..lang["Has a high rank. §"].."\n"
end
if globals.get_player_kd(pid) > 8 then
severity = severity + 1
what_flags_they_have_text = what_flags_they_have_text..lang["Has a high k/d. §"].."\n"
end
if player.get_player_armour(pid) > 50 then
severity = severity + 3
what_flags_they_have_text = what_flags_they_have_text..lang["Has modded armor. §"].."\n"
end
if severity >= 3 then
player.set_player_as_modder(pid, keks_custom_modder_flags["Has-Suspicious-Stats"])
people_stat_detected[player.get_player_scid(pid)] = true
essentials.msg(player.get_player_name(pid).." "..lang["has: §"].."\n"..what_flags_they_have_text, 6, true)
end
end
end
-- Modded name detection
toggle["Modded name detection"] = kek_menu.add_feature(lang["Modded name detection §"], "toggle", u.modder_detection_settings.id, function(f)
if f.on then
o.listeners["player_join"]["modded_name_detection"] = event.add_event_listener("player_join", function(event)
if player.is_player_valid(event.player)
and player.player_id() ~= event.player
and not player.is_player_modder(event.player, keks_custom_modder_flags["Modded-Name"])
and essentials.is_not_friend(event.player) then
if #player.get_player_name(event.player) <= 5
or #player.get_player_name(event.player) > 16
or player.get_player_name(event.player):gsub("[%.%-%_]", ""):find("%p%s%c") then
local count = 0
for pid = 0, 31 do
if player.is_player_valid(pid) and player.get_player_name(pid) == player.get_player_name(event.player) then
count = count + 1
end
if count > 1 then
break
end
end
if count == 1 then
essentials.msg(player.get_player_name(event.player).." "..lang["has a modded name. §"], 6, true)
player.set_player_as_modder(event.player, keks_custom_modder_flags["Modded-Name"])
end
end
end
end)
else
event.remove_event_listener("player_join", o.listeners["player_join"]["modded_name_detection"])
o.listeners["player_join"]["modded_name_detection"] = nil
end
end)
-- Recognize modders
toggle["Blacklist"] = kek_menu.add_feature(lang["Blacklist §"], "toggle", u.modder_detection_settings.id, function(f)
if f.on then
o.listeners["player_join"]["blacklist"] = event.add_event_listener("player_join", function(event)
if player.is_player_valid(event.player) and player.player_id() ~= event.player and essentials.is_not_friend(event.player) then
local rid = player.get_player_scid(event.player)
local name = player.get_player_name(event.player)
local ip = player.get_player_ip(event.player)
if #name < 1 then
name = math.random(-2^61, 2^62)
end
local tags, what_was_detected = essentials.search_for_match_and_get_line("scripts\\kek_menu_stuff\\kekMenuLogs\\Blacklist.log", {"/"..rid.."/", "&"..ip.."&", "§"..name.."§"}, false, true)
if tags and what_was_detected then
if what_was_detected:find("/", 1, true) then
what_was_detected = lang["Rid §"]..": "..what_was_detected:gsub("/", "")
elseif what_was_detected:find("&", 1, true) then
what_was_detected = lang["IP §"]..": "..essentials.ipv4_to_dec(what_was_detected:gsub("&", ""))
elseif what_was_detected:find("§", 1, true) then
what_was_detected = lang["Name §"]..": "..what_was_detected:gsub("§", "")
end
if toggle["Auto kicker"].on and kek_menu.settings[o.modder_flag_setting_properties[2][1]..player.get_modder_flag_text(keks_custom_modder_flags["Blacklist"])] then