forked from IceDoomfist/Stand-Heist-Control
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Heist Control.lua
7055 lines (6154 loc) · 362 KB
/
Heist Control.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
--[[ To everyone who uses Heist Control.lua
Developed and maintenanced by @icedoomfist on Discord
This script is only compatible with Stand Lua API: https://stand.gg/
Stand Heist Control contains some global, local variables and stats from Heist Control V2 & Master Unlocker Lua Scripts for 2Take1 and UnknownCheats
Thanks for allowing me to use your code, jhowkNx: https://github.com/jhowkNx
I've often been contacting on Discord, testing some developing features, sharing information like stats, global and local variables and other codes each other.
Heist Control V2: https://github.com/jhowkNx/Heist-Control-v2
Master Unlocker: https://github.com/jhowkNx/Master-Unlocker
UnknownCheats: https://www.unknowncheats.me/forum/grand-theft-auto-v/
]]--
--[[ To developers who wanna learn about stats, global and local variables or Stand Lua Script API by looking into Heist Control.lua
Here are bunch of links that will be useful to you.
I hope your learning goes well.
Lua Tutorial: https://www.tutorialspoint.com/lua/index.htm
- To learn basics of Lua programming language
Stand Lua API Documentation: https://stand.gg/help/lua-api-documentation
- To learn Stand Lua API
UnknownCheats: https://www.unknowncheats.me/forum/grand-theft-auto-v/
- To learn stats, global and local variables
FiveM Docs - Game References: https://docs.fivem.net/docs/game-references/
- Controls, Blips, etc
Labels: https://github.com/root-cause/v-labels
- To find stats, global and local variables by yourself.
GTA Online Decompiled Scripts: https://github.com/root-cause/v-decompiled-scripts (Recommended)
- To find stats, global and local variables by yourself. 'freemode.c' and 'tuneables_processing.c' are oftenly used to me.
]]--
--- Lua Script Settings
--- Important
HC_VERSION = "V 3.4.5"
CODED_GTAO_VERSION = 1.70 -- b3407
---
--- Directory Settings
HC_DIR = filesystem.store_dir() .. "Heist Control\\"
FolderDirs = {
Img = HC_DIR .. "Image\\",
Setting = HC_DIR .. "Setting\\",
Lang = HC_DIR .. "Language\\",
HaxUI = HC_DIR .. "GTAHaXUI\\",
}
FileDirs = {
Native = filesystem.scripts_dir() .. "lib\\natives-1681379138\\g.lua",
Setting = FolderDirs.Setting .. "Setting.txt",
Log = FolderDirs.Setting .. "Log.txt",
}
LangDirs = {
Custom = FolderDirs.Lang .. "Custom.txt",
Chinese = FolderDirs.Lang .. "Chinese.txt",
English = FolderDirs.Lang .. "English.txt",
French = FolderDirs.Lang .. "French.txt",
German = FolderDirs.Lang .. "German.txt",
Italian = FolderDirs.Lang .. "Italian.txt",
Japanese = FolderDirs.Lang .. "Japanese.txt",
Korean = FolderDirs.Lang .. "Korean.txt",
Polish = FolderDirs.Lang .. "Polish.txt",
Portuguese = FolderDirs.Lang .. "Portuguese.txt",
Russian = FolderDirs.Lang .. "Russian.txt",
Spanish = FolderDirs.Lang .. "Spanish.txt",
Vietnamese = FolderDirs.Lang .. "Vietnamese.txt",
}
---
--- Core Functions
function ADD_MP_INDEX(stat)
local Exceptions = {
"MP_CHAR_STAT_RALLY_ANIM",
"MP_CHAR_ARMOUR_1_COUNT",
"MP_CHAR_ARMOUR_2_COUNT",
"MP_CHAR_ARMOUR_3_COUNT",
"MP_CHAR_ARMOUR_4_COUNT",
"MP_CHAR_ARMOUR_5_COUNT",
}
for _, exception in pairs(Exceptions) do
if stat == exception then
return "MP" .. util.get_char_slot() .. "_" .. stat
end
end
if not string.contains(stat, "MP_") and not string.contains(stat, "MPPLY_") then
return "MP" .. util.get_char_slot() .. "_" .. stat
end
return stat
end
function STAT_SET_INT(stat, value)
STATS.STAT_SET_INT(util.joaat(ADD_MP_INDEX(stat)), value, true)
end
function STAT_SET_BOOL(stat, value)
STATS.STAT_SET_BOOL(util.joaat(ADD_MP_INDEX(stat)), value, true)
end
function STAT_SET_STRING(stat, value)
STATS.STAT_SET_STRING(util.joaat(ADD_MP_INDEX(stat)), value, true)
end
function STAT_SET_MASKED_INT(stat, value1, value2)
STATS.STAT_SET_MASKED_INT(util.joaat(ADD_MP_INDEX(stat)), value1, value2, 8, true)
end
function SET_PACKED_STAT_BOOL_CODE(stat, value)
STATS.SET_PACKED_STAT_BOOL_CODE(stat, value, util.get_char_slot())
end
function STAT_INCREMENT(stat, value)
STATS.STAT_INCREMENT(util.joaat(ADD_MP_INDEX(stat)), value, true)
end
function STAT_GET_INT(stat)
local IntPTR = memory.alloc_int()
STATS.STAT_GET_INT(util.joaat(ADD_MP_INDEX(stat)), IntPTR, -1)
return memory.read_int(IntPTR)
end
function STAT_GET_STRING(stat)
return STATS.STAT_GET_STRING(util.joaat(ADD_MP_INDEX(stat)), -1)
end
function SET_INT_GLOBAL(global, value)
memory.write_int(memory.script_global(global), value)
end
function SET_INT_TUNABLE_GLOBAL(hash, value)
memory.write_int(memory.script_global(262145 + memory.tunable_offset(hash)), value)
end
function SET_FLOAT_GLOBAL(global, value)
memory.write_float(memory.script_global(global), value)
end
function SET_FLOAT_TUNABLE_GLOBAL(hash, value)
memory.write_float(memory.script_global(262145 + memory.tunable_offset(hash)), value)
end
function GET_INT_GLOBAL(global)
return memory.read_int(memory.script_global(global))
end
function SET_PACKED_INT_GLOBAL(start_global, end_global, value)
for i = start_global, end_global do
SET_INT_GLOBAL(262145 + i, value)
end
end
function SET_PACKED_INT_TUNABLE_GLOBAL(start_hash, end_hash, value)
for i = memory.tunable_offset(start_hash), memory.tunable_offset(end_hash) do
SET_INT_GLOBAL(262145 + i, value)
end
end
function SET_INT_LOCAL(script, script_local, value)
if memory.script_local(script, script_local) ~= 0 then
memory.write_int(memory.script_local(script, script_local), value)
end
end
function SET_FLOAT_LOCAL(script, script_local, value)
if memory.script_local(script, script_local) ~= 0 then
memory.write_float(memory.script_local(script, script_local), value)
end
end
function GET_INT_LOCAL(script, script_local)
if memory.script_local(script, script_local) ~= 0 then
local ReadLocal = memory.read_int(memory.script_local(script, script_local))
if ReadLocal ~= nil then
return ReadLocal
end
end
end
function SET_BIT(bits, place) -- Credit goes to WiriScript
return (bits | (1 << place))
end
function SET_LOCAL_BIT(script, script_local, bit)
if memory.script_local(script, script_local) ~= 0 then
local Addr = memory.script_local(script, script_local)
memory.write_int(Addr, SET_BIT(memory.read_int(Addr), bit))
end
end
---
--- Folders and Log Functions
for _, folder in pairs(FolderDirs) do
if not filesystem.exists(folder) then
filesystem.mkdirs(folder)
end
end
function CREATE_OR_RESET_FILE(dir)
local open = io.open(dir, "w+")
open:write("")
open:close()
end
if not filesystem.exists(FileDirs.Log) then
CREATE_OR_RESET_FILE(FileDirs.Log)
end
function LOG(message)
local open = io.open(FileDirs.Log, "a+")
open:write(os.date("[%m/%d/%Y %I:%M:%S %p]") .. " " .. message .. "\n")
open:close()
end
function ERROR_LOG(error_message)
LOG("Heist Control Version: " .. HC_VERSION)
LOG("| Heist Control - ERROR | " .. error_message .. "\n")
util.toast("Heist Control | ERROR " .. "\n\n" .. error_message)
util.yield_once()
util.stop_script()
end
---
--- Settings for HC
DEFAULT_SETTINGS = { -- { setting_type, setting_value }
{ "Language", "Unknown" },
{ "Notification Type", "Stand" },
{ "Notification Icon", "HC Logo" },
{ "Notification Icon Code", "Logo" },
{ "Notification Color", "Black" },
{ "Notification Color Code", "140" },
{ "Timer Color", "White" },
{ "Timer Color Code", "FFFFFFFF" },
{ "Saved Command Name", "N/A" },
}
function WRITE_DEFAULT_SETTINGS()
local FinalSettings = {}
for i = 1, #DEFAULT_SETTINGS do
table.insert(FinalSettings, DEFAULT_SETTINGS[i][1] .. ": " .. DEFAULT_SETTINGS[i][2])
end
CREATE_OR_RESET_FILE(FileDirs.Setting)
local open = io.open(FileDirs.Setting, "a+")
for _, setting in pairs(FinalSettings) do
open:write(setting .. "\n")
end
open:close()
end
if not filesystem.exists(FileDirs.Setting) then
CREATE_OR_RESET_FILE(FileDirs.Setting)
WRITE_DEFAULT_SETTINGS()
end
Settings = {}
function READ_SETTING(type)
local Values = {}
local open = io.open(FileDirs.Setting, "r")
for line in open:lines() do
table.insert(Values, line)
end
open:close()
for idx, setting in pairs(Values) do
Settings[idx] = { nil, nil } -- { type, value }
local i, j = string.find(setting, ": ")
if i and j ~= nil then
Settings[idx][1] = string.sub(setting, 0, i - 1)
Settings[idx][2] = string.sub(setting, j + 1, string.len(setting))
end
end
local IsOldFormat = false
for i = 1, #Settings do -- If Settings.txt file is consisted of old format
for j = 1, 5 do
if Settings[i][1] == tostring(j) then
IsOldFormat = true
Settings[i][1] = DEFAULT_SETTINGS[i][1]
Settings[i][2] = DEFAULT_SETTINGS[i][2]
end
end
end
if IsOldFormat then
WRITE_DEFAULT_SETTINGS()
end
for i = 1, #Settings do
if Settings[i][1] == type then
return Settings[i][2]
end
end
for i = 1, #DEFAULT_SETTINGS do
WRITE_DEFAULT_SETTINGS()
if DEFAULT_SETTINGS[i][1] == type then
return DEFAULT_SETTINGS[i][2]
end
end
end
function WRITE_SETTING(type, value)
for i = 1, #Settings do
if Settings[i][1] == type then
Settings[i][2] = value
break
elseif i == #Settings then
for j = 1, #DEFAULT_SETTINGS do
if DEFAULT_SETTINGS[j][1] == type then
Settings[j][1] = type
Settings[j][2] = value
end
end
end
end
local FinalSettings = {}
for i = 1, #Settings do
table.insert(FinalSettings, Settings[i][1] .. ": " .. Settings[i][2])
end
CREATE_OR_RESET_FILE(FileDirs.Setting)
local open = io.open(FileDirs.Setting, "a+")
for _, setting in pairs(FinalSettings) do
open:write(setting .. "\n")
end
open:close()
end
---
--- Translation Settings
if READ_SETTING("Language") == "Unknown" then -- When execute HC for first time
WRITE_SETTING("Language", "English")
local LangByStandCodes = {
{ "zh", "Chinese - 中文" },
{ "fr", "French - français" },
{ "de", "German - Deutsch" },
{ "it", "Italian - Italiano" },
{ "jp", "Japanese - 日本語" },
{ "ko", "Korean - 한국어" },
{ "pl", "Polish - Polski" },
{ "pt", "Portuguese - Português" },
{ "ru", "Russian - русский" },
{ "es", "Spanish - Español" },
{ "vi", "Vietnamese - Tiếng Việt" },
}
for i = 1, #LangByStandCodes do
if lang.get_current() == LangByStandCodes[i][1] then
WRITE_SETTING("Language", LangByStandCodes[i][2])
end
end
end
function DIR_TO_FILE_NAME(folder, dir)
local _, i = string.find(dir, folder .. "\\")
local j = string.find(dir, ".txt")
return string.sub(dir, i + 1, j - 1)
end
Translations = {}
function LOAD_LANG(dir)
for _, lang_dir in pairs(LangDirs) do
if dir == lang_dir then
if filesystem.exists(lang_dir) then
local open = io.open(lang_dir, "r")
for line in open:lines() do
table.insert(Translations, line)
end
open:close()
else
ERROR_LOG(DIR_TO_FILE_NAME("Language", lang_dir) .. " language file for HC doesn't exist." .. "\n\n" .. "Please install HC from the Repository for Lua Scripts of Stand menu!")
end
end
end
end
LanguageByDirs = {
{ "Custom", LangDirs.Custom },
{ "Chinese - 中文", LangDirs.Chinese },
{ "English", LangDirs.English },
{ "French - français", LangDirs.French },
{ "German - Deutsch", LangDirs.German },
{ "Italian - Italiano", LangDirs.Italian },
{ "Japanese - 日本語", LangDirs.Japanese },
{ "Korean - 한국어", LangDirs.Korean },
{ "Polish - Polski", LangDirs.Polish },
{ "Portuguese - Português", LangDirs.Portuguese },
{ "Russian - русский", LangDirs.Russian },
{ "Spanish - Español", LangDirs.Spanish },
{ "Vietnamese - Tiếng Việt", LangDirs.Vietnamese },
}
for i = 1, #LanguageByDirs do
if READ_SETTING("Language") == LanguageByDirs[i][1] then
LOAD_LANG(LanguageByDirs[i][2])
end
end
TransFormat = " = "
function TRANSLATE(text)
local Translation = ""
for i = 1, #Translations do
local _, j = string.find(Translations[i], TransFormat)
if j ~= nil then
if not string.contains(Translations[i], "#") then
Translation = string.sub(Translations[i], j + 1, string.len(Translations[i]))
end
end
if Translation ~= "" then
if Translations[i] == text .. TransFormat .. Translation then
return Translation
end
end
end
return text
end
---
--- Other Functions
function SHOW_IMG(img_name, max_passed_time) -- Credit goes to LanceScript Reloaded
if filesystem.exists(FolderDirs.Img .. img_name) then
local ImgAlpha = 0
local IncreasedImgAlpha = 0.01
util.create_tick_handler(function()
ImgAlpha = ImgAlpha + IncreasedImgAlpha
if ImgAlpha > 1 then
ImgAlpha = 1
elseif ImgAlpha < 0 then
ImgAlpha = 0
return false
end
end)
local Img = directx.create_texture(FolderDirs.Img .. img_name)
local StartedTime = os.clock()
util.create_tick_handler(function()
directx.draw_texture(Img, 0.07, 0.07, 0.5, 0.5, 0.5, 0.5, 0, 1, 1, 1, ImgAlpha)
local PassedTime = os.clock() - StartedTime
if PassedTime > max_passed_time then
IncreasedImgAlpha = -0.01
end
if ImgAlpha == 0 then
return false
end
end)
end
end
function TELEPORT(x, y, z)
PED.SET_PED_COORDS_KEEP_VEHICLE(players.user_ped(), x, y, z)
end
function SET_HEADING(heading)
ENTITY.SET_ENTITY_HEADING(players.user_ped(), heading)
end
function HEX_TO_RGBA(type, hex) -- https://gist.github.com/jasonbradley/4357406
local Color = {}
if type == "Game" then
Color.r = tonumber("0x" .. string.sub(hex, 1, 2))
Color.g = tonumber("0x" .. string.sub(hex, 3, 4))
Color.b = tonumber("0x" .. string.sub(hex, 5, 6))
Color.a = tonumber("0x" .. string.sub(hex, 7, 8))
elseif type == "Stand" then
Color.r = tonumber("0x" .. string.sub(hex, 1, 2)) / 255
Color.g = tonumber("0x" .. string.sub(hex, 3, 4)) / 255
Color.b = tonumber("0x" .. string.sub(hex, 5, 6)) / 255
Color.a = tonumber("0x" .. string.sub(hex, 7, 8)) / 255
end
return Color
end
function GET_ACTIVE_PROFILE()
local Dir = filesystem.stand_dir() .. "Meta State.txt"
for type, value in pairs(util.read_colons_and_tabs_file(Dir)) do
if type == "Active Profile" then
return value
end
end
return "Main"
end
function GET_STAND_STATE(config_name)
local Dir = filesystem.stand_dir() .. "Profiles\\" .. GET_ACTIVE_PROFILE() .. ".txt"
for type, value in pairs(util.read_colons_and_tabs_file(Dir)) do
if string.contains(type, config_name) then
return value
end
end
return "FF1493FF" -- https://www.rapidtables.com/web/color/pink-color.html, Hot Pink
end
function GET_CURSOR_POSITION()
local Text = menu.get_active_list_cursor_text(true, true) -- '2/12' format
local i = string.find(Text, "/")
return tonumber(string.sub(Text, 0, i - 1)) -- Returns '2'
end
function IS_HELP_MSG_DISPLAYED(label) -- Credit goes to @jerry1234508 on Discord
HUD.BEGIN_TEXT_COMMAND_IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(label)
return HUD.END_TEXT_COMMAND_IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(0)
end
function DELETE_OBJECT_BY_HASH(hash)
for _, ent in pairs(entities.get_all_objects_as_pointers()) do
if entities.get_model_hash(ent) == hash then
entities.delete(ent)
end
end
end
function IS_PLAYER_PED(ped)
if PED.GET_PED_TYPE(ped) < 4 then
return true
else
return false
end
end
function IS_IN_ARCADE()
local PlayerPos = players.get_position(players.user())
local Interior = INTERIOR.GET_INTERIOR_AT_COORDS(PlayerPos.x, PlayerPos.y, PlayerPos.z)
if Interior == 278273 or Interior == 278529 then
return true
else
return false
end
end
function FORCE_CLOUD_SAVE()
STATS.STAT_SAVE(0, 0, 3, 0) -- Same as menu.trigger_commands("forcecloudsave"), https://github.com/jonaaa20/RecoverySuite
repeat util.yield_once() until HUD.BUSYSPINNER_IS_ON()
util.arspinner_enable()
repeat util.yield_once() until not HUD.BUSYSPINNER_IS_ON()
util.arspinner_disable()
end
function START_SCRIPT(name)
if HUD.IS_PAUSE_MENU_ACTIVE() then
NOTIFY(TRANSLATE("Please close your opened pause menu to open any apps remotely."))
return
end
SCRIPT.REQUEST_SCRIPT(name)
repeat util.yield_once() until SCRIPT.HAS_SCRIPT_LOADED(name)
SYSTEM.START_NEW_SCRIPT(name, 5000)
SCRIPT.SET_SCRIPT_AS_NO_LONGER_NEEDED(name)
end
function IS_SCRIPT_ACTIVE(script_name)
return SCRIPT.GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(util.joaat(script_name)) > 0
end
function IS_HOST_OF_THIS_SCRIPT(script_name)
local is_host = false
if IS_SCRIPT_ACTIVE(script_name) then
util.spoof_script(script_name, function()
is_host = NETWORK.NETWORK_IS_HOST_OF_THIS_SCRIPT()
end)
end
return is_host
end
function REQUEST_TO_BE_HOST(script_name)
if IS_SCRIPT_ACTIVE(script_name) then
if not IS_HOST_OF_THIS_SCRIPT(script_name) then
local st_time = util.current_time_millis() + 3000
repeat
util.request_script_host(script_name)
util.yield()
until IS_HOST_OF_THIS_SCRIPT(script_name) or util.current_time_millis() > st_time or not IS_SCRIPT_ACTIVE(script_name)
return IS_HOST_OF_THIS_SCRIPT(script_name)
else
return true
end
end
return false
end
function REQUEST_WEAPON_ASSET(weapon_hash)
WEAPON.REQUEST_WEAPON_ASSET(weapon_hash,31,0)
while not WEAPON.HAS_WEAPON_ASSET_LOADED(weapon_hash) do
util.yield()
end
end
---
--- Notification Settings
if filesystem.exists(FolderDirs.Img .. "Logo.ytd") then
util.register_file(FolderDirs.Img .. "Logo.ytd")
else
if READ_SETTING("Notification Type") == "In-Game" and READ_SETTING("Notification Icon") == "HC Logo" then
ERROR_LOG(TRANSLATE("HC Logo image file doesn't exist.") .. "\n\n" .. TRANSLATE("Please re-enable 'Stand > Lua Scripts > Repository > Heist Control' to fix!"))
end
end
function NOTIFY(Message)
local Icon = READ_SETTING("Notification Icon Code")
local Color = READ_SETTING("Notification Color Code")
LOG(Message)
if READ_SETTING("Notification Type") == "Stand" then
util.toast(TRANSLATE("Heist Control") .. " | " .. TRANSLATE("Notification") .. "\n\n" .. Message)
elseif READ_SETTING("Notification Type") == "In-Game" then
if util.is_session_started() then -- Credit goes to WiriScript
GRAPHICS.REQUEST_STREAMED_TEXTURE_DICT(Icon, 1)
repeat util.yield_once() until GRAPHICS.HAS_STREAMED_TEXTURE_DICT_LOADED(Icon)
util.BEGIN_TEXT_COMMAND_THEFEED_POST(Message)
HUD.THEFEED_SET_BACKGROUND_COLOR_FOR_NEXT_POST(Color)
HUD.END_TEXT_COMMAND_THEFEED_POST_MESSAGETEXT(Icon, Icon, true, 1, TRANSLATE("Heist Control"), "~c~" .. TRANSLATE("Notification"))
HUD.END_TEXT_COMMAND_THEFEED_POST_TICKER(true, false)
else
util.toast(TRANSLATE("Heist Control") .. " | " .. TRANSLATE("Notification") .. " - SP" .. "\n\n" .. Message)
end
elseif READ_SETTING("Notification Type") == "No Notification" then
-- Nothing Does
else
WRITE_SETTING("Notification Type", "Stand")
util.toast(TRANSLATE("Heist Control") .. " | " .. TRANSLATE("Notification") .. "\n\n" .. Message)
end
end
---
--- General Settings
util.require_natives(1681379138)
util.keep_running()
if CODED_GTAO_VERSION ~= tonumber(NETWORK.GET_ONLINE_VERSION()) then
NOTIFY
(
TRANSLATE("Supported GTA:O Version:") .. " " .. CODED_GTAO_VERSION .. "\n" ..
TRANSLATE("Current GTA:O Version:") .. " " .. tonumber(NETWORK.GET_ONLINE_VERSION()) .. "\n\n" ..
TRANSLATE("Please download the latest Heist Control or wait for developer's patching!")
)
util.stop_script()
end
util.on_stop(function()
HUD.UNLOCK_MINIMAP_POSITION()
end)
INT_MIN = -2147483648
INT_MAX = 2147483647
SubBlip, SubControlBlip = 0, 0
util.create_tick_handler(function()
SubBlip = HUD.GET_FIRST_BLIP_INFO_ID(760)
SubControlBlip = HUD.GET_FIRST_BLIP_INFO_ID(773)
end)
if READ_SETTING("Timer Color") == "Stand" then
WRITE_SETTING("Timer Color Code", GET_STAND_STATE("AR Colour"))
end
if not filesystem.exists(FileDirs.Native) then
ERROR_LOG(TRANSLATE("Native file for HC doesn't exist.") .. "\n\n" .. TRANSLATE("Please re-enable 'Stand > Lua Scripts > Repository > natives-1681379138' or please join HC DC server to get support!"))
end
if SCRIPT_MANUAL_START and not SCRIPT_SILENT_START then
SHOW_IMG("HC Banner.png", 2.5)
end
---
---
--- Main Lists
menu.divider(menu.my_root(), TRANSLATE("Heist Control") .. " " .. HC_VERSION)
PERICO_HEIST = menu.list(menu.my_root(), TRANSLATE("Cayo Perico Heist"), {"hccp"}, TRANSLATE("Max payout for this heist") .. "\n\n" .. TRANSLATE("- Under $2.550.000 per run") .. "\n" .. TRANSLATE("- Under $4.100.000 per hour") .. "\n\n" .. TRANSLATE("You won't get money if you don't keep money limitation!"), function(); end)
CASINO_HEIST = menu.list(menu.my_root(), TRANSLATE("Diamond Casino Heist"), {"hccah"}, TRANSLATE("Max payout for this heist") .. "\n\n" .. TRANSLATE("- Under $3.650.000 per run") .. "\n\n" .. TRANSLATE("You won't get money if you don't keep money limitation!"), function(); end)
DOOMS_HEIST = menu.list(menu.my_root(), TRANSLATE("Doomsday Heist"), {"hcdooms"}, TRANSLATE("Max payout for this heist") .. "\n\n" .. TRANSLATE("- Under $2.550.000 per run") .. "\n\n" .. TRANSLATE("You won't get money if you don't keep money limitation!"), function(); end)
CLASSIC_HEISTS = menu.list(menu.my_root(), TRANSLATE("Classic Heist"), {"hcclassic"}, TRANSLATE("Max payout for this heist") .. "\n\n" .. TRANSLATE("- Fleeca Heist ~ Pacific Standard Heist: Under $15.000.000 per run") .. "\n\n" .. TRANSLATE("You won't get money if you don't keep money limitation!"), function(); end)
ROBBERYS = menu.list(menu.my_root(), TRANSLATE("Robberies"), {"hcrob"}, "", function(); end)
MISSONS = menu.list(menu.my_root(), TRANSLATE("Missions"), {"hcmission"}, "", function(); end)
MASTER_UNLOCKER = menu.list(menu.my_root(), TRANSLATE("Master Unlocker"), {"hcmu"}, "", function(); end)
TOOLS = menu.list(menu.my_root(), TRANSLATE("Tools"), {"hctool"}, "", function(); end)
INFOS = menu.list(menu.my_root(), TRANSLATE("Settings And About HC"), {"hcinfo"}, "", function(); end)
---
---
--- Cayo Perico Heist
util.yield()
CAYO_PRESETS = menu.list(PERICO_HEIST, TRANSLATE("Automated Presets"), {}, TRANSLATE("You should enable the preset until the end of the heist!") .. "\n\n" .. TRANSLATE("Enabling one of these presets will complete all of setups, and set as max payout, $2.55 Millions. It will be affected to all of heist players."), function(); end)
menu.divider(CAYO_PRESETS, TRANSLATE("Recommended"))
QuickPresetTunables = {
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_SAPPHIRE_PANTHER_STATUE"),
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_MADRAZO_FILES"),
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_PINK_DIAMOND"),
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_BEARER_BONDS"),
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_PEARL_NECKLACE"),
memory.tunable_offset("IH_PRIMARY_TARGET_VALUE_TEQUILA"),
}
QUICK_PRESET = menu.toggle(CAYO_PRESETS, TRANSLATE("Quick Preset (1 - 4P)"), {"hccpquick"}, TRANSLATE("There is only a primary target, depends on which you selected. All players of the heist session can get the max payout ($2.45M) by only getting it."), function()
if menu.get_value(QUICK_PRESET) then
menu.trigger_commands("hccprefreshboard")
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == QUICK_PRESET then
CayoPresetLists[i][2] = true
end
end
for i = 1, 5 do
for j = 1, #ForCayoPresets[i] do
menu.set_help_text(ForCayoPresets[i][j][1], TRANSLATE("This feature has been controlled by another feature.") .. "\n" .. "- " .. menu.get_menu_name(CAYO_PRESETS) .. " > " .. menu.get_menu_name(QUICK_PRESET))
end
end
else
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == QUICK_PRESET then
CayoPresetLists[i][2] = false
end
end
for i = 1, 5 do
for j = 1, #ForCayoPresets[i] do
menu.apply_default_state(ForCayoPresets[i][j][1])
menu.set_help_text(ForCayoPresets[i][j][1], ForCayoPresets[i][j][2])
end
end
end
while menu.get_value(QUICK_PRESET) do
STAT_SET_INT("H4CNF_BS_GEN", 262143)
STAT_SET_INT("H4CNF_BS_ENTR", 63)
STAT_SET_INT("H4CNF_BS_ABIL", 63)
STAT_SET_INT("H4CNF_WEP_DISRP", 3)
STAT_SET_INT("H4CNF_ARM_DISRP", 3)
STAT_SET_INT("H4CNF_HEL_DISRP", 3)
STAT_SET_INT("H4CNF_BOLTCUT", 4424)
STAT_SET_INT("H4CNF_UNIFORM", 5256)
STAT_SET_INT("H4CNF_GRAPPEL", 5156)
STAT_SET_INT("H4CNF_APPROACH", -1)
STAT_SET_INT("H4LOOT_CASH_I", 0)
STAT_SET_INT("H4LOOT_CASH_C", 0)
STAT_SET_INT("H4LOOT_WEED_I", 0)
STAT_SET_INT("H4LOOT_WEED_C", 0)
STAT_SET_INT("H4LOOT_COKE_I", 0)
STAT_SET_INT("H4LOOT_COKE_C", 0)
STAT_SET_INT("H4LOOT_GOLD_I", 0)
STAT_SET_INT("H4LOOT_GOLD_C", 0)
STAT_SET_INT("H4LOOT_PAINT", 0)
STAT_SET_INT("H4LOOT_CASH_V", 0)
STAT_SET_INT("H4LOOT_COKE_V", 0)
STAT_SET_INT("H4LOOT_GOLD_V", 0)
STAT_SET_INT("H4LOOT_PAINT_V", 0)
STAT_SET_INT("H4LOOT_WEED_V", 0)
STAT_SET_INT("H4LOOT_CASH_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_CASH_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_WEED_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_WEED_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_COKE_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_COKE_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_PAINT_SCOPED", 0)
STAT_SET_INT("H4CNF_WEAPONS", 1)
STAT_SET_INT("H4_MISSIONS", 65283)
STAT_SET_INT("H4_PROGRESS", 126823)
STAT_SET_INT("H4_PLAYTHROUGH_STATUS", 5)
local Value = menu.get_value(QUICK_PRESET_TARGET)
local CPTargets = { -- { stat_set_int, set_int_global }
{ 5, 262145 + QuickPresetTunables[1] },
{ 4, 262145 + QuickPresetTunables[2] },
{ 3, 262145 + QuickPresetTunables[3] },
{ 2, 262145 + QuickPresetTunables[4] },
{ 1, 262145 + QuickPresetTunables[5] },
{ 0, 262145 + QuickPresetTunables[6] },
}
STAT_SET_INT("H4CNF_TARGET", CPTargets[Value][1])
SET_INT_GLOBAL(CPTargets[Value][2], 2455000)
menu.set_value(CP_REM_FEE, true)
menu.set_value(CP_NON_HOST_CUT, 100)
menu.set_value(CP_NON_HOST_CUT_LOOP, false)
menu.set_value(CP_HOST_CUT, 100)
menu.set_value(CP_HOST_CUT_LOOP, true)
menu.set_value(CP_2P_CUT, 145)
menu.set_value(CP_2P_CUT_LOOP, true)
menu.set_value(CP_3P_CUT, 145)
menu.set_value(CP_3P_CUT_LOOP, true)
menu.set_value(CP_4P_CUT, 145)
menu.set_value(CP_4P_CUT_LOOP, true)
util.yield_once()
end
end)
QUICK_PRESET_TARGET = menu.list_select(CAYO_PRESETS, TRANSLATE("Select Primary Target"), {}, "(" .. menu.get_menu_name(QUICK_PRESET) .. ")", {
{ 1, TRANSLATE("Sapphire Panther"), {}, "" },
{ 2, TRANSLATE("Madrazo Files"), {}, "" },
{ 3, TRANSLATE("Pink Diamond"), {}, "" },
{ 4, TRANSLATE("Bearer Bonds"), {}, "" },
{ 5, TRANSLATE("Ruby Necklace"), {}, "" },
{ 6, TRANSLATE("Tequila"), {}, "" },
}, 1, function(); end)
---
menu.divider(CAYO_PRESETS, TRANSLATE("Automated Presets"))
AUTOMATED_SOLO = menu.list(CAYO_PRESETS, TRANSLATE("1 Player"), {}, "", function(); end)
AUTOAMTED_SOLO_SAPPHIRE = menu.toggle(AUTOMATED_SOLO, TRANSLATE("Sapphire Panther"), {"hccp1psp"}, "", function()
if menu.get_value(AUTOAMTED_SOLO_SAPPHIRE) then
STAT_SET_INT("H4CNF_BOLTCUT", -1)
STAT_SET_INT("H4CNF_UNIFORM", -1)
STAT_SET_INT("H4CNF_GRAPPEL", -1)
STAT_SET_INT("H4_MISSIONS", -1)
STAT_SET_INT("H4CNF_WEAPONS", 1)
STAT_SET_INT("H4CNF_TROJAN", 5)
STAT_SET_INT("H4_PLAYTHROUGH_STATUS", 100)
STAT_SET_INT("H4CNF_TARGET", 5)
STAT_SET_INT("H4LOOT_CASH_I", 5551206)
STAT_SET_INT("H4LOOT_CASH_I_SCOPED", 5551206)
STAT_SET_INT("H4LOOT_CASH_C", 0)
STAT_SET_INT("H4LOOT_CASH_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_COKE_I", 4884838)
STAT_SET_INT("H4LOOT_COKE_I_SCOPED", 4884838)
STAT_SET_INT("H4LOOT_COKE_C", 0)
STAT_SET_INT("H4LOOT_COKE_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_I", 0)
STAT_SET_INT("H4LOOT_GOLD_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_C", 192)
STAT_SET_INT("H4LOOT_GOLD_C_SCOPED", 192)
STAT_SET_INT("H4LOOT_WEED_I", 0)
STAT_SET_INT("H4LOOT_WEED_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_WEED_C", 0)
STAT_SET_INT("H4LOOT_WEED_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_PAINT", 120)
STAT_SET_INT("H4LOOT_PAINT_SCOPED", 120)
STAT_SET_INT("H4LOOT_CASH_V", 224431)
STAT_SET_INT("H4LOOT_COKE_V", 353863)
STAT_SET_INT("H4LOOT_GOLD_V", 471817)
STAT_SET_INT("H4LOOT_PAINT_V", 353863)
STAT_SET_INT("H4LOOT_WEED_V", 0)
STAT_SET_INT("H4_PROGRESS", 131055)
STAT_SET_INT("H4CNF_BS_GEN", -1)
STAT_SET_INT("H4CNF_BS_ENTR", -1)
STAT_SET_INT("H4CNF_BS_ABIL", -1)
STAT_SET_INT("H4CNF_WEP_DISRP", 3)
STAT_SET_INT("H4CNF_ARM_DISRP", 3)
STAT_SET_INT("H4CNF_HEL_DISRP", 3)
STAT_SET_INT("H4CNF_APPROACH", -1)
menu.trigger_commands("hccprefreshboard")
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == AUTOAMTED_SOLO_SAPPHIRE then
CayoPresetLists[i][2] = true
end
end
for i = 1, 3 do
for j = 1, #ForCayoPresets[i] do
menu.set_help_text(ForCayoPresets[i][j][1], TRANSLATE("This feature has been controlled by another feature.") .. "\n" .. "- " .. menu.get_menu_name(CAYO_PRESETS) .. " > " .. menu.get_menu_name(menu.get_parent(AUTOAMTED_SOLO_SAPPHIRE)) .. " > " .. menu.get_menu_name(AUTOAMTED_SOLO_SAPPHIRE))
end
end
else
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == AUTOAMTED_SOLO_SAPPHIRE then
CayoPresetLists[i][2] = false
end
end
for i = 1, 3 do
for j = 1, #ForCayoPresets[i] do
menu.apply_default_state(ForCayoPresets[i][j][1])
menu.set_help_text(ForCayoPresets[i][j][1], ForCayoPresets[i][j][2])
end
end
end
while menu.get_value(AUTOAMTED_SOLO_SAPPHIRE) do
menu.set_value(CP_REM_FEE, false)
menu.set_value(CP_NON_HOST_CUT, 100)
menu.set_value(CP_NON_HOST_CUT_LOOP, false)
menu.set_value(CP_HOST_CUT, 100)
menu.set_value(CP_HOST_CUT_LOOP, true)
util.yield_once()
end
end)
AUTOMATED_SOLO_RUBY = menu.toggle(AUTOMATED_SOLO, TRANSLATE("Ruby Necklace"), {"hccp1prn"}, "", function()
if menu.get_value(AUTOMATED_SOLO_RUBY) then
STAT_SET_INT("H4CNF_TARGET", 1)
STAT_SET_INT("H4LOOT_CASH_I", 9208137)
STAT_SET_INT("H4LOOT_CASH_I_SCOPED", 9208137)
STAT_SET_INT("H4LOOT_CASH_C", 0)
STAT_SET_INT("H4LOOT_CASH_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_COKE_I", 1048704)
STAT_SET_INT("H4LOOT_COKE_I_SCOPED", 1048704)
STAT_SET_INT("H4LOOT_COKE_C", 0)
STAT_SET_INT("H4LOOT_COKE_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_I", 0)
STAT_SET_INT("H4LOOT_GOLD_I_SCOPED", 0)
STAT_SET_INT("H4LOOT_GOLD_C", 255)
STAT_SET_INT("H4LOOT_GOLD_C_SCOPED", 255)
STAT_SET_INT("H4LOOT_WEED_I", 4206596)
STAT_SET_INT("H4LOOT_WEED_I_SCOPED", 4206596)
STAT_SET_INT("H4LOOT_WEED_C", 0)
STAT_SET_INT("H4LOOT_WEED_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_PAINT", 127)
STAT_SET_INT("H4LOOT_PAINT_SCOPED", 127)
STAT_SET_INT("H4LOOT_CASH_V", 424431)
STAT_SET_INT("H4LOOT_COKE_V", 848863)
STAT_SET_INT("H4LOOT_GOLD_V", 1131817)
STAT_SET_INT("H4LOOT_PAINT_V", 848863)
STAT_SET_INT("H4LOOT_WEED_V", 679090)
STAT_SET_INT("H4_PROGRESS", 131055)
STAT_SET_INT("H4CNF_BS_GEN", 262143)
STAT_SET_INT("H4CNF_BS_ENTR", 63)
STAT_SET_INT("H4CNF_BS_ABIL", 63)
STAT_SET_INT("H4CNF_WEP_DISRP", 3)
STAT_SET_INT("H4CNF_ARM_DISRP", 3)
STAT_SET_INT("H4CNF_HEL_DISRP", 3)
STAT_SET_INT("H4CNF_APPROACH", -1)
STAT_SET_INT("H4CNF_BOLTCUT", 4424)
STAT_SET_INT("H4CNF_UNIFORM", 5256)
STAT_SET_INT("H4CNF_GRAPPEL", 5156)
STAT_SET_INT("H4_MISSIONS", -1)
STAT_SET_INT("H4CNF_WEAPONS", 1)
STAT_SET_INT("H4CNF_TROJAN", 5)
STAT_SET_INT("H4_PLAYTHROUGH_STATUS", 100)
menu.trigger_commands("hccprefreshboard")
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == AUTOMATED_SOLO_RUBY then
CayoPresetLists[i][2] = true
end
end
for i = 1, 3 do
for j = 1, #ForCayoPresets[i] do
menu.set_help_text(ForCayoPresets[i][j][1], TRANSLATE("This feature has been controlled by another feature.") .. "\n" .. "- " .. menu.get_menu_name(CAYO_PRESETS) .. " > " .. menu.get_menu_name(menu.get_parent(AUTOMATED_SOLO_RUBY)) .. " > " .. menu.get_menu_name(AUTOMATED_SOLO_RUBY))
end
end
else
for i = 1, #CayoPresetLists do
if CayoPresetLists[i][1] == AUTOMATED_SOLO_RUBY then
CayoPresetLists[i][2] = false
end
end
for i = 1, 3 do
for j = 1, #ForCayoPresets[i] do
menu.apply_default_state(ForCayoPresets[i][j][1])
menu.set_help_text(ForCayoPresets[i][j][1], ForCayoPresets[i][j][2])
end
end
end
while menu.get_value(AUTOMATED_SOLO_RUBY) do
menu.set_value(CP_REM_FEE, false)
menu.set_value(CP_NON_HOST_CUT, 100)
menu.set_value(CP_NON_HOST_CUT_LOOP, false)
menu.set_value(CP_HOST_CUT, 100)
menu.set_value(CP_HOST_CUT_LOOP, true)
util.yield_once()
end
end)
---
AUTOMATED_2P = menu.list(CAYO_PRESETS, TRANSLATE("2 Players"), {}, "", function(); end)
AUTOAMTED_2P_SAPPHIRE = menu.toggle_loop(AUTOMATED_2P, TRANSLATE("Sapphire Panther"), {"hccp2psp"}, "", function()
if menu.get_value(AUTOAMTED_2P_SAPPHIRE) then
STAT_SET_INT("H4CNF_BOLTCUT", 4424)
STAT_SET_INT("H4CNF_UNIFORM", 5256)
STAT_SET_INT("H4CNF_GRAPPEL", 5156)
STAT_SET_INT("H4_MISSIONS", -1)
STAT_SET_INT("H4CNF_WEAPONS", 1)
STAT_SET_INT("H4CNF_TROJAN", 5)
STAT_SET_INT("H4_PLAYTHROUGH_STATUS", 100)
STAT_SET_INT("H4CNF_TARGET", 5)
STAT_SET_INT("H4LOOT_CASH_I", 2359448)
STAT_SET_INT("H4LOOT_CASH_I_SCOPED", 2359448)
STAT_SET_INT("H4LOOT_CASH_C", 0)
STAT_SET_INT("H4LOOT_CASH_C_SCOPED", 0)
STAT_SET_INT("H4LOOT_COKE_I", 2)
STAT_SET_INT("H4LOOT_COKE_I_SCOPED", 2)
STAT_SET_INT("H4LOOT_COKE_C", 0)