This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
samurais_scripts.lua
7257 lines (7007 loc) · 292 KB
/
samurais_scripts.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
---@diagnostic disable: undefined-global, lowercase-global, undefined-field
require('lib/samurais_utils')
require('lib/Translations')
require('data/objects')
require('data/actions')
require('data/refs')
SCRIPT_VERSION = '1.1.4' -- v1.1.4
TARGET_BUILD = '3274' -- Only YimResupplier needs a version check.
TARGET_VERSION = '1.69'
CURRENT_BUILD = Game.GetBuildNumber()
CURRENT_VERSION = Game.GetOnlineVersion()
Samurais_scripts = gui.add_tab("Samurai's Scripts")
local loading_label = ""
local start_loading_anim = false
default_config = {
shortcut_anim = {},
saved_vehicles = {},
Regen = false,
-- objectiveTP = false,
disableTooltips = false,
phoneAnim = false,
disableProps = false,
sprintInside = false,
lockpick = false,
rod = false,
clumsy = false,
manualFlags = false,
controllable = false,
looped = false,
upperbody = false,
freeze = false,
usePlayKey = false,
replaceSneakAnim = false,
replacePointAct = false,
disableActionMode = false,
disableSound = false,
npc_godMode = false,
-- Triggerbot = false,
aimEnemy = false,
autoKill = false,
runaway = false,
laserSight = false,
disableUiSounds = false,
driftMode = false,
DriftTires = false,
DriftSmoke = false,
driftMinigame = false,
speedBoost = false,
nosvfx = false,
hornLight = false,
nosPurge = false,
insta180 = false,
flappyDoors = false,
rgbLights = false,
loud_radio = false,
launchCtrl = false,
popsNbangs = false,
limitVehOptions = false,
missiledefense = false,
louderPops = false,
autobrklight = false,
holdF = false,
keepWheelsTurned = false,
noJacking = false,
useGameLang = false,
bypass_casino_bans = false,
force_poker_cards = false,
set_dealers_poker_cards = false,
force_roulette_wheel = false,
rig_slot_machine = false,
autoplay_slots = false,
autoplay_cap = false,
heist_cart_autograb = false,
flares_forall = false,
real_plane_speed = false,
nosPower = 10,
lightSpeed = 1,
DriftPowerIncrease = 1,
laser_switch = 0,
lang_idx = 0,
DriftIntensity = 0,
autoplay_chips_cap = 0,
laser_choice = "proj_laser_enemy",
LANG = 'en-US',
current_lang = 'English',
}
LANG = lua_cfg.read("LANG")
current_lang = lua_cfg.read("current_lang")
Regen = lua_cfg.read("Regen")
-- objectiveTP = lua_cfg.read("objectiveTP")
phoneAnim = lua_cfg.read("phoneAnim")
sprintInside = lua_cfg.read("sprintInside")
lockPick = lua_cfg.read("lockPick")
replaceSneakAnim = lua_cfg.read("replaceSneakAnim")
replacePointAct = lua_cfg.read("replacePointAct")
disableActionMode = lua_cfg.read("disableActionMode")
rod = lua_cfg.read("rod")
clumsy = lua_cfg.read("clumsy")
manualFlags = lua_cfg.read("manualFlags")
controllable = lua_cfg.read("controllable")
looped = lua_cfg.read("looped")
upperbody = lua_cfg.read("upperbody")
freeze = lua_cfg.read("freeze")
disableProps = lua_cfg.read("disableProps")
npc_godMode = lua_cfg.read("npc_godMode")
usePlayKey = lua_cfg.read("usePlayKey")
shortcut_anim = lua_cfg.read("shortcut_anim")
-- Triggerbot = lua_cfg.read("Triggerbot")
aimEnemy = lua_cfg.read("aimEnemy")
autoKill = lua_cfg.read("autoKill")
runaway = lua_cfg.read("runaway")
laserSight = lua_cfg.read("laserSight")
laser_switch = lua_cfg.read("laser_switch")
laser_choice = lua_cfg.read("laser_choice")
driftMode = lua_cfg.read("driftMode")
DriftIntensity = lua_cfg.read("DriftIntensity")
DriftPowerIncrease = lua_cfg.read("DriftPowerIncrease")
DriftTires = lua_cfg.read("DriftTires")
DriftSmoke = lua_cfg.read("DriftSmoke")
driftMinigame = lua_cfg.read("driftMinigame")
speedBoost = lua_cfg.read("speedBoost")
nosvfx = lua_cfg.read("nosvfx")
hornLight = lua_cfg.read("hornLight")
nosPurge = lua_cfg.read("nosPurge")
nosPower = lua_cfg.read("nosPower")
lightSpeed = lua_cfg.read("lightSpeed")
loud_radio = lua_cfg.read("loud_radio")
launchCtrl = lua_cfg.read("launchCtrl")
popsNbangs = lua_cfg.read("popsNbangs")
louderPops = lua_cfg.read("louderPops")
limitVehOptions = lua_cfg.read("limitVehOptions")
missiledefense = lua_cfg.read("missiledefense")
autobrklight = lua_cfg.read("autobrklight")
rgbLights = lua_cfg.read("rgbLights")
holdF = lua_cfg.read("holdF")
keepWheelsTurned = lua_cfg.read("keepWheelsTurned")
noJacking = lua_cfg.read("noJacking")
insta180 = lua_cfg.read("insta180")
flares_forall = lua_cfg.read("flares_forall")
real_plane_speed = lua_cfg.read("real_plane_speed")
tab1Sound = true
tab2Sound = true
tab3Sound = true
is_playing_anim = false
is_shortcut_anim = false
anim_music = false
is_playing_scenario = false
is_playing_radio = false
-- aimBool = false
HashGrabber = false
drew_laser = false
isCrouched = false
is_handsUp = false
is_car = false
is_quad = false
is_boat = false
is_bike = false
validModel = false
has_xenon = false
tire_smoke = false
purge_started = false
nos_started = false
twostep_started = false
is_typing = false
open_sounds_window = false
started_lct = false
launch_active = false
started_popSound = false
started_popSound2 = false
customSmokeCol = false
pedGrabber = false
ped_grabbed = false
vehicleGrabber = false
vehicle_grabbed = false
carpool = false
show_npc_veh_ctrls = false
stop_searching = false
hijack_started = false
sound_btn_off = false
is_drifting = false
start_rgb_loop = false
flag = 0
grp_anim_index = 0
attached_ped = 0
grabbed_veh = 0
thisVeh = 0
anim_index = 0
scenario_index = 0
npc_index = 0
actions_switch = 0
Entity = 0
timerA = 0
timerB = 0
lastVeh = 0
defaultXenon = 0
vehSound_index = 0
driftSmokeIndex = 0
selected_smoke_col = 0
pBus = 0
dummyDriver = 0
dummyCopCar = 0
sound_index1 = 0
sound_index2 = 0
sound_switch = 0
radio_index = 0
drift_points = 0
drift_extra_pts = 0
straight_counter = 0
drift_time = 0
drift_multiplier = 1
quote_alpha = 1
pedthrowF = 10
tdBtn = 21
stop_anim = 47
play_anim = 256
previous_anim = 316
next_anim = 317
drift_streak_text = ""
drift_extra_text = ""
actions_search = ""
currentMvmt = ""
currentStrf = ""
currentWmvmt = ""
search_term = ""
smokeHex = ""
random_quote = ""
selected_sound = {}
selected_radio = {}
smokePtfx_t = {}
nosptfx_t = {}
purgePtfx_t = {}
lctPtfx_t = {}
popSounds_t = {}
popsPtfx_t = {}
npc_blips = {}
spawned_npcs = {}
plyrProps = {}
npcProps = {}
selfPTFX = {}
npcPTFX = {}
curr_playing_anim = {}
laserPtfx_T = {}
chosen_anim = {}
---@param musicSwitch string
---@param station? string
function play_music(musicSwitch, station)
script.run_in_fiber(function(mp)
if musicSwitch == "start" then
local myPos = self.get_pos()
local bone_idx = PED.GET_PED_BONE_INDEX(self.get_ped(), 24818)
local pbus_model = 345756458
local dummy_model = 0xE75B4B1C
if Game.requestModel(pbus_model) then
pBus = VEHICLE.CREATE_VEHICLE(pbus_model, myPos.x, myPos.y, (myPos.z - 10), 0, true, false, false)
ENTITY.SET_ENTITY_ALPHA(pBus, 0.0, false)
ENTITY.FREEZE_ENTITY_POSITION(pBus, true)
ENTITY.SET_ENTITY_COLLISION(pBus, false, 0)
ENTITY.SET_ENTITY_INVINCIBLE(pBus, true)
VEHICLE.SET_VEHICLE_ALLOW_HOMING_MISSLE_LOCKON(pBus, false, 0)
end
mp:sleep(500)
if ENTITY.DOES_ENTITY_EXIST(pBus) then
entities.take_control_of(pBus, 300)
if Game.requestModel(dummy_model) then
dummyDriver = PED.CREATE_PED("PED_TYPE_CIVMALE", dummy_model, myPos.x, myPos.y, (myPos.z + 40), 0, true, false)
if ENTITY.DOES_ENTITY_EXIST(dummyDriver) then
entities.take_control_of(dummyDriver, 300)
ENTITY.SET_ENTITY_ALPHA(dummyDriver, 0.0, false)
PED.SET_PED_INTO_VEHICLE(dummyDriver, pBus, -1)
PED.SET_PED_CONFIG_FLAG(dummyDriver, 402, true)
PED.SET_PED_CONFIG_FLAG(dummyDriver, 398, true)
PED.SET_PED_CONFIG_FLAG(dummyDriver, 167, true)
PED.SET_PED_CONFIG_FLAG(dummyDriver, 251, true)
PED.SET_PED_CONFIG_FLAG(dummyDriver, 255, true)
PED.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(dummyDriver, true)
AUDIO.FORCE_USE_AUDIO_GAME_OBJECT(pBus, vehicles.get_vehicle_display_name(2765724541))
VEHICLE.SET_VEHICLE_ENGINE_ON(pBus, true, false, false)
AUDIO.SET_VEHICLE_RADIO_LOUD(pBus, true)
VEHICLE.SET_VEHICLE_LIGHTS(pBus, 1)
mp:sleep(500)
AUDIO.SET_VEH_RADIO_STATION(pBus, station)
mp:sleep(500)
ENTITY.ATTACH_ENTITY_TO_ENTITY(pBus, self.get_ped(), bone_idx, -4.0, -1.3, -1.0, 0.0, 90.0, -90.0, false, true,
false, true, 1, true, 1)
else
gui.show_error("Samurais Scripts", "Failed to start music!")
return
end
end
else
gui.show_error("Samurais Scripts", "Failed to start music!")
return
end
elseif musicSwitch == "stop" then
if ENTITY.DOES_ENTITY_EXIST(dummyDriver) then
ENTITY.SET_ENTITY_AS_MISSION_ENTITY(dummyDriver, true, true)
mp:sleep(200)
ENTITY.DELETE_ENTITY(dummyDriver)
dummyDriver = 0
end
if ENTITY.DOES_ENTITY_EXIST(pBus) then
ENTITY.SET_ENTITY_AS_MISSION_ENTITY(pBus, true, true)
mp:sleep(200)
ENTITY.DELETE_ENTITY(pBus)
pBus = 0
end
end
end)
end
function dummyCop()
script.run_in_fiber(function(dcop)
if current_vehicle ~= nil and current_vehicle ~= 0 then
local polhash, veh_bone1, veh_bone2, attach_mode
if is_car then
if VEHICLE.DOES_VEHICLE_HAVE_ROOF(current_vehicle) and not VEHICLE.IS_VEHICLE_A_CONVERTIBLE(current_vehicle) then
polhash, veh_bone1, veh_bone2, attach_mode = 0xD1E0B7D7, "interiorlight", "interiorlight", 1
else
polhash, veh_bone1, veh_bone2, attach_mode = 0xD1E0B7D7, "interiorlight", "dashglow", 2
end
elseif is_bike or is_quad then
polhash, veh_bone1, veh_bone2, attach_mode = 0xFDEFAEC3, "chassis_dummy", "chassis_dummy", 1
else
gui.show_error("Samurais Scripts", "Can not equip a fake siren on this vehicle.")
end
if Game.requestModel(polhash) then
dummyCopCar = VEHICLE.CREATE_VEHICLE(polhash, 0.0, 0.0, 0.0, 0, true, false, false)
ENTITY.SET_ENTITY_COLLISION(dummyCopCar, false, 0)
VEHICLE.SET_VEHICLE_ALLOW_HOMING_MISSLE_LOCKON(dummyCopCar, false, 0)
VEHICLE.SET_VEHICLE_UNDRIVEABLE(dummyCopCar, true)
ENTITY.SET_ENTITY_ALPHA(dummyCopCar, 49.0, false)
ENTITY.SET_ENTITY_INVINCIBLE(dummyCopCar, true)
end
if ENTITY.DOES_ENTITY_EXIST(dummyCopCar) then
entities.take_control_of(dummyCopCar, 300)
local boneidx1 = ENTITY.GET_ENTITY_BONE_INDEX_BY_NAME(dummyCopCar, veh_bone1)
local boneidx2 = ENTITY.GET_ENTITY_BONE_INDEX_BY_NAME(self.get_veh(), veh_bone2)
VEHICLE.SET_VEHICLE_LIGHTS(dummyCopCar, 1)
ENTITY.SET_ENTITY_HEADING(dummyCopCar, ENTITY.GET_ENTITY_HEADING(self.get_veh()))
if attach_mode == 1 then
ENTITY.ATTACH_ENTITY_BONE_TO_ENTITY_BONE(dummyCopCar, self.get_veh(), boneidx1, boneidx2, false, true)
else
ENTITY.ATTACH_ENTITY_TO_ENTITY(dummyCopCar, self.get_veh(), boneidx2, 0.46, 0.4, -0.9, 0.0, 0.0, 0.0, false, true,
false, true, 1, true, 1)
end
dcop:sleep(500)
VEHICLE.SET_VEHICLE_SIREN(dummyCopCar, true)
VEHICLE.SET_VEHICLE_HAS_MUTED_SIRENS(dummyCopCar, false)
AUDIO.TRIGGER_SIREN_AUDIO(dummyCopCar)
VEHICLE.SET_VEHICLE_ACT_AS_IF_HAS_SIREN_ON(self.get_veh(), true)
VEHICLE.SET_VEHICLE_CAUSES_SWERVING(self.get_veh(), true)
VEHICLE.SET_VEHICLE_INDICATOR_LIGHTS(self.get_veh(), 0, true)
VEHICLE.SET_VEHICLE_INDICATOR_LIGHTS(self.get_veh(), 1, true)
end
end
end)
end
function showDriftCounter(text)
wolrdPos = self.get_pos()
local _, screenX, screenY = HUD.GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(wolrdPos.x, wolrdPos.y, wolrdPos.z, screenX, screenY)
HUD.BEGIN_TEXT_COMMAND_DISPLAY_TEXT("TWOSTRINGS")
HUD.SET_TEXT_COLOUR(255, 192, 0, 200)
HUD.SET_TEXT_SCALE(1, 0.7)
HUD.SET_TEXT_OUTLINE()
HUD.SET_TEXT_FONT(7)
HUD.SET_TEXT_CENTRE(true)
HUD.SET_TEXT_DROP_SHADOW()
HUD.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text)
HUD.END_TEXT_COMMAND_DISPLAY_TEXT(screenX, (screenY - 0.6), 0)
end
function showDriftExtra(text)
wolrdPos = self.get_pos()
local _, screenX, screenY = HUD.GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(wolrdPos.x, wolrdPos.y, wolrdPos.z, screenX, screenY)
HUD.BEGIN_TEXT_COMMAND_DISPLAY_TEXT("TWOSTRINGS")
HUD.SET_TEXT_COLOUR(255, 192, 0, 200)
HUD.SET_TEXT_SCALE(1, 0.4)
HUD.SET_TEXT_OUTLINE()
HUD.SET_TEXT_FONT(7)
HUD.SET_TEXT_CENTRE(true)
HUD.SET_TEXT_DROP_SHADOW()
HUD.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text)
HUD.END_TEXT_COMMAND_DISPLAY_TEXT(screenX, (screenY - 0.5142), 0)
end
function checkDriftCollision()
local crashed = false
local text = ""
local entity = ENTITY.GET_LAST_ENTITY_HIT_BY_ENTITY_(self.get_veh())
local entity_type = Game.getEntityTypeString(entity)
if ENTITY.IS_ENTITY_A_PED(entity) then
text = "Hit and run"
crashed = false
elseif entity_type == "Vehicle" then
text = "Samir, you're breaking the car!"
crashed = true
elseif entity_type == "Object" then
-- ENTITY.GET_ENTITY_MODEL(entity) ~= 3300474446 and ENTITY.GET_ENTITY_MODEL(entity) ~= 3231494328 and ENTITY.GET_ENTITY_MODEL(entity) ~= 3008087081 and ENTITY.GET_ENTITY_MODEL(entity) ~= 874602658
if ENTITY.GET_ENTITY_SPEED(self.get_veh()) > 5 then
text = "Wrecking ball"
crashed = false
else
text = "Samir, you're breaking the car!"
crashed = true
end
elseif entity_type == "None" or entity_type == "Invalid" then
text = "Samir, you're breaking the car!"
crashed = true
end
return crashed, text
end
function bankDriftPoints_SP(points)
local chars_T = {
{hash = 225514697, int = 0},
{hash = 2602752943, int = 1},
{hash = 2608926626, int = 2},
}
script.run_in_fiber(function()
for _, v in ipairs(chars_T) do
if ENTITY.GET_ENTITY_MODEL(self.get_ped()) == v.hash then
stats.set_int("SP"..tostring(v.int).."_TOTAL_CASH", stats.get_int("SP"..tostring(v.int).."_TOTAL_CASH") + points)
AUDIO.PLAY_SOUND_FRONTEND(-1, "LOCAL_PLYR_CASH_COUNTER_INCREASE", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS")
end
end
end)
end
Samurais_scripts:add_imgui(function()
local YY, MM, DD, H, M, S = CLOCK.GET_LOCAL_TIME(YY, MM, DD, H, M, S)
if MM < 10 then
MM = 0 .. MM
end
if DD < 10 then
DD = 0 .. DD
end
if H < 10 then
H = 0 .. H
end
if M < 10 then
M = 0 .. M
end
if S < 10 then
S = 0 .. S
end
local date_str = DD .. "-" .. months_T[tonumber(MM)] .. "-" .. YY
local time_str = H .. ":" .. M .. ":" .. S
local combined_str = "\10" .. " " .. time_str .. "\10 " .. date_str .. " " .. "\10\10"
ImGui.Dummy(1, 10); ImGui.Dummy(150, 1); ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 80)
UI.coloredButton(combined_str, '#A67C00', '#A67C00', '#A67C00', 0.15)
ImGui.PopStyleVar()
ImGui.Dummy(1, 10); ImGui.SeparatorText("About")
UI.wrappedText("A collection of scripts aimed towards adding some roleplaying and fun elements to the game.", 25)
ImGui.Dummy(1, 10)
ImGui.BulletText("Script Version: v" .. SCRIPT_VERSION)
ImGui.BulletText("Game Version: b" .. TARGET_BUILD .. " Online " .. TARGET_VERSION)
ImGui.Dummy(1, 20); ImGui.SeparatorText("Quote Of The Day"); ImGui.Spacing()
UI.coloredText(random_quote, 'white', quote_alpha, 24)
end)
--[[
*self*
]]
self_tab = Samurais_scripts:add_tab(translateLabel("Self"))
self_tab:add_imgui(function()
Regen, RegenUsed = ImGui.Checkbox(translateLabel("Auto-Heal"), Regen, true)
UI.helpMarker(false, translateLabel("autoheal_tooltip"))
if RegenUsed then
lua_cfg.save("Regen", Regen)
UI.widgetSound("Nav2")
end
-- objectiveTP, objectiveTPUsed = ImGui.Checkbox(translateLabel("objectiveTP"), objectiveTP, true)
-- UI.helpMarker(false, translateLabel("objectiveTP_tooltip"))
-- if objectiveTPUsed then
-- lua_cfg.save("objectiveTP", objectiveTP)
-- UI.widgetSound("Nav2")
-- end
replaceSneakAnim, rsanimUsed = ImGui.Checkbox(translateLabel("CrouchCB"), replaceSneakAnim, true)
UI.helpMarker(false, translateLabel("Crouch_tooltip"))
if rsanimUsed then
lua_cfg.save("replaceSneakAnim", replaceSneakAnim)
UI.widgetSound("Nav2")
end
replacePointAct, rpaUsed = ImGui.Checkbox(translateLabel("rpaCB"), replacePointAct, true)
UI.helpMarker(false, translateLabel("rpa_tooltip"))
if rpaUsed then
lua_cfg.save("replacePointAct", replacePointAct)
UI.widgetSound("Nav2")
end
phoneAnim, phoneAnimUsed = ImGui.Checkbox(translateLabel("PhoneAnimCB"), phoneAnim, true)
UI.helpMarker(false, translateLabel("PhoneAnim_tooltip"))
if phoneAnimUsed then
lua_cfg.save("phoneAnim", phoneAnim)
UI.widgetSound("Nav2")
end
sprintInside, sprintInsideUsed = ImGui.Checkbox(translateLabel("SprintInsideCB"), sprintInside, true)
UI.helpMarker(false,
translateLabel("SprintInside_tooltip"))
if sprintInsideUsed then
lua_cfg.save("sprintInside", sprintInside)
UI.widgetSound("Nav2")
end
lockPick, lockPickUsed = ImGui.Checkbox(translateLabel("LockpickCB"), lockPick, true)
UI.helpMarker(false,
translateLabel("Lockpick_tooltip"))
if lockPickUsed then
lua_cfg.save("lockPick", lockPick)
UI.widgetSound("Nav2")
end
disableActionMode, actionModeUsed = ImGui.Checkbox(translateLabel("ActionModeCB"), disableActionMode, true)
UI.helpMarker(false, translateLabel("ActionMode_tooltip"))
if actionModeUsed then
lua_cfg.save("disableActionMode", disableActionMode)
UI.widgetSound("Nav2")
end
clumsy, clumsyUsed = ImGui.Checkbox("Clumsy", clumsy, true)
UI.helpMarker(false, translateLabel("clumsy_tt"))
if clumsyUsed then
rod = false
lua_cfg.save("rod", false)
lua_cfg.save("clumsy", clumsy)
UI.widgetSound("Nav2")
end
if clumsy and clumsyUsed then
script.run_in_fiber(function()
if not PED.CAN_PED_RAGDOLL(self.get_ped()) then
gui.show_warning("Samurais Scripts", "This option will not work if you're blocking ragdoll. Please make sure 'No Ragdoll' option is disabled in YimMennu.")
end
end)
end
rod, rodUsed = ImGui.Checkbox("Ragdoll On Demand", rod, true)
UI.helpMarker(false, translateLabel("rod_tt"))
if rodUsed then
clumsy = false
lua_cfg.save("rod", rod)
lua_cfg.save("clumsy", false)
UI.widgetSound("Nav2")
end
if rod and rodUsed then
script.run_in_fiber(function()
if not PED.CAN_PED_RAGDOLL(self.get_ped()) then
gui.show_warning("Samurais Scripts", "This option will not work if you're blocking ragdoll. Please make sure 'No Ragdoll' option is disabled in YimMennu.")
end
end)
end
end)
Actions = self_tab:add_tab("Actions")
local function updatefilteredAnims()
filteredAnims = {}
for _, anim in ipairs(animlist) do
if string.find(string.lower(anim.name), string.lower(actions_search)) then
table.insert(filteredAnims, anim)
end
end
table.sort(animlist, function(a, b)
return a.name < b.name
end)
end
local function displayFilteredAnims()
updatefilteredAnims()
local animNames = {}
for _, anim in ipairs(filteredAnims) do
table.insert(animNames, anim.name)
end
anim_index, used = ImGui.ListBox("##animlistbox", anim_index, animNames, #filteredAnims)
end
local function updatefilteredScenarios()
filteredScenarios = {}
for _, scene in ipairs(ped_scenarios) do
if string.find(string.lower(scene.name), string.lower(actions_search)) then
table.insert(filteredScenarios, scene)
end
end
end
local function displayFilteredScenarios()
updatefilteredScenarios()
local scenarioNames = {}
for _, scene in ipairs(filteredScenarios) do
table.insert(scenarioNames, scene.name)
end
scenario_index, used = ImGui.ListBox("##scenarioList", scenario_index, scenarioNames, #filteredScenarios)
end
local function updateNpcs()
filteredNpcs = {}
for _, npc in ipairs(npcList) do
table.insert(filteredNpcs, npc)
end
table.sort(filteredNpcs, function(a, b)
return a.name < b.name
end)
end
local function displayNpcs()
updateNpcs()
local npcNames = {}
for _, npc in ipairs(filteredNpcs) do
table.insert(npcNames, npc.name)
end
npc_index, used = ImGui.Combo("##npcList", npc_index, npcNames, #filteredNpcs)
end
local function setmanualflag()
if looped then
flag_loop = 1
else
flag_loop = 0
end
if freeze then
flag_freeze = 2
else
flag_freeze = 0
end
if upperbody then
flag_upperbody = 16
else
flag_upperbody = 0
end
if controllable then
flag_control = 32
else
flag_control = 0
end
flag = flag_loop + flag_freeze + flag_upperbody + flag_control
end
local function setdrunk()
script.run_in_fiber(function()
-- PED.SET_PED_USING_ACTION_MODE(PLAYER.PLAYER_ID(), false, -1, -1)
while not STREAMING.HAS_CLIP_SET_LOADED("move_m@drunk@verydrunk") and not STREAMING.HAS_CLIP_SET_LOADED("move_strafe@first_person@drunk") do
STREAMING.REQUEST_CLIP_SET("move_m@drunk@verydrunk")
STREAMING.REQUEST_CLIP_SET("move_strafe@first_person@drunk")
coroutine.yield()
end
PED.SET_PED_MOVEMENT_CLIPSET(self.get_ped(), "move_m@drunk@verydrunk", 1.0)
PED.SET_PED_WEAPON_MOVEMENT_CLIPSET(self.get_ped(), "move_m@drunk@verydrunk")
PED.SET_PED_STRAFE_CLIPSET(self.get_ped(), "move_strafe@first_person@drunk")
WEAPON.SET_WEAPON_ANIMATION_OVERRIDE(self.get_ped(), 2231620617)
currentMvmt = "move_m@drunk@verydrunk"
currentWmvmt = "move_m@drunk@verydrunk"
currentStrf = "move_strafe@first_person@drunk"
end)
end
local function sethoe()
script.run_in_fiber(function()
while not STREAMING.HAS_CLIP_SET_LOADED("move_f@maneater") do
STREAMING.REQUEST_CLIP_SET("move_f@maneater")
coroutine.yield()
end
PED.RESET_PED_WEAPON_MOVEMENT_CLIPSET(self.get_ped())
PED.RESET_PED_STRAFE_CLIPSET(self.get_ped())
PED.SET_PED_MOVEMENT_CLIPSET(self.get_ped(), "move_f@maneater", 1.0)
WEAPON.SET_WEAPON_ANIMATION_OVERRIDE(self.get_ped(), 1830115867)
currentMvmt = "move_f@maneater"
currentWmvmt = ""
currentStrf = ""
end)
end
local function setgangsta()
script.run_in_fiber(function()
while not STREAMING.HAS_CLIP_SET_LOADED("move_m@gangster@ng") do
STREAMING.REQUEST_CLIP_SET("move_m@gangster@ng")
coroutine.yield()
end
while not STREAMING.HAS_CLIP_SET_LOADED("move_strafe@gang") do
STREAMING.REQUEST_CLIP_SET("move_strafe@gang")
coroutine.yield()
end
PED.RESET_PED_WEAPON_MOVEMENT_CLIPSET(self.get_ped())
PED.SET_PED_MOVEMENT_CLIPSET(self.get_ped(), "move_m@gangster@ng", 0.3)
PED.SET_PED_STRAFE_CLIPSET(self.get_ped(), "move_strafe@gang")
WEAPON.SET_WEAPON_ANIMATION_OVERRIDE(self.get_ped(), 1917483703)
currentMvmt = "move_m@gangster@ng"
currentStrf = "move_strafe@gang"
currentWmvmt = ""
end)
end
local function setlester()
script.run_in_fiber(function()
while not STREAMING.HAS_CLIP_SET_LOADED("move_heist_lester") do
STREAMING.REQUEST_CLIP_SET("move_heist_lester")
coroutine.yield()
end
PED.RESET_PED_WEAPON_MOVEMENT_CLIPSET(self.get_ped())
PED.RESET_PED_STRAFE_CLIPSET(self.get_ped())
PED.SET_PED_MOVEMENT_CLIPSET(self.get_ped(), "move_heist_lester", 0.4)
WEAPON.SET_WEAPON_ANIMATION_OVERRIDE(self.get_ped(), 2231620617)
currentMvmt = "move_heist_lester"
currentWmvmt = ""
currentStrf = ""
end)
end
local function setballistic()
script.run_in_fiber(function()
while not STREAMING.HAS_CLIP_SET_LOADED("anim_group_move_ballistic") and not STREAMING.HAS_CLIP_SET_LOADED("move_strafe@ballistic") do
STREAMING.REQUEST_CLIP_SET("anim_group_move_ballistic")
STREAMING.REQUEST_CLIP_SET("move_strafe@ballistic")
coroutine.yield()
end
PED.RESET_PED_WEAPON_MOVEMENT_CLIPSET(self.get_ped())
PED.SET_PED_MOVEMENT_CLIPSET(self.get_ped(), "anim_group_move_ballistic", 1)
PED.SET_PED_STRAFE_CLIPSET(self.get_ped(), "move_strafe@ballistic")
WEAPON.SET_WEAPON_ANIMATION_OVERRIDE(self.get_ped(), 1429513766)
currentMvmt = "anim_group_move_ballistic"
currentStrf = "move_strafe@ballistic"
currentWmvmt = ""
end)
end
function onAnimInterrupt()
script.run_in_fiber(function()
if Game.requestAnimDict(curr_playing_anim.curr_dict) then
TASK.CLEAR_PED_TASKS_IMMEDIATELY(self.get_ped())
TASK.TASK_PLAY_ANIM(self.get_ped(), curr_playing_anim.curr_dict, curr_playing_anim.curr_anim, 4.0, -4.0, -1, curr_playing_anim.curr_flag, 1.0, false, false, false)
end
end)
end
Actions:add_imgui(function()
ImGui.PushItemWidth(270)
actions_search, used = ImGui.InputTextWithHint("##searchBar", translateLabel("search_hint"), actions_search, 32)
ImGui.PopItemWidth()
if ImGui.IsItemActive() then
is_typing = true
else
is_typing = false
end
ImGui.BeginTabBar("Actionz", ImGuiTabBarFlags.None)
if ImGui.BeginTabItem(translateLabel("animations")) then
if tab1Sound then
UI.widgetSound("Nav")
tab1Sound = false
tab2Sound = true
tab3Sound = true
end
ImGui.PushItemWidth(345)
displayFilteredAnims()
ImGui.PopItemWidth()
info = filteredAnims[anim_index + 1]
ImGui.Separator(); manualFlags, used = ImGui.Checkbox("Edit Flags", manualFlags, true)
if used then
lua_cfg.save("manualFlags", manualFlags)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("flags_tt"))
ImGui.SameLine(); disableProps, used = ImGui.Checkbox("Disable Props", disableProps, true)
if used then
lua_cfg.save("disableProps", disableProps)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("DisableProps_tt"))
if manualFlags then
ImGui.Separator()
controllable, used = ImGui.Checkbox(translateLabel("Allow Control"), controllable, true)
if used then
lua_cfg.save("controllable", controllable)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("AllowControl_tt"))
ImGui.SameLine(); ImGui.Dummy(27, 1); ImGui.SameLine()
looped, used = ImGui.Checkbox("Loop", looped, true)
if used then
lua_cfg.save("looped", looped)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("looped_tt"))
upperbody, used = ImGui.Checkbox(translateLabel("Upper Body Only"), upperbody, true)
if used then
lua_cfg.save("upperbody", upperbody)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("UpperBodyOnly_tt"))
ImGui.SameLine(); ImGui.Dummy(1, 1); ImGui.SameLine()
freeze, used = ImGui.Checkbox(translateLabel("Freeze"), freeze, true)
if used then
lua_cfg.save("freeze", freeze)
UI.widgetSound("Nav2")
end
UI.helpMarker(false, translateLabel("Freeze_tt"))
end
if ImGui.Button(translateLabel("generic_play_btn") .. "##anim") then
if not ped_grabbed then
UI.widgetSound("Select")
local coords = ENTITY.GET_ENTITY_COORDS(self.get_ped(), false)
local heading = ENTITY.GET_ENTITY_HEADING(self.get_ped())
local forwardX = ENTITY.GET_ENTITY_FORWARD_X(self.get_ped())
local forwardY = ENTITY.GET_ENTITY_FORWARD_Y(self.get_ped())
local boneIndex = PED.GET_PED_BONE_INDEX(self.get_ped(), info.boneID)
local bonecoords = PED.GET_PED_BONE_COORDS(self.get_ped(), info.boneID)
if manualFlags then
setmanualflag()
else
flag = info.flag
end
curr_playing_anim = {curr_dict = info.dict, curr_anim = info.anim, curr_flag = flag, curr_name = info.name}
if lua_Fn.str_contains(curr_playing_anim.curr_name, "DJ") then
if not is_playing_radio and not anim_music then
play_music("start", "RADIO_22_DLC_BATTLE_MIX1_RADIO")
anim_music = true
end
else
if anim_music then
play_music("stop")
anim_music = false
end
end
playSelected(self.get_ped(), flag, selfprop1, selfprop2, selfloopedFX, selfSexPed, boneIndex, coords, heading, forwardX,
forwardY, bonecoords, "self", plyrProps, selfPTFX)
is_playing_anim = true
else
UI.widgetSound("Error")
gui.show_error("Samurais Scripts", translateLabel("You can not play animations while grabbing an NPC."))
end
end
ImGui.SameLine()
if ImGui.Button(translateLabel("generic_stop_btn") .. "##anim") then
if is_playing_anim then
UI.widgetSound("Cancel")
if PED.IS_PED_SITTING_IN_ANY_VEHICLE(self.get_ped()) then
local veh = PED.GET_VEHICLE_PED_IS_IN(self.get_ped(), false)
local mySeat = Game.getPedVehicleSeat(self.get_ped())
cleanup()
PED.SET_PED_INTO_VEHICLE(self.get_ped(), self.get_veh(), mySeat)
else
cleanup()
local current_coords = self.get_pos()
ENTITY.SET_ENTITY_COORDS_NO_OFFSET(self.get_ped(), current_coords.x, current_coords.y, current_coords.z, true,
false, false)
end
if anim_music then
play_music("stop")
anim_music = false
end
is_playing_anim = false
else
UI.widgetSound("Error")
end
end
UI.toolTip(false, translateLabel("stopAnims_tt"))
ImGui.SameLine()
local errCol = {}
local errSound = false
if plyrProps[1] ~= nil then
errCol = { 104, 247, 114, 0.2 }
errSound = false
else
errCol = { 225, 0, 0, 0.5 }
errSound = true
end
if UI.coloredButton(translateLabel("Remove Attachments"), {104, 247, 114}, {104, 247, 114}, errCol, 0.6) then
if not errSound then
UI.widgetSound("Cancel")
else
UI.widgetSound("Error")
end
script.run_in_fiber(function()
if all_objects == nil then
all_objects = entities.get_all_objects_as_handles()
end
for _, v in ipairs(all_objects) do
local modelHash = ENTITY.GET_ENTITY_MODEL(v)
local attachedObject = ENTITY.GET_ENTITY_OF_TYPE_ATTACHED_TO_ENTITY(self.get_ped(), modelHash)
if ENTITY.DOES_ENTITY_EXIST(attachedObject) then
ENTITY.DETACH_ENTITY(attachedObject, true, true)
ENTITY.SET_ENTITY_AS_NO_LONGER_NEEDED(attachedObject)
TASK.CLEAR_PED_TASKS(self.get_ped())
end
end
if all_peds == nil then
all_peds = entities.get_all_peds_as_handles()
end
for _, p in ipairs(all_peds) do
local pedHash = ENTITY.GET_ENTITY_MODEL(p)
local attachedPed = ENTITY.GET_ENTITY_OF_TYPE_ATTACHED_TO_ENTITY(self.get_ped(), pedHash)
if ENTITY.DOES_ENTITY_EXIST(attachedPed) then
ENTITY.DETACH_ENTITY(attachedPed, true, true)
TASK.CLEAR_PED_TASKS(self.get_ped())
TASK.CLEAR_PED_TASKS(attachedPed)
ENTITY.SET_ENTITY_AS_NO_LONGER_NEEDED(attachedPed)
end
end
is_playing_anim = false
if is_playing_scenario then
if ENTITY.DOES_ENTITY_EXIST(bbq) then
ENTITY.DELETE_ENTITY(bbq)
end
is_playing_scenario = false
end
if ped_grabbed then
ENTITY.FREEZE_ENTITY_POSITION(attached_ped, false)
TASK.TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(attached_ped, false)
PED.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(attached_ped, false)
PED.SET_PED_TO_RAGDOLL(attached_ped, 1500, 0, 0, false)
TASK.CLEAR_PED_TASKS(self.get_ped())
PED.SET_PED_CAN_SWITCH_WEAPON(self.get_ped(), true)
end
if plyrProps[1] ~= nil then
for _, v in ipairs(plyrProps) do
table.remove(v)
end
else
if not ped_grabbed then
gui.show_error("Samurais Scripts", "There are no objects or peds attached.")
else
ped_grabbed = false
end
end
end)
end
UI.toolTip(false, translateLabel("RemoveAttachments_tt"))
if LANG == 'en-US' then
ImGui.SameLine()
end
if info ~= nil then
if shortcut_anim.name ~= info.name then
if ImGui.Button(translateLabel("animShortcut_btn")) then
chosen_anim = info
UI.widgetSound("Select2")
ImGui.OpenPopup("Set Shortcut")
end
UI.toolTip(false, translateLabel("animShortcut_tt"))
ImGui.SetNextWindowPos(760, 400, ImGuiCond.Appearing)
ImGui.SetNextWindowBgAlpha(0.9)
if ImGui.BeginPopupModal("Set Shortcut", true, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoTitleBar) then
if btn_name == nil then
script.run_in_fiber(function()
for i = 1, 360 do
if PAD.IS_CONTROL_JUST_PRESSED(0, i) then
btn, btn_name = UI.getKeyPressed()
break
end
end
end)
end
UI.coloredText("Selected Animation: ", "green", 0.9, 20); ImGui.SameLine(); ImGui.Text("« " .. chosen_anim.name .. " »")
ImGui.Dummy(1, 10)
if btn_name == nil then
start_loading_anim = true
UI.coloredText(translateLabel("input_waiting") .. loading_label, "#FFFFFF", 0.75, 20)
else
start_loading_anim = false
for _, key in pairs(reserved_keys_T) do
if btn == key then
_reserved = true
break
else
_reserved = false
end
end
if not _reserved then
ImGui.Text("Shortcut Button: "); ImGui.SameLine(); ImGui.Text(btn_name)
else
UI.coloredText(translateLabel("reserved_button"), "red", 0.86, 20)
end
ImGui.SameLine(); ImGui.Dummy(5, 1); ImGui.SameLine()
if UI.coloredButton(" " .. translateLabel("generic_clear_btn") .. " ##Shortcut", "#FFDB58", "#FFFAA0", "#FFFFF0", 0.7) then
UI.widgetSound("Error")
btn, btn_name = nil, nil
end
end
ImGui.Dummy(1, 10)
if not _reserved and btn ~= nil then
if ImGui.Button(translateLabel("generic_confirm_btn") .. "##shotcut") then
UI.widgetSound("Select")
if manualFlags then
setmanualflag()
else
flag = chosen_anim.flag
end
shortcut_anim = chosen_anim
shortcut_anim.btn = btn
lua_cfg.save("shortcut_anim", shortcut_anim)