This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Collectibles.lua
4734 lines (4311 loc) · 250 KB
/
Collectibles.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
-- Author: IB_U_Z_Z_A_R_Dl
-- Description: Script to collect collectibles.
-- GitHub Repository: https://github.com/Illegal-Services/Collectibles-2Take1-Lua
-- Credits: https://github.com/Illegal-Services/Collectibles-2Take1-Lua/blob/main/README.md#credits
-- Globals START
---- Global variables START
--local createdBlips = { -- maybe better uses `auto_create_table()` ?
-- treasureHunts = {
-- FirstClue = {},
-- RemainingClues = {},
-- FinalLocation = {}
-- },
-- stuntJumps = {},
-- buriedStashes = {},
-- hiddenCaches = {},
-- shipwreck = {},
-- treasureChests = {},
-- lsTags = {},
-- trickOrTreat = {},
-- gCaches = {}
--}
local teleportWithVehicleSetting_Feat
---- Global variables END
---- Global constants 1/2 START
local SCRIPT_NAME <const> = "collectibles.lua"
local SCRIPT_TITLE <const> = "Collectibles"
local NATIVES <const> = require("lib\\natives2845")
local TRUSTED_FLAGS <const> = {
{ name = "LUA_TRUST_STATS", menuName = "Trusted Stats", bitValue = 1 << 0, isRequiered = false },
{ name = "LUA_TRUST_SCRIPT_VARS", menuName = "Trusted Globals / Locals", bitValue = 1 << 1, isRequiered = false },
{ name = "LUA_TRUST_NATIVES", menuName = "Trusted Natives", bitValue = 1 << 2, isRequiered = true },
{ name = "LUA_TRUST_HTTP", menuName = "Trusted Http", bitValue = 1 << 3, isRequiered = false },
{ name = "LUA_TRUST_MEMORY", menuName = "Trusted Memory", bitValue = 1 << 4, isRequiered = false }
}
---- Global constants 2/2 END
---- Global functions 1/2 START
local function rgba_to_int(r, g, b, a)
a = a or 255
return ((r&0x0ff)<<0x00)|((g&0x0ff)<<0x08)|((b&0x0ff)<<0x10)|((a&0x0ff)<<0x18)
end
local function rgba_to_hex(r, g, b, a)
a = a or 255
return string.format("#%02X%02X%02X%02X#", a, b, g, r)
end
local function create_color_entry(r, g, b, a)
local hex = rgba_to_hex(r, g, b, a)
local int = rgba_to_int(r, g, b, a)
return {
r = r, g = g, b = b, a = a,
hex = hex,
int = int
}
end
---- Global functions 1/2 END
---- Global constants 2/2 START
local COLORS <const> = {
RED = create_color_entry(255, 0, 0, 255),
ORANGE = create_color_entry(255, 165, 0, 255),
BLUE = create_color_entry(0, 0, 255, 255),
BLUE_FROM_BLIP_COLOR_38 = create_color_entry(45, 110, 185, 255),
GREEN = create_color_entry(0, 255, 0, 255),
GREEN_FROM_WALLET_MONEY = create_color_entry(114, 204, 114, 255),
}
COLORS.COLLECTED = COLORS.GREEN_FROM_WALLET_MONEY
COLORS.FOUND = COLORS.BLUE_FROM_BLIP_COLOR_38
local BLIP_COLORS <const> = {
INACTIVE = 0,
COLLECTED = 2,
FOUND = 38,
}
local BLIPS <const> = {
--[[ NOTE:
I don't like working with Blips as R* decided to DELETE blips when they should technically only be HIDDEN.
They don't even have such method. So dealing with those have to be done only in "last method".
]]
--RADAR_SNITCH = 47,
--RADAR_TEMP_2 = 430,
RADAR_NHP_CHEST = 587,
RADAR_BAT_CLUB_PROPERTY = 614,
--RADAR_RC_TIME_TRIALS = 673,
--RADAR_CASINO = 679,
--RADAR_CASINO_WHEEL = 681,
--RADAR_JUNK_SKYDIVE = 829,
--RADAR_DEAD_DROP_PACKAGE = 842,
--RADAR_GUN_VAN = 844,
--RADAR_STASH_HOUSE = 845,
--RADAR_BICYCLE_TRIAL = 860,
--RADAR_CASINO_PREP = 878,
--RADAR_DAILY_BOUNTY = 886,
--RADAR_BAIL_BONDS_OFFICE = 893
}
local MP_STATS <const> = {
LUCKY_WHEEL_USAGE = 8352,
LUCKY_WHEEL_NUM_SPIN = 10412
}
--COLLECTED_SNOWMEN_OUTFIT = 36656,
--SERIAL_KILLER_NAVY_REVOLVER_FOUND = 18989,
local PACKED_MP_BOOL <const> = {
SERIAL_KILLER_CLUE_1 = 18981,
SEEKING_TRUTH_TOILET_TIP = 25003,
STARTED_METAL_DETECTOR_COLLECTABLE = 25520,
COLLECTED_METAL_DETECTOR = 25521,
BURIED_STASH_0 = 25522,
ACTION_FIGURE_0 = 26811,
PLAYING_CARD_0 = 26911,
CASINO_MEMBERSHIP_PURCHASED = 26966,
CASINO_SEEN_CASINO_MOCAP = 27089,
SIGNAL_JAMMER_0 = 28099,
HIDDEN_CACHE_0 = 30297,
TREASURE_CHESTS_0 = 30307,
SHIPWRECKED_0 = 31734,
COLLECTED_TACTICAL_RIFLE_BARREL = 32319,
TRICK_OR_TREAT_0 = 34252,
LD_ORGANICS_0 = 34262,
TRICK_OR_TREAT_10 = 34512,
DAILYCOLLECT_DEAD_DROP_0 = 36628,
DEAD_DROP_COLLECTED_FIRST = 36629,
DAILYCOLLECT_SNOW_MEN_0 = 36630
}
local PACKED_MP_INT <const> = {
DAILY_STASH_HOUSE = 36623,
DAILYCOLLECT_DEAD_DROP_LOCATION_0 = 41213,
DAILYCOLLECT_DEAD_DROP_AREA_0 = 41214
}
local LOCALS_INDEXES <const> = {
--[[
Scrapped from: https://github.com/root-cause/v-decompiled-scripts
This is up-to-date for b3274
--> "How to update after new build update"
]]
activeTimeTrial = {script = "freemode", index = 14386 + 11},
activeRCBanditoTimeTrial = {script = "freemode", index = 14436},
activeJunkEnergyTimeTrial = {script = "freemode", index = 15239 + 3},
treasureHuntBitset = {script = "freemode", index = 18136 + 26}, --> &Local_18136 and uParam0->f_26 from int func_19581(var uParam0)//Position - 0x5E3C1B
activeTreasureHuntFirstClueLocation = {script = "freemode", index = 18136 + 34}, --> &Local_18136 and uParam0->f_37 = OBJECT::CREATE_OBJECT(joaat("xm_prop_x17_note_paper_01a"), func_19627(uParam0->f_34), bVar0, false, false);
activetreasureHuntFinalLocation = {script = "freemode", index = 18136 + 35}, --> &Local_18136 and uParam0->f_36 = OBJECT::CREATE_OBJECT(joaat("xm_prop_x17_chest_closed"), func_19577(uParam0->f_35), true, false, false);
spinCasinoLuckyWheelMask = {script = "casino_lucky_wheel", index = 280 + 0}
}
local GLOBALS_INDEXES <const> = {
--[[
Scrapped from: https://github.com/root-cause/v-decompiled-scripts
This is up-to-date for b3274
--> "How to update after new build update"
]]
-- treasureChestBlip = 2708057 + 483 * [iVar7] -- TODO: iVar7 can either be 0 or 1, I didn't want to bother codding it but later i should investigate further for cleaner code.
numberOfGhostsExposedCollected = 2708057 + 534,
numberOfNightclubToiletAttendantTipped = 1579649,
activeMediaStick_DamFunk_EvenTheScore = 2708657,
activeStreetDealer1 = 2738934 + 6813 + (0 * 7) + 1, --> Global_2738934.f_6813[iParam0 /*7*/]
activeStreetDealer2 = 2738934 + 6813 + (1 * 7) + 1, --> Global_2738934.f_6813[iParam0 /*7*/]
activeStreetDealer3 = 2738934 + 6813 + (2 * 7) + 1, --> Global_2738934.f_6813[iParam0 /*7*/]
activeMadrazoHit = 2738934 + 6838
}
local TUNABLES_INDEXES <const> = {
--[[
Scrapped from: https://github.com/root-cause/v-decompiled-scripts
This is up-to-date for b3274
--> "How to update after new build update"
]]
--> tuneables_processing.c
DISABLE_EVENT_ATOBTIMETRIAL = { index = 262145 + 10675, type = "bool" },
TIME_TRIAL_OVERRIDE_TIME = { index = 262145 + 11129, type = "int" },
ENABLE_DOUBLE_ACTION_REVOLVER = { index = 262145 + 22641, type = "bool" },
ENABLE_TREASURE_HUNT = { index = 262145 + 23088, type = "bool" },
DISABLE_EVENT_RCTIMETRIAL = { index = 262145 + 26345, type = "int" },
RC_TIME_TRIAL_OVERRIDE_TIME = { index = 262145 + 26346, type = "int" },
VC_CASINO_DISABLE_WHEEL = { index = 262145 + 26498, type = "bool" },
VC_FIGURES_ENABLE = { index = 262145 + 26671, type = "bool" },
VC_CARDS_ENABLE = { index = 262145 + 26677, type = "bool" },
VC_PEYOTE_ENABLE = { index = 262145 + 26683, type = "bool" },
VC_PEYOTE_DISABLE_1 = { index = 262145 + 26684, type = "bool" },
VC_PEYOTE_DISABLE_2 = { index = 262145 + 26685, type = "bool" },
VC_PEYOTE_DISABLE_3 = { index = 262145 + 26686, type = "bool" },
VC_PEYOTE_DISABLE_4 = { index = 262145 + 26687, type = "bool" },
VC_PEYOTE_DISABLE_5 = { index = 262145 + 26688, type = "bool" },
VC_PEYOTE_DISABLE_6 = { index = 262145 + 26689, type = "bool" },
VC_PEYOTE_DISABLE_7 = { index = 262145 + 26690, type = "bool" },
VC_PEYOTE_DISABLE_8 = { index = 262145 + 26691, type = "bool" },
VC_PEYOTE_DISABLE_9 = { index = 262145 + 26692, type = "bool" },
VC_PEYOTE_DISABLE_10 = { index = 262145 + 26693, type = "bool" },
VC_PEYOTE_DISABLE_11 = { index = 262145 + 26694, type = "bool" },
VC_PEYOTE_DISABLE_12 = { index = 262145 + 26695, type = "bool" },
VC_PEYOTE_DISABLE_13 = { index = 262145 + 26696, type = "bool" },
VC_PEYOTE_DISABLE_14 = { index = 262145 + 26697, type = "bool" },
VC_PEYOTE_DISABLE_15 = { index = 262145 + 26698, type = "bool" },
VC_PEYOTE_DISABLE_SASQUATCH_LOC = { index = 262145 + 26699, type = "bool" },
VC_PEYOTE_DISABLE_CHOP_LOC = { index = 262145 + 26700, type = "bool" },
VC_PEYOTE_DISABLE_ROTTWEILER = { index = 262145 + 26701, type = "bool" },
VC_PEYOTE_DISABLE_MTLION = { index = 262145 + 26702, type = "bool" },
VC_PEYOTE_DISABLE_WESTY = { index = 262145 + 26703, type = "bool" },
VC_PEYOTE_DISABLE_PUG = { index = 262145 + 26704, type = "bool" },
VC_PEYOTE_DISABLE_CROW = { index = 262145 + 26705, type = "bool" },
VC_PEYOTE_DISABLE_HUSKY = { index = 262145 + 26706, type = "bool" },
VC_PEYOTE_DISABLE_SHEPHERD = { index = 262145 + 26707, type = "bool" },
VC_PEYOTE_DISABLE_PIGEON = { index = 262145 + 26708, type = "bool" },
VC_PEYOTE_DISABLE_FISH = { index = 262145 + 26709, type = "bool" },
VC_PEYOTE_DISABLE_COW = { index = 262145 + 26710, type = "bool" },
VC_PEYOTE_DISABLE_POODLE = { index = 262145 + 26711, type = "bool" },
VC_PEYOTE_DISABLE_SHARKHAMMER = { index = 262145 + 26712, type = "bool" },
VC_PEYOTE_DISABLE_PIG = { index = 262145 + 26713, type = "bool" },
VC_PEYOTE_DISABLE_COYOTE = { index = 262145 + 26714, type = "bool" },
VC_PEYOTE_DISABLE_STINGRAY = { index = 262145 + 26715, type = "bool" },
VC_PEYOTE_DISABLE_DEER = { index = 262145 + 26716, type = "bool" },
VC_PEYOTE_DISABLE_SEAGULL = { index = 262145 + 26717, type = "bool" },
VC_PEYOTE_DISABLE_KILLERWHALE = { index = 262145 + 26718, type = "bool" },
VC_PEYOTE_DISABLE_BOAR = { index = 262145 + 26719, type = "bool" },
VC_PEYOTE_DISABLE_RABBIT = { index = 262145 + 26720, type = "bool" },
VC_PEYOTE_DISABLE_DOLPHIN = { index = 262145 + 26721, type = "bool" },
VC_PEYOTE_DISABLE_HEN = { index = 262145 + 26722, type = "bool" },
VC_PEYOTE_DISABLE_RETRIEVER = { index = 262145 + 26723, type = "bool" },
VC_PEYOTE_DISABLE_CHICKENHAWK = { index = 262145 + 26724, type = "bool" },
VC_PEYOTE_DISABLE_CAT = { index = 262145 + 26725, type = "bool" },
VC_PEYOTE_DISABLE_SHARKTIGER = { index = 262145 + 26726, type = "bool" },
VC_PEYOTE_DISABLE_CORMORANT = { index = 262145 + 26727, type = "bool" },
VC_PEYOTE_DISABLE_SASQUATCH = { index = 262145 + 26728, type = "bool" },
VC_PEYOTE_DISABLE_CHOP = { index = 262145 + 26729, type = "bool" },
VC_LUCKY_WHEEL_NUM_SPINS_PER_DAY = { index = 262145 + 26746, type = "int" },
VC_LUCKY_WHEEL_ADDITIONAL_SPINS_ENABLE = { index = 262145 + 26747, type = "bool" },
COLLECTABLES_SIGNAL_JAMMERS = { index = 262145 + 27934, type = "bool" },
COLLECTABLES_MOVIE_PROPS = { index = 262145 + 29152, type = "bool" },
COLLECTABLES_UNDERWATER_PACKAGES = { index = 262145 + 29218, type = "bool" },
COLLECTABLES_TREASURE_CHESTS = { index = 262145 + 29219, type = "bool" },
COLLECTABLES_RADIO_STATIONS = { index = 262145 + 29220, type = "bool" },
NUMBER_OF_ACTIVE_HIDDEN_CACHES = { index = 262145 + 29730, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_INDEX = { index = 262145 + 30234, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_TREASURE_CHEST0 = { index = 262145 + 30235, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_TREASURE_CHEST1 = { index = 262145 + 30236, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE0 = { index = 262145 + 30237, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE1 = { index = 262145 + 30238, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE2 = { index = 262145 + 30239, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE3 = { index = 262145 + 30240, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE4 = { index = 262145 + 30241, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE5 = { index = 262145 + 30242, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE6 = { index = 262145 + 30243, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE7 = { index = 262145 + 30244, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE8 = { index = 262145 + 30245, type = "int" },
DAILY_COLLECTABLES_OVERRIDE_HIDDEN_CACHE9 = { index = 262145 + 30246, type = "int" },
DISABLE_DAILY_COLLECTABLE_TREASURE_HUNT_GRASS_CULL_LOCATION_BITSET = { index = 262145 + 30247, type = "int" },
COLLECTABLES_USB_PIRATE_RADIO = { index = 262145 + 30258, type = "bool" },
NUMBER_OF_USB_PIRATE_RADIO_MIXES_AT_LOCATIONS = { index = 262145 + 30259, type = "int" },
NUMBER_OF_ACTIVE_SHIPWRECKED = { index = 262145 + 30260, type = "int" },
COLLECTABLES_SHIPWRECKED = { index = 262145 + 30261, type = "bool" },
NUMBER_OF_ACTIVE_BURIED_STASH = { index = 262145 + 30263, type = "int" },
COLLECTABLES_BURIED_STASH = { index = 262145 + 30264, type = "bool" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_0 = { index = 262145 + 30387 + 1, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_1 = { index = 262145 + 30387 + 2, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_2 = { index = 262145 + 30387 + 3, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_3 = { index = 262145 + 30387 + 4, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_4 = { index = 262145 + 30387 + 5, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_5 = { index = 262145 + 30387 + 6, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_6 = { index = 262145 + 30387 + 7, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_7 = { index = 262145 + 30387 + 8, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_8 = { index = 262145 + 30387 + 9, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_9 = { index = 262145 + 30387 + 10, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_10 = { index = 262145 + 30387 + 11, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_11 = { index = 262145 + 30387 + 12, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_12 = { index = 262145 + 30387 + 13, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_13 = { index = 262145 + 30387 + 14, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_14 = { index = 262145 + 30387 + 15, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_15 = { index = 262145 + 30387 + 16, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_16 = { index = 262145 + 30387 + 17, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_17 = { index = 262145 + 30387 + 18, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_18 = { index = 262145 + 30387 + 19, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_19 = { index = 262145 + 30387 + 20, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_20 = { index = 262145 + 30387 + 21, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_21 = { index = 262145 + 30387 + 22, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_22 = { index = 262145 + 30387 + 23, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_23 = { index = 262145 + 30387 + 24, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_LOCATION_BITSET_24 = { index = 262145 + 30387 + 25, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_FINALE_LOCATION_BITSET = { index = 262145 + 30413, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_MOODY_LOCATION_BITSET = { index = 262145 + 30414, type = "int" },
ACTIVE_DAILY_COLLECTABLE_USB_FIXER_DRE = { index = 262145 + 31196, type = "bool" },
NUMBER_OF_ACTIVE_TRICK_OR_TREAT = { index = 262145 + 32083, type = "int" },
COLLECTABLES_TRICK_OR_TREAT = { index = 262145 + 32084, type = "bool" },
NUMBER_OF_ACTIVE_LD_ORGANICS = { index = 262145 + 32098, type = "int" },
COLLECTABLES_LD_ORGANICS = { index = 262145 + 32099, type = "bool" },
NUMBER_OF_ACTIVE_SKYDIVES = { index = 262145 + 32103, type = "int" },
COLLECTABLES_SKYDIVES = { index = 262145 + 32104, type = "bool" },
NUMBER_OF_ACTIVE_DEAD_DROP = { index = 262145 + 33222, type = "int" },
COLLECTABLES_DEAD_DROP = { index = 262145 + 33223, type = "bool" },
NUMBER_OF_ACTIVE_SNOWMEN = { index = 262145 + 33227, type = "int" },
COLLECTABLES_SNOWMEN = { index = 262145 + 33228, type = "bool" },
XM22_GUN_VAN_AVAILABLE = { index = 262145 + 33232, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_0 = { index = 262145 + 33233 + 1, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_1 = { index = 262145 + 33233 + 2, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_2 = { index = 262145 + 33233 + 3, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_3 = { index = 262145 + 33233 + 4, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_4 = { index = 262145 + 33233 + 5, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_5 = { index = 262145 + 33233 + 6, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_6 = { index = 262145 + 33233 + 7, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_7 = { index = 262145 + 33233 + 8, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_8 = { index = 262145 + 33233 + 9, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_9 = { index = 262145 + 33233 + 10, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_10 = { index = 262145 + 33233 + 11, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_11 = { index = 262145 + 33233 + 12, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_12 = { index = 262145 + 33233 + 13, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_13 = { index = 262145 + 33233 + 14, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_14 = { index = 262145 + 33233 + 15, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_15 = { index = 262145 + 33233 + 16, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_16 = { index = 262145 + 33233 + 17, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_17 = { index = 262145 + 33233 + 18, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_18 = { index = 262145 + 33233 + 19, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_19 = { index = 262145 + 33233 + 20, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_20 = { index = 262145 + 33233 + 21, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_21 = { index = 262145 + 33233 + 22, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_22 = { index = 262145 + 33233 + 23, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_23 = { index = 262145 + 33233 + 24, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_24 = { index = 262145 + 33233 + 25, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_25 = { index = 262145 + 33233 + 26, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_26 = { index = 262145 + 33233 + 27, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_27 = { index = 262145 + 33233 + 28, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_28 = { index = 262145 + 33233 + 29, type = "bool" },
XM22_GUN_VAN_LOCATION_ENABLED_29 = { index = 262145 + 33233 + 30, type = "bool" },
ENABLE_DAILYSTASHHOUSE_DLC22022 = { index = 262145 + 33476, type = "bool" },
ENABLE_STREETDEALERS_DLC22022 = { index = 262145 + 33479, type = "bool" },
ENABLE_DAILY_BIKE_TIME_TRIAL = { index = 262145 + 34213, type = "bool" },
ENABLE_HALLOWEEN_GHOSTHUNT = { index = 262145 + 34221, type = "bool" },
TAGGING_POSTERS_NUMBER_OF_ACTIVE = { index = 262145 + 35524, type = "int" }
}
---- Global constants 2/2 END
---- Global functions 2/2 START
local function pluralize(word, count)
local irregularPlurals = {
["Buried Stash"] = "Buried Stashes",
["Treasure Hunt (First Clue)"] = "Treasure Hunt (First Clues)",
["Treasure Hunt (Remaining Clue)"] = "Treasure Hunt (Remaining Clues)",
["Treasure Hunt (Final Location)"] = "Treasure Hunt (Final Locations)"
}
if count > 1 then
return irregularPlurals[word] or (word .. "s")
end
return word
end
local function ensure_float(value)
return math.type(value) == "integer" and value * 1.0 or value
end
local function table_contains(tbl, value)
for _, v in ipairs(tbl) do
if v == value then
return true
end
end
return false
end
local function is_in_range(value, min, max)
return value >= min and value <= max
end
-- Function generated from ChatGPT
local function time_components_from_ms(baseMilliseconds)
local SECONDS_PER_DAY = 86400
local SECONDS_PER_HOUR = 3600
local SECONDS_PER_MINUTE = 60
local MILLISECONDS_PER_SECOND = 1000
local totalSeconds = math.floor(baseMilliseconds / MILLISECONDS_PER_SECOND)
local days = math.floor(totalSeconds / SECONDS_PER_DAY)
totalSeconds = totalSeconds % SECONDS_PER_DAY
local hours = math.floor(totalSeconds / SECONDS_PER_HOUR)
totalSeconds = totalSeconds % SECONDS_PER_HOUR
local minutes = math.floor(totalSeconds / SECONDS_PER_MINUTE)
local seconds = totalSeconds % SECONDS_PER_MINUTE
local milliseconds = baseMilliseconds % MILLISECONDS_PER_SECOND
return {
days = days,
hours = hours,
minutes = minutes,
seconds = seconds,
milliseconds = milliseconds
}
end
-- Function generated from ChatGPT
local function time_components_from_seconds(baseSeconds)
local MILLISECONDS_PER_SECOND = 1000
local timeComponents = time_components_from_ms(baseSeconds * MILLISECONDS_PER_SECOND)
timeComponents.milliseconds = nil -- Remove milliseconds field from the result since we are dealing with seconds
return timeComponents
end
--local function CONVERT_POSIX_TIME(posixTime)
-- return os.date("*t", posixTime)
--end
local function create_tick_handler(handler, ms)
return menu.create_thread(function()
while true do
handler()
system.yield(ms)
end
end)
end
local function format_on_races_display_time_from_ms(ms)
if ms >= 0 then
local timeComponents = time_components_from_ms(ms)
return string.format("%02d:%02d.%02d", timeComponents.minutes, timeComponents.seconds, timeComponents.milliseconds)
end
return "00:00.00"
end
local function teleport_myself(x, y, z, keepVehicle)
if teleportWithVehicleSetting_Feat.on then
keepVehicle = true
end
x = ensure_float(x)
y = ensure_float(y)
z = ensure_float(z)
local playerPed = player.player_ped()
if keepVehicle then
NATIVES.PED.SET_PED_COORDS_KEEP_VEHICLE(playerPed, x, y, z)
else
entity.set_entity_coords_no_offset(playerPed, v3(x, y, z))
end
end
local function is_any_game_overlay_open()
if NATIVES.HUD.IS_PAUSE_MENU_ACTIVE() then
-- Doesn't work in SP
return true
end
local scripts_list = {
"maintransition",
"pausemenu",
"pausemenucareerhublaunch",
"pausemenu_example",
"pausemenu_map",
"pausemenu_multiplayer",
"pausemenu_sp_repeat",
"apparcadebusiness",
"apparcadebusinesshub",
"appavengeroperations",
"appbailoffice",
"appbikerbusiness",
"appbroadcast",
"appbunkerbusiness",
"appbusinesshub",
"appcamera",
"appchecklist",
"appcontacts",
"appcovertops",
"appemail",
"appextraction",
"appfixersecurity",
"apphackertruck",
"apphs_sleep",
"appimportexport",
"appinternet",
"appjipmp",
"appmedia",
"appmpbossagency",
"appmpemail",
"appmpjoblistnew",
"apporganiser",
"appprogresshub",
"apprepeatplay",
"appsecurohack",
"appsecuroserv",
"appsettings",
"appsidetask",
"appsmuggler",
"apptextmessage",
"apptrackify",
"appvinewoodmenu",
"appvlsi",
"appzit",
}
for _, app in ipairs(scripts_list) do
if NATIVES.SCRIPT.GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(gameplay.get_hash_key(app)) > 0 then
return true
end
end
return false
end
local function is_any_cutscene_playing(playerID)
return (
cutscene.is_cutscene_playing()
or cutscene.is_cutscene_active()
or NATIVES.NETWORK.NETWORK_IS_PLAYER_IN_MP_CUTSCENE(playerID)
or NATIVES.NETWORK.IS_PLAYER_IN_CUTSCENE(playerID)
)
end
local function is_session_transition_active()
return NATIVES.SCRIPT.GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(gameplay.get_hash_key("maintransition")) > 0
end
local function is_session_started(params)
params = params or {}
if params.hasTransitionFinished == nil then
params.hasTransitionFinished = false
end
return (
network.is_session_started() and player.get_host() ~= -1
and (not params.hasTransitionFinished or not is_session_transition_active()) -- Optional check
)
end
local function is_player_playing(playerId)
return (
player.is_player_playing(playerId)
and NATIVES.PLAYER.IS_PLAYER_PLAYING(playerId)
and NATIVES.NETWORK.NETWORK_IS_PLAYER_CONNECTED(playerId)
and NATIVES.NETWORK.NETWORK_IS_PLAYER_ACTIVE(playerId)
)
end
local function is_myself_in_interior(interiorId)
local playerId = player.player_id()
local playerPed = player.player_ped()
return (
is_session_started({ hasTransitionFinished = true })
and ui.is_hud_component_active(14)
and NATIVES.HUD.IS_MINIMAP_RENDERING()
and is_player_playing(playerId)
and NATIVES.INTERIOR.IS_INTERIOR_READY(interiorId)
and NATIVES.INTERIOR.GET_INTERIOR_FROM_ENTITY(playerPed) == interiorId
and NATIVES.INTERIOR.GET_INTERIOR_FROM_PRIMARY_VIEW() == interiorId
and not (
is_any_game_overlay_open()
or is_session_transition_active()
or NATIVES.HUD.IS_WARNING_MESSAGE_ACTIVE()
or NATIVES.HUD.IS_WARNING_MESSAGE_READY_FOR_CONTROL()
or is_any_cutscene_playing(playerId)
or NATIVES.NETWORK.NETWORK_IS_PLAYER_FADING(playerId)
or NATIVES.PLAYER.IS_PLAYER_DEAD(playerId)
or entity.is_entity_dead(playerPed)
or NATIVES.INTERIOR.IS_INTERIOR_DISABLED(interiorId)
)
)
end
local function get_entity_max_size(targetEntity)
local modelDimensionsMin, modelDimensionsMax = entity.get_entity_model_dimensions(targetEntity)
return modelDimensionsMax
end
local function teleport_in_marker(markerPos, interiorId, notificationText)
local start_Time = os.clock()
while not (
NATIVES.NETWORK.NETWORK_IS_PLAYER_IN_MP_CUTSCENE(player.player_id())
or is_myself_in_interior(interiorId)
) do
system.yield()
teleport_myself(markerPos.x, markerPos.y, markerPos.z)
system.yield(1000)
-- [BUG]: Doesn't work in first person ...
entity.set_entity_heading(player.player_ped(), 360.0)
system.yield(2000)
if (os.clock() - start_Time) >= 3 then
menu.notify(notificationText, SCRIPT_TITLE, 3, COLORS.BLUE.int)
start_Time = os.clock()
end
end
while not is_myself_in_interior(interiorId) do
system.yield()
if (os.clock() - start_Time) >= 1 then
menu.notify(notificationText, SCRIPT_TITLE, 1, COLORS.BLUE.int)
start_Time = os.clock()
end
end
end
local function remove_event_listener(eventType, listener)
if listener and event.remove_event_listener(eventType, listener) then
return
end
return listener
end
local function handle_script_exit(params)
local function remove_all_created_blips()
local function recursive_remove(blips)
for key, value in pairs(blips) do
if type(value) == "table" then
recursive_remove(value)
else
if NATIVES.HUD.DOES_BLIP_EXIST(value) then
ui.remove_blip(value)
end
end
end
end
recursive_remove(createdBlips)
end
params = params or {}
if params.clearAllNotifications == nil then
params.clearAllNotifications = false
end
if params.hasScriptCrashed == nil then
params.hasScriptCrashed = false
end
scriptExitEventListener = remove_event_listener("exit", scriptExitEventListener)
remove_all_created_blips()
-- This will delete notifications from other scripts too.
-- Suggestion is open: https://discord.com/channels/1088976448452304957/1092480948353904752/1253065431720394842
if params.clearAllNotifications then
menu.clear_all_notifications()
end
if params.hasScriptCrashed then
menu.notify("Oh no... Script crashed:(\nYou gotta restart it manually.", SCRIPT_NAME, 12, COLORS.RED.int)
end
menu.exit()
end
---- Global functions 2/2 END
---- Global event listeners START
scriptExitEventListener = event.add_event_listener("exit", function()
handle_script_exit()
end)
---- Global event listeners END
-- Globals END
-- Permissions Startup Checking START
local unnecessaryPermissions = {}
local missingPermissions = {}
for _, flag in ipairs(TRUSTED_FLAGS) do
if menu.is_trusted_mode_enabled(flag.bitValue) then
if not flag.isRequiered then
table.insert(unnecessaryPermissions, flag.menuName)
end
else
if flag.isRequiered then
table.insert(missingPermissions, flag.menuName)
end
end
end
if #unnecessaryPermissions > 0 then
menu.notify("You do not require the following " .. pluralize("permission", #unnecessaryPermissions) .. ":\n" .. table.concat(unnecessaryPermissions, "\n"),
SCRIPT_NAME, 6, COLORS.ORANGE.int)
end
if #missingPermissions > 0 then
menu.notify(
"You need to enable the following " .. pluralize("permission", #missingPermissions) .. ":\n" .. table.concat(missingPermissions, "\n"),
SCRIPT_NAME, 6, COLORS.RED.int)
handle_script_exit()
end
-- Permissions Startup Checking END
-- === Main Menu Features === --
local function has_all_bools(packedStatBoolCodesTable)
for _, packedStatBoolCode in pairs(packedStatBoolCodesTable) do
if not NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(packedStatBoolCode, -1) then
return false
end
end
return true
end
-- TODO: Add Tunables as maxNum here
--[[ TODO:
PACKED_MP_MOVIE_PROPS_0,
PACKED_MP_MOVIE_PROPS_1,
PACKED_MP_MOVIE_PROPS_2,
PACKED_MP_MOVIE_PROPS_3,
PACKED_MP_MOVIE_PROPS_4,
PACKED_MP_MOVIE_PROPS_5,
PACKED_MP_MOVIE_PROPS_6,
PACKED_MP_MOVIE_PROPS_7, //10
PACKED_MP_MOVIE_PROPS_8,
PACKED_MP_MOVIE_PROPS_9,
PACKED_MP_ALIEN_AWARD_OUTFIT,
PACKED_MP_MOVIE_PROPS_0_DELIVERED,
PACKED_MP_MOVIE_PROPS_1_DELIVERED,
PACKED_MP_MOVIE_PROPS_2_DELIVERED,
PACKED_MP_MOVIE_PROPS_3_DELIVERED,
PACKED_MP_MOVIE_PROPS_4_DELIVERED,
PACKED_MP_MOVIE_PROPS_5_DELIVERED,
PACKED_MP_MOVIE_PROPS_6_DELIVERED, //20
PACKED_MP_MOVIE_PROPS_7_DELIVERED,
PACKED_MP_MOVIE_PROPS_8_DELIVERED,
PACKED_MP_MOVIE_PROPS_9_DELIVERED,
PACKED_MP_MOVIE_PROPS_STARTED,
PACKED_MP_ALIEN_AWARD_OUTFIT
PACKED_MP_BOOL_YACHT_AWARD_OUTFIT
PACKED_MP_BOOL_COLLECTED_IMPOTANT_RAGE_OUTFIT
PACKED_MP_BOOL_COLLECTED_HIGHROLLER_OUTFIT
PACKED_MP_BOOL_COLLECTED_FRONTIER_OUTFIT
PACKED_MP_BOOL_COLLECTED_LD_ORGANICS_OUTFIT
PACKED_MP_BOOL_COLLECTED_SNOWMEN_OUTFIT
PACKED_MP_SKYDIVES_0,
PACKED_MP_SKYDIVES_1,
PACKED_MP_SKYDIVES_2,
PACKED_MP_SKYDIVES_3,
PACKED_MP_SKYDIVES_4,
PACKED_MP_SKYDIVES_5,
PACKED_MP_SKYDIVES_6,
PACKED_MP_SKYDIVES_7,
PACKED_MP_SKYDIVES_8,
PACKED_MP_SKYDIVES_9,
PACKED_MP_BURIED_STASH_0,
PACKED_MP_BURIED_STASH_1,
PACKED_MP_BURIED_STASH_2,
PACKED_MP_BURIED_STASH_3,
PACKED_MP_BURIED_STASH_4,
PACKED_MP_BURIED_STASH_5,
PACKED_MP_BURIED_STASH_6,
PACKED_MP_BURIED_STASH_7,
PACKED_MP_BURIED_STASH_8,
PACKED_MP_BURIED_STASH_9, //+12 (current 574)
PACKED_MP_BURIED_STASH_COLLECTED_FIRST,
PACKED_MP_BURIED_STASH_HAS_BEEN_FOUND_0,
PACKED_MP_BURIED_STASH_HAS_BEEN_FOUND_1,
]]
local function has_action_figure(actionFigureId)
return is_in_range(actionFigureId, 0, 99) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.ACTION_FIGURE_0 + actionFigureId, -1) or false
end
local function has_ghost_exposed(ghostExposedId)
return is_in_range(ghostExposedId, 0, 9) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(41316 + ghostExposedId, -1) or false
end
local function has_ld_organic_product(ldOrganicProductId)
return is_in_range(ldOrganicProductId, 0, 99) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.LD_ORGANICS_0 + ldOrganicProductId, -1) or false
end
local function has_movie_prop(moviePropId)
return is_in_range(moviePropId, 0, 9) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(30241 + moviePropId, -1) or false
end
local function has_playing_card(playingCardId)
return is_in_range(playingCardId, 0, 53) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.PLAYING_CARD_0 + playingCardId, -1) or false
end
local function has_signal_jammer(signalJammerId)
return is_in_range(signalJammerId, 0, 49) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.SIGNAL_JAMMER_0 + signalJammerId, -1) or false
end
local function has_snowman(snowmanId)
return is_in_range(snowmanId, 0, 24) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.DAILYCOLLECT_SNOW_MEN_0 + snowmanId, -1) or false
end
local function has_epsilon_robe(epsilonRobeId)
return is_in_range(epsilonRobeId, 0, 2) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.SEEKING_TRUTH_TOILET_TIP + epsilonRobeId, -1) or false
end
local function has_weapon_component(weaponComponentId)
return is_in_range(weaponComponentId, 0, 4) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.COLLECTED_TACTICAL_RIFLE_BARREL + weaponComponentId, -1) or false
end
local function has_buried_stash(buriedStashId)
return is_in_range(buriedStashId, 0, 1) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.BURIED_STASH_0 + buriedStashId, -1) or false
end
local function has_hidden_cache(hiddenCacheId)
return is_in_range(hiddenCacheId, 0, 9) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.HIDDEN_CACHE_0 + hiddenCacheId, -1) or false
end
local function has_junk_energy_skydive(junkEnergySkydiveId)
--[[
ChatGPT + decompiled script enginered, I have done nothing but copy paste decompiled and asked GPT to make the working algorythm.
Expect the code to be buggy / I didn't make it, but it worked so far on my own testings.
]]
if not is_in_range(junkEnergySkydiveId, 0, 9) then
return false
end
-- Calculate the base stat IDs for the specific skydive ID
local statId1 = 34837 + junkEnergySkydiveId * 4
local statId2 = 34839 + junkEnergySkydiveId * 4
local statId3 = 34838 + junkEnergySkydiveId * 4
-- Check if any of the stats indicate the skydive has been collected
return NATIVES.STATS.GET_PACKED_STAT_INT_CODE(statId1, -1) ~= 255
or NATIVES.STATS.GET_PACKED_STAT_INT_CODE(statId2, -1) ~= 255
or NATIVES.STATS.GET_PACKED_STAT_INT_CODE(statId3, -1) ~= 255
end
local function has_shipwreck(shipwreckId)
return is_in_range(shipwreckId, 0, 1) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.SHIPWRECKED_0 + shipwreckId, -1) or false
end
local function has_treasure_chest(treasureChestId)
return is_in_range(treasureChestId, 0, 1) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(PACKED_MP_BOOL.TREASURE_CHESTS_0 + treasureChestId, -1) or false
end
local function has_ls_tag(lsTagId)
return is_in_range(lsTagId, 0, 4) and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(42252 + lsTagId, -1) or false
end
local function has_trick_or_treat(trickOrTreatId)
local packedStatId = false
if is_in_range(trickOrTreatId, 0, 9) then
packedStatId = PACKED_MP_BOOL.TRICK_OR_TREAT_0 + trickOrTreatId
elseif is_in_range(trickOrTreatId, 10, 199) then
packedStatId = PACKED_MP_BOOL.TRICK_OR_TREAT_10 + (trickOrTreatId - 10)
end
return packedStatId and NATIVES.STATS.GET_PACKED_STAT_BOOL_CODE(packedStatId, -1) or false
end
local function count_collected_bool_stat_items(hasCollectibleFunc, endIndex, hasCollectibleFunc__params)
endIndex = endIndex - 1
local startIndex = 0
local collectedCount = 0
for i = startIndex, endIndex do
if hasCollectibleFunc(i, hasCollectibleFunc__params) then
collectedCount = collectedCount + 1
end
end
return collectedCount
end
local function auto_mode_pickup(feat, pickup_Table, pickupHashes_Table, collectibleTypeName, hasCollectibleFunc)
-- Iterate through all pickups
for i, pickupGroup in ipairs(pickup_Table) do
if not feat.on then
break
end
-- Skips teleports related to random events.
if collectibleTypeName == "Movie Props" then
if i >= 8 then
return
end
end
-- Checks if we didn't already collected that one, if so skip.
if not hasCollectibleFunc(i - 1) then
local initialWait_Time = 4
if pickupGroup["extraWait_Time"] then
initialWait_Time = pickupGroup["extraWait_Time"]
end
if pickupGroup["notification"] then
menu.notify(pickupGroup["notification"], SCRIPT_TITLE, initialWait_Time, COLORS.BLUE.int)
end
menu.notify("Auto Mode (" .. collectibleTypeName .. ") progress: " .. i .. "/" .. #pickup_Table, SCRIPT_TITLE, initialWait_Time, COLORS.BLUE.int)
teleport_myself(pickupGroup.coords.x, pickupGroup.coords.y, pickupGroup.coords.z)
-- If this flag is set, it means we must wait a lil longer after a teleport, ex: loading the Casino building.
if pickupGroup["extraWait_Time"] then
local start_Time = os.clock()
while (os.clock() - start_Time) < initialWait_Time do
teleport_myself(pickupGroup.coords.x, pickupGroup.coords.y, pickupGroup.coords.z)
system.yield(100)
end
end
local start_Time = os.clock()
local foundPickupNearby = false
local verifyPickup_Time = nil
-- Check for any matching collectibles for up to 4 seconds
while (os.clock() - start_Time) < 4 do -- Going under that makes it not collect 100% of them.
system.yield()
if foundPickupNearby and (os.clock() - verifyPickup_Time) > 3 then
break -- Timeout of 3 seconds if a matched pickup was found, but still not collected
end
local nearbyPickups_Table = object.get_all_pickups() -- OBJECT::HAS_PICKUP_BEEN_COLLECTED, OBJECT::DOES_PICKUP_EXIST, OBJECT::DOES_PICKUP_OBJECT_EXIST
for _, nearbyPickup in pairs(nearbyPickups_Table) do
local entityHash = entity.get_entity_model_hash(nearbyPickup)
if table_contains(pickupHashes_Table, entityHash) then
foundPickupNearby = true
verifyPickup_Time = os.clock() -- Init verification time
local pickupEntityPos = entity.get_entity_coords(nearbyPickup)
teleport_myself(pickupEntityPos.x, pickupEntityPos.y, pickupEntityPos.z)
system.yield(1000) -- Wait 1 second before rechecking, I do that in case the player as to "fall" on the ground, in order to collect the pickup.
break -- Exit the inner loop to recheck the list of pickups
end
end
-- Exit the loop if no pickup is found after checking
if verifyPickup_Time and not foundPickupNearby then
break
end
end
end
end
end
local function auto_mode_e(feat, collectible_Table, collectibleHashes_Table, collectibleTypeName)
local function start_auto_mode(noClip_Feat)
local initialWait_Time = 4
local function try_and_collect_it(collectible)
local function rotate_around_entity(targetEntity, radius, stepAngle)
local entityPos = entity.get_entity_coords(targetEntity)
local startAngle = 0
local endAngle = 360
local lookFront_Time = os.clock()
local lookBehind_Time = nil
local e_Time = os.clock()
local e_State = true
-- Perform the 360-degree rotation
for angle = startAngle, endAngle - stepAngle, stepAngle do
if not feat.on then
return
end
if e_State then
if (os.clock() - e_Time) > 0.053 then
controls.set_control_normal(0, 51, 0.0)
e_State = false
e_Time = os.clock()
end
else
if (os.clock() - e_Time) > 0.053 then
controls.set_control_normal(0, 51, 1.0)
e_State = true
e_Time = os.clock()
end
end
if lookFront_Time then
lookBehind_Time = nil
if (os.clock() - lookFront_Time) > 0.15 then
lookFront_Time = nil
lookBehind_Time = os.clock()
end
controls.set_control_normal(0, 26, 0.0)
elseif lookBehind_Time then
lookFront_Time = nil
if (os.clock() - lookBehind_Time) > 0.15 then
lookBehind_Time = nil
lookFront_Time = os.clock()
end
controls.set_control_normal(0, 26, 1.0)
end
system.yield()
-- Convert angle to radians
local radians = math.rad(angle)
-- Calculate the new position based on the angle
local xOffset = radius * math.cos(radians)
local yOffset = radius * math.sin(radians)
-- Calculate the new position
local newPos = {
x = entityPos.x + xOffset,
y = entityPos.y + yOffset,
z = entityPos.z
}
teleport_myself(newPos.x, newPos.y, newPos.z)
end
end
local start_Time = os.clock()
local verifyCollectible_Time = nil
local checkNearbyCollectibles_Time = nil
local collectibleEntity = 0
-- Check for any matching collectibles for up to {initialWait_Time} seconds
while (os.clock() - start_Time) < initialWait_Time do -- Going under {initialWait_Time} will makes it not collect 100% of the time depending how fast the world generates on TP.
if not feat.on then
return
end
system.yield()
-- Timeout of 6 seconds if a matched collectible was found, but still not collected
if verifyCollectible_Time and (os.clock() - verifyCollectible_Time) > 6 then
return