-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAH2.lua
More file actions
1947 lines (1937 loc) · 86.8 KB
/
Copy pathIAH2.lua
File metadata and controls
1947 lines (1937 loc) · 86.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[ Ver.1.0 Âû ìîæåòå äåëàòü ïðàêòè÷åñêè âñ¸ ÷òî õîòèòå ñ ýòèì àâòî-îòâåò÷èêîì, íî âû äîëæíû íàïèñàòü àâòîðà â âèäíîì ìåñòå è îñòàâèòü ññûëêó íà îðèãèíàëüíóþ òåìó (mhertz & https://www.blast.hk/threads/68215/). ]]--
script_name("IAH Reloaded")
script_authors("mhertz")
script_version(1.0)
IAH2_version_id = 2
supportOnlineFeatures = true
local imgui = require 'imgui'
local encoding = require 'encoding'
require 'lib.moonloader'
local sp = require 'lib.samp.events'
local as_action = require('moonloader').audiostream_state
local dlstatus = require('moonloader').download_status
if supportOnlineFeatures then
https = require "ssl.https"
end
-- Òåìà
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
function apply_custom_style()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
style.WindowPadding = ImVec2(15, 15)
style.WindowRounding = 15.0
style.FramePadding = ImVec2(5, 5)
style.ItemSpacing = ImVec2(12, 8)
style.ItemInnerSpacing = ImVec2(8, 6)
style.IndentSpacing = 25.0
style.ScrollbarSize = 15.0
style.ScrollbarRounding = 15.0
style.GrabMinSize = 15.0
style.GrabRounding = 7.0
style.ChildWindowRounding = 8.0
style.FrameRounding = 6.0
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00)
colors[clr.TextDisabled] = ImVec4(0.36, 0.42, 0.47, 1.00)
colors[clr.WindowBg] = ImVec4(0.11, 0.15, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.12, 0.20, 0.28, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00)
colors[clr.TitleBg] = ImVec4(0.09, 0.12, 0.14, 0.65)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.TitleBgActive] = ImVec4(0.08, 0.10, 0.12, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39)
colors[clr.ScrollbarGrab] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.09, 0.21, 0.31, 1.00)
colors[clr.ComboBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.CheckMark] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrab] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.37, 0.61, 1.00, 1.00)
colors[clr.Button] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.20, 0.25, 0.29, 0.55)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()
encoding.default = 'CP1251'
u8 = encoding.UTF8
-- ×èñëà
numbers = {
['íîëü'] = 0,
['íóëþ'] = 0,
['îäèí'] = 1,
['åäèíèöå'] = 1,
['åäèíèöà'] = 1,
['îäíîìó'] = 1,
['äâà'] = 2,
['äâóì'] = 2,
['òðè'] = 3,
['òðåì'] = 3,
['÷åòûðå'] = 4,
['÷åòûðè'] = 4,
['÷åòûðåì'] = 4,
['ïÿòü'] = 5,
['ïÿòè'] = 5,
['øåñòü'] = 6,
['øåñòè'] = 6,
['âîñåìü'] = 8,
['âîñüìè'] = 8,
['âîñìè'] = 8,
['%s+ñåìü'] = 7,
['%s+ñåìè'] = 7,
['äåâÿòü'] = 9,
['äåâÿòè'] = 9,
['äåñÿòü'] = 10,
['äåñÿòè'] = 10,
['îäèííàäàöàòü'] = 11,
['îäèííàäöàòè'] = 11,
['îäèíàäöàòü'] = 11,
['îäèíàäöàòè'] = 11,
['äâåíàäöàòü'] = 12,
['äâåíàäöàòè'] = 12,
['òðèíàäöàòü'] = 13,
['òðèíàäöàòè'] = 13,
['òðåíàäöàòü'] = 13,
['òðåíàäöàòè'] = 13,
['÷åòûðíàäöàòü'] = 14,
['÷åòûðíàäöàòè'] = 14,
['ïÿòíàäöàòü'] = 15,
['ïÿòíàäöàòè'] = 15,
['øåñòíàäöàòü'] = 16,
['øåñòíàäöàòè'] = 16,
['øåñíàäöàòü'] = 16,
['øåñíàäöàòè'] = 16,
['ñåìíàäöàòü'] = 17,
['ñåìíàäöàòè'] = 17,
['ñåìüíàäöàòü'] = 17,
['ñåìüíàäöàòè'] = 17,
['âîñåìíàäöàòü'] = 18,
['âîñåìíàäöàòè'] = 18,
['âîñåìüíàäöàòü'] = 18,
['âîñåìüíàäöàòè'] = 18,
['äåâÿòíàäöàòü'] = 19,
['äåâÿòíàäöàòè'] = 19,
['äâàäöàòü'] = 20,
['äâàäöàòè'] = 20,
['òðèäöàòü'] = 30,
['òðèäöàòè'] = 30,
['ñîðîê'] = 40,
['ñîðîêà'] = 40,
['ñîðîêåäó'] = 40,
['ïÿòüäåñÿò'] = 50,
['ïÿòèäåñÿòè'] = 50,
['øåñòüäåñÿò'] = 60,
['øåñòèäåñÿòè'] = 60,
['ñåìüäåñÿò'] = 70,
['ñåìèäåñÿòè'] = 70,
['âîñåìüäåñÿò'] = 80,
['âîñüìèäåñÿòè'] = 80,
['äåâÿíîñòî'] = 90,
['ñòî'] = 100,
['ñòàì'] = 100
}
-- Ìàòåìàòè÷åñêèå Äåéñòâèÿ òåêñòîì
maths = { -- 0 óìíîæåíèå 1 -- äåëåíèå, 2 - âû÷èòàíèå, 3 - ïëþñ
['æäû'] = '*',
['îòíÿòü îò'] = '-',
['ïîäåëèòü íà'] = '/',
['þ%s+'] = '*',
['ñëîæèòü ñ'] = '+',
['ïðèáàâèòü'] = '+',
['ïëþñ'] = '+',
['ìèíóñ'] = '-',
['óìíîæèòü'] = '*',
['ðàçäåëèòü'] = '/',
['óìíîæèòü íà'] = '*',
['ðàçäåëèòü íà'] = '/'
}
-- Ñòàíäàðòíàÿ Êîíôèãóðàöèÿ
local oconfig = {
{
'Äà, ÿ òóò.',
'Äà.',
'Òóò',
'Ó êîìïüþòåðà',
'Òóò ÿ',
'da',
'+',
'òóò',
'äà',
'êîíå÷íî',
'yes',
'ÿ òóò'
},
{
'íó òóò ÿ',
'òóòö ÿ',
'ß òóò...',
'êîíå÷íî òóò ÿ',
'äà',
'+',
'++',
'y',
'yes',
'da',
'tut',
'ÿ òóòà'
},
{
'Õàðå ìåíÿ ñïðàøèâàòü',
'Ñêîëüêî óæå ìîæíî...',
'Íàäîåëè',
'Äà, ÿ òóò.',
'tut',
'çäåñü',
'íåò, á***ü'
},
{
'ÿ òåáå íå ýéíøòåéí',
'ÿ íå ýéëåð',
'ñëèøêîì ñëîæíî',
'âû óæå ñîâñåì',
'õç',
'xz',
'ñàì ïîñ÷èòàé',
'ìíå ëåíü',
'ÿ íå ãåíèé',
'ó ìåíÿ íåò çîëîòîé ìåäàëè',
'ó ìåíÿ ïî ìàòåìàòèêå 3',
'ó ìåíÿ ïî àëãåáðå 3'
},
{
'ß íå áîò',
'ß íå ðîáîò, ïðîâåðåíî êàï÷åé',
'óâàæàåìûé, ÿ íå áîòîâîæó',
'ÿ ÷èòû íå èñïîëüçóþ',
'net',
'ne bot'
},
'Ó ìåíÿ âñ¸ íîðìàëüíî',
'ß ðàáîòàþ, à ÷òî òåáå?',
'Arizona RP Mesa',
'àäìèíèñòðàòîð',
'îòâåòèë âàì',
'ãîâîðèò:',
'',
false,
false,
{
['ñòîëèö'] = {'ñøà', 'Âàøèíãòîí'},
['íèêèò'] = {'âû', '!name, ÿ $name.'}
},
true,
true,
'Âàñÿ',
'((',
'àäìèíèñòðàòîð',
true,
true,
false,
16,
'Àäìèíèñòðàòîð (.+) îòâåòèë âàì%:',
'(.+)%[%d+%] ãîâîðèò%:',
'%(%( Àäìèíèñòðàòîð (.+)%[%d+%]%:',
'.+%[(%d+)%] ãîâîðèò%:',
'%(%( àäìèíèñòðàòîð .+%[(%d+)%]%:',
'%(%( àäìèíèñòðàòîð .+%[(%d+)%]%:',
false,
true, -- 1 ÃÐÓÏÏÀ Íå çíàþ 32
false, -- 2 ÃÐÓÏÏÀ Íå Çíàþ 33
false, -- 3 ÃÐÓÏÏÀ Íå Çíàþ 34
{
'íå çíàþ',
'õç',
'íå ïîíÿë',
'ïèøè ïî-ðóññêè',
'íå å*ó',
'íå ìåøàé'
}, -- 35
false, -- 36 Îòâåòû 1 ÃÐ
false, -- 37 Îòâåòû 2 ÃÐ
false, -- 38 Îòâåòû 3 ÃÐ
{
'ýýý òû øî',
'íå ìåøàé',
'îòâàëè',
'õàðý',
'÷òî?',
'òû ÷¸?',
'äà ÷òî òå íóæíî'
}, -- 39
true, -- 40 Âêëþ÷èòü þçåð âîïðîñû
true, -- 41 Çâóê ïðè ñëàïå
true, -- 42 Îòâå÷àòü ïðè ñëàïå
false, -- 43 verbose
false, -- 44 ïàòòåðíû
'Ïóïêèí', -- 45 Ôàìèëèÿ
true, -- 46 Ïîâòîð âîïðîñîâ
{
'ýýý òû øî',
'íå ìåøàé',
'îòâàëè',
'õàðý',
'÷òî?',
'òû ÷¸?',
'äà ÷òî òå íóæíî'
}, -- 47 ÒÏ Îáûêíîâåííîå
{
'ýýý òû øî',
'íå ìåøàé',
'îòâàëè',
'õàðý',
'÷òî?',
'òû ÷¸?',
'äà ÷òî òå íóæíî'
}, -- 48 ÒÏ â æîïó ìèðà
'/botoff', -- 49 ÊÌÄ îôô Áîòà
false, -- 50 Îòêë Áîòà ïðè îòâåòå
false, -- 51 Îòêëþ÷àòü áîòà ïðè ÒÏ OOB
false, -- 52 Ëèâàòü èç èãðû ïðè òï OOB
false, -- 53 Îòêë Ôðèç
true, -- 54 Óìíîå ðàñïîçíîâàíèå /b / ÍÅÒ
false, -- 55 Ñîâñåì çàåáàëè 1
false, -- 56 2
false, -- 57 3
2, -- 58 Zaebali threshold
'' -- 59 ÊÌÄ îôô Áîòà 2!
}
-- Ïàòòåðíû â êëþ÷àõ
patternon = true
-- Ïåðåìåííàÿ êîíôèãóðàöèè
config = {}
-- Ïåðåìåííûå â îòâåòàõ
vartovar = { -- Åñëè âû õîòèòå äîáàâèòü íîâûå ïåðåìåííûå, ïèøèòå èìÿ è ôóíêöèþ.
['name'] = 'config[18]',
['surname'] = 'config[45]',
['servername'] = 'config[8]',
['mood'] = 'config[6]',
['status'] = 'config[7]',
['age'] = 'config[24]',
['day'] = 'tostring(os.date("*t").day)',
['year'] = 'tostring(os.date("*t").year)',
['month'] = 'tostring(os.date("*t").month)'
}
-- Òðàíñëèò
engchar = {'A','a','B','b','Ch','C','ch','cc','ck','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','Sh','Sch','S','sh','sch','s','T','t','U','u','W','w','X','x','Y','y','Z','z','V','v'}
ruschar = {'À','à','Á','á','×','Ê','÷','÷','ê','ê','Ä','ä','Å','å','Ô','ô','Ã','ã','Õ','õ','È','è','Äæ','äæ','Ê','ê','Ë','ë','Ì','ì','Í','í','Î','î','Ï','ï','Êâ','êâ','Ð','ð','Ø','Ù','Ñ','ø','ù','ñ','Ò','ò','Ó','ó','Â','â','Êñ','êñ','È','è','Ç','ç','Â','â'}
function translit(text)
if text == nil then
return
end
for i, y in ipairs(engchar) do
text = text:gsub(y,ruschar[i])
end
return text
end
-- Ñòàíäàðòèçàöèÿ òåêñòà
cyrlower = {'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', '¨', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ü', 'Û', 'Ú', 'Ý', 'Þ', 'ß', '¸','b','e','h','k','x','c','m','t','o','p','a'}
cyrlower2 = {'à', 'á', 'â', 'ã', 'ä', 'å', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ü', 'û', 'ú', 'ý', 'þ', 'ÿ', 'å','â','å','í','ê','õ','ñ','ì','ò','î','ð','à'}
function lower_cyr(text)
if text == nil then
return
end
text = string.lower(text)
for i, y in ipairs(cyrlower) do
text = text:gsub(y,cyrlower2[i])
end
return text
end
-- Ïåðåìåííûå
local ScreenWidth, ScreenHeight = getScreenResolution()
enabled = false
delayed = false
times = 0
lastanswer = 'ÿ òóò'
zaebali = 0
-- Ñ÷åò÷èêè
patterndetected1 = 0
patterndetected2 = 0
patterndetected3 = 0
patternanswered = 0
patternyour = 0
patternnotknow = 0
patternskipped = 0
patternslapped = 0
patterntp = 0
patternoob = 0
patternrepeated = 0
-- ImGui
local main_window_state = imgui.ImBool(false)
local mm_state = imgui.ImBool(false)
local bar_state = imgui.ImBool(false)
local big_buffer1 = imgui.ImBuffer(4096)
local big_buffer2 = imgui.ImBuffer(4096)
local big_buffer3 = imgui.ImBuffer(4096)
local big_buffer4 = imgui.ImBuffer(4096)
local big_buffer5 = imgui.ImBuffer(4096)
local big_buffer6 = imgui.ImBuffer(8192)
local big_buffer7 = imgui.ImBuffer(4096)
local big_buffer8 = imgui.ImBuffer(4096)
local big_buffer9 = imgui.ImBuffer(4096)
local big_buffer10 = imgui.ImBuffer(4096)
local small_buffer1 = imgui.ImBuffer(48)
local small_buffer2 = imgui.ImBuffer(48)
local small_buffer3 = imgui.ImBuffer(48)
local small_buffer4 = imgui.ImBuffer(48)
local small_buffer5 = imgui.ImBuffer(64)
local small_buffer6 = imgui.ImBuffer(64)
local small_buffer7 = imgui.ImBuffer(64)
local small_buffer8 = imgui.ImBuffer(48)
local small_buffer9 = imgui.ImBuffer(48)
local small_buffer10 = imgui.ImBuffer(48)
local small_buffer11 = imgui.ImBuffer(48)
local small_buffer12 = imgui.ImBuffer(48)
local small_buffer13 = imgui.ImBuffer(48)
pattern_buffers = { imgui.ImBuffer(128), imgui.ImBuffer(128), imgui.ImBuffer(128), imgui.ImBuffer(128), imgui.ImBuffer(128), imgui.ImBuffer(128) }
-- Ëîããèðîâàíèå
verboseType = {
MATCH = 0,
HALFMATCH = -1,
MISMATCH_1 = 1,
MISMATCH_2 = 2,
MISMATCH_3 = 3,
LOG = -2
}
verboseDir = 0
function script_message(text)
sampAddChatMessage(('[IAH] {ffffff}%s'):format(text),0xBE2D2D)
end
function verbose(text, t)
if config[43] == false then
return
end
if t < -2 or t > 3 then
return
end
if verboseDir == 0 then
verboseDir = 'moonloader/config/IAH2/verbose/' .. tostring(os.time())
end
if not doesDirectoryExist(verboseDir) then createDirectory(verboseDir) end
if t == verboseType.MATCH then
local file = io.open(verboseDir..'/matched.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
elseif t == verboseType.HALFMATCH then
local file = io.open(verboseDir..'/possiblematch.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
elseif t == verboseType.LOG then
local file = io.open(verboseDir..'/log.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
elseif t == verboseType.MISMATCH_1 then
local file = io.open(verboseDir..'/notfound1.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
elseif t == verboseType.MISMATCH_2 then
local file = io.open(verboseDir..'/notfound2.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
elseif t == verboseType.MISMATCH_3 then
local file = io.open(verboseDir..'/notfound3.txt', "a")
if file then
file:write(tostring('[' .. os.date() .. '] ' .. text .. '\n'))
end
file:close()
end
end
oldpos = {0, 0, 0}
newpos = {0, 0, 0}
crash_flag = false
-- Crash
function crash()
local as = loadAudioStream('moonloader/donotcreate_123.mp3')
setAudioStreamVolume(as, 100)
setAudioStreamState(as, 1)
end
-- main
local su_state = imgui.ImBool(false)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
if sampIsChatCommandDefined('tiah') then sampUnregisterChatCommand('tiah') end
if sampIsChatCommandDefined('iah') then sampUnregisterChatCommand('iah') end
sampRegisterChatCommand('tiah', tiah)
sampRegisterChatCommand('iah', iah)
script_message('IAH Reloaded 1.0 (03-12-2020) by mhertz çàãðóæåí!')
script_message('Êîìàíäû: tiah (Âêë/Âûêë), iah (Ìåíþ)')
if not doesFileExist('moonloader/config/IAH2/config.json') then
if not doesDirectoryExist('moonloader/config/') then createDirectory("moonloader/config") end
if not doesDirectoryExist('moonloader/config/IAH2') then createDirectory("moonloader/config/IAH2") end
if not doesDirectoryExist('moonloader/config/IAH2/verbose') then createDirectory("moonloader/config/IAH2/verbose") end
saveData(oconfig,'moonloader/config/IAH2/config.json')
end
local file = io.open('moonloader/config/IAH2/config.json', 'r')
if file then
print('Load File Now! If game crashes, remove /config/IAH2/config.json')
config = decodeJson(file:read('*a'))
for i, name in ipairs(oconfig) do
if config[i] == nil and type(oconfig[i]) ~= 'table' then
config[i] = name
elseif config[i] == nil then
config[i] = {}
for j,k in ipairs(oconfig[i]) do
config[i][j] = k
end
end
end
if not doesDirectoryExist('moonloader/config/IAH2/verbose') then createDirectory("moonloader/config/IAH2/verbose") end
file:close()
end
if supportOnlineFeatures then
lua_thread.create(function()
local body = https.request("https://raw.githubusercontent.com/xefinity/iah2/main/version")
if body == nil or tonumber(body) == nil then
script_message('Íå óäàëîñü ïðîâåðèòü íàëè÷èå îáíîâëåíèé!')
else
if tonumber(body) > IAH2_version_id then
script_message('Äîñòóïíî îáíîâëåíèå! (LOC: ' .. tostring(IAH2_version_id) .. ' | SRV: ' .. body .. ')')
script_message('Äëÿ îáíîâëåíèÿ èñïîëüçóéòå /updateiah')
if sampIsChatCommandDefined('updateiah') then sampUnregisterChatCommand('updateiah') end
sampRegisterChatCommand('updateiah', function()
downloadUrlToFile('https://raw.githubusercontent.com/xefinity/iah2/main/IAH2.lua', thisScript().path, function(id, status, p1, p2)
if status == dlstatus.STATUS_DOWNLOADINGDATA then
print(string.format('Çàãðóæåíî %d èç %d.', p1, p2))
elseif status == dlstatus.STATUS_ENDDOWNLOADDATA then
script_message('Îáíîâëåíèå çàãðóæåíî. Ïåðåçàãðóæàþ ñêðèïò...')
lua_thread.create(function() wait(500) thisScript():reload() end)
end
if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
printText('Ïðîèçîøëà îøèáêà ïðè çàãðóçêå îáíîâëåíèÿ.')
end
end)
end)
elseif IAH2_version_id > tonumber(body) then
script_message('Âàøà âåðñèÿ âûøå âåðñèè ñåðâåðà? o_O')
else
script_message('Âàøà âåðñèÿ àêòóàëüíà.')
end
end
end)
end
verbose('Script loaded!',verboseType.LOG)
math.randomseed(os.time())
bar_state.v = config[31]
patternon = not config[44]
while true do
wait(0)
imgui.Process = main_window_state.v or bar_state.v or mm_state.v or su_state.v
if enabled then
if zaebali >= config[58] then
crash_flag = true
end
oldpos[1] = newpos[1]
oldpos[2] = newpos[2]
oldpos[3] = newpos[3]
newpos[1], newpos[2], newpos[3] = getCharCoordinates(PLAYER_PED)
if oldpos[1] == 0.0 and oldpos[2] == 0.0 and oldpos[3] == 0.0 then
elseif newpos[3] - oldpos[3] > 3.0 and newpos[1] - oldpos[1] < 1.0 and newpos[1] - oldpos[1] > -1.0 and newpos[2] - oldpos[2] < 1.0 and newpos[2] - oldpos[2] > -1.0 then
verbose('Slap detected!!!',verboseType.LOG)
patternslapped = patternslapped + 1
if config[42] == true then
printText(config[39][math.random(#config[39])], false)
end
if config[41] == true then
playSound()
end
elseif oldpos[1] - newpos[1] > 300.0 or oldpos[1] - newpos[1] < -300.0 or oldpos[2] - newpos[2] > 300.0 or oldpos[2] - newpos[2] < -300.0 then
verbose('Out-of-stream Teleport detected!!!',verboseType.LOG)
patternoob = patternoob + 1
if config[51] == true then
if config[49] ~= '' then sampProcessChatInput(config[49]) end
if config[59] ~= '' then sampProcessChatInput(config[59]) end
end
if config[52] == true then
crash_flag = true
else
if config[42] == true then
printText(config[48][math.random(#config[48])], false, verboseType.MATCH, (config[51] and true or false))
end
if config[41] == true then
playSound()
end
end
elseif (oldpos[1] - newpos[1] > 10.0 and oldpos[1] - newpos[1] < 300.0) or (oldpos[1] - newpos[1] < -10.0 and oldpos[1] - newpos[1] > -300.0) or (oldpos[2] - newpos[2] > 10.0 and oldpos[2] - newpos[2] < 300.0) or (oldpos[2] - newpos[2] < -10.0 and oldpos[2] - newpos[2] > -300.0) then
verbose('In-stream Teleport detected!!!',verboseType.LOG)
patterntp = patterntp + 1
if config[42] == true then
printText(config[47][math.random(#config[47])], false)
end
if config[41] == true then
playSound()
end
end
end
end
end
-- Ñîõðàíèòü êîíôèã
function saveData(table, path)
verbose('Saving data...',verboseType.LOG)
if doesFileExist(path) then os.remove(path) end
local sfa = io.open(path, "w")
if sfa then
sfa:write(encodeJson(table))
sfa:close()
end
end
-- Ñòðîêà â ìàññèâ
function split(str, sep)
if sep == nil then
sep = "\r\n"
end
local t={}
for strg in string.gmatch(str, "([^"..sep.."]+)") do
table.insert(t, strg)
end
return t
end
-- Ìàññèâ â ñòðîêè (þçåð âîïðîñû)
function reprdict(t)
local str = ""
for i, name in pairs(t) do
str = str .. i .. '/' .. name[1] .. '/' .. name[2] .. '\n'
end
return str
end
-- Ñòðîêè â ìàññèâ (þçåð âîïðîñû)
function dereprdict(s)
local t1 = split(s)
local t2 = {}
local t3 = {}
for _, i in ipairs(t1) do
t2 = split(i,'/')
t2[1] = lower_cyr(t2[1])
t2[2] = lower_cyr(t2[2])
if t2[2] == nil then
t2[2] = ''
end
if t2[1] ~= nil and t2[3] ~= nil then
t3[t2[1]] = { t2[2], t2[3] }
end
end
return t3
end
-- Ïåðåìåííûå â îòâåòàõ, ôóíêöèè
gbuffer1 = ''
gbuffer2 = ''
function paratotext_process(a, b)
local k = vartovar[b]
if k ~= nil then
k = loadstring('return ' .. k)()
k:gsub("%p", "%%%1") -- äæàñò èí êåéñ
if a == '$' then
return k
elseif a == '?' then
return (lower_cyr(k) == gbuffer2) and ('äà') or ('íåò')
elseif a == '!' then
return (lower_cyr(k) == gbuffer1) and ('äà') or ('íåò')
end
end
return b
end
function paratotext_preprocess(a)
a = a:gsub(',%s+',',')
a = split(a, ',')
if type(a) == 'table' and #a ~= 0 then
return a[math.random((#a))]
else
return a
end
end
function paratotext(a, b, s)
if a == nil or b == nil or s == nil then
return 'õç'
end
gbuffer1 = a
gbuffer2 = b
s = s:gsub('@random%((.+)%)',paratotext_preprocess)
s = s:gsub('([%$!%?])(%w+)',paratotext_process)
return s
end
-- Çâóê
function playSound()
local as = loadAudioStream('moonloader/config/IAH2/sound.mp3')
setAudioStreamVolume(as, 100)
setAudioStreamState(as, 1)
end
-- Ôóíêöèÿ îòâåòà
function printText(text, dialog, vtype, noexec, doreset)
if delayed == true then
return
end
if vtype == nil then
vtype = verboseType.MATCH
end
if noexec == nil then
noexec = false
end
if doreset == nil then
doreset = true
end
verbose('Answering to question...',verboseType.LOG)
lastanswer = text
if (config[13] == true and recognizedchat == false) or (recognizedchat == true and inb == true) then
text = '/b ' .. text
end
patternanswered = patternanswered + 1
delayed = true
times = times + 1
if times > 2 or times < 0 then
times = 0
end
if doreset then
zaebali = 0
end
lua_thread.create(function()
verbose('Answered to question! Dialog: ' .. tostring(dialog) .. ', Answer: '..text,vtype)
if dialog == false then
wait(math.random(250,700))
if config[53] == false then
setPlayerControl(PLAYER_HANDLE, false)
end
if config[50] == true and noexec == false then
if config[49] ~= '' then sampProcessChatInput(config[49]) end
if config[59] ~= '' then sampProcessChatInput(config[59]) end
end
else
if config[50] == true and noexec == false then
if config[49] ~= '' then sampProcessChatInput(config[49]) end
if config[59] ~= '' then sampProcessChatInput(config[59]) end
end
setPlayerControl(PLAYER_HANDLE, false)
wait(math.random(1000,1800))
sampCloseCurrentDialogWithButton(0)
if config[53] == true then
setPlayerControl(PLAYER_HANDLE, true)
end
end
wait(math.random(400,600))
wait(math.random(200,300)*string.len(text)+300) -- ïðèìåðíîå âðåìÿ íàáîðà
sampSendChat(text)
wait(math.random(50,300))
setPlayerControl(PLAYER_HANDLE, true)
if config[50] == true and noexec == false then
if config[49] ~= '' then sampProcessChatInput(config[49]) end
if config[59] ~= '' then sampProcessChatInput(config[59]) end
end
wait(2000)
delayed = false
end)
end
recognizedchat = false
inb = false
-- Ôóíêöèÿ îáðàáîòêè òåêñòà â äèàëîãå/ñîîáùåíèè
function processText(text, dialog)
verbose('Processing: '..text,verboseType.LOG)
if delayed == true then
if dialog == true then
lua_thread.create(function()
setPlayerControl(PLAYER_HANDLE, false)
wait(1000)
sampCloseCurrentDialogWithButton(0)
setPlayerControl(PLAYER_HANDLE, true)
end)
end
return
end
-- Ñòàíäàðòèçàöèÿ
otext = text
text = lower_cyr(text)
text = text:gsub("%{......%}", "")
-- Êëþ÷åñïåöèôè÷íûå ôóíêöèè
if (text:find(config[9], 1, patternon) == nil or text:find(config[10], 1, patternon) == nil) and (text:find(config[11], 1, patternon) == nil or text:find(config[12], 1, patternon) == nil) and (text:find(config[19], 1, patternon) == nil or text:find(config[20], 1, patternon) == nil) then
return
end
if text:find(config[9], 1, patternon) ~= nil and text:find(config[10], 1, patternon) ~= nil then
if config[16] == true and config[14] == true and delayed == false then
playSound()
end
if config[36] == true then
patternskipped = patternskipped + 1
return
end
patterndetected1 = patterndetected1 + 1
elseif text:find(config[11], 1, patternon) ~= nil and text:find(config[12], 1, patternon) ~= nil then
if config[17] == true and config[14] == true and delayed == false then
playSound()
end
if config[37] == true then
patternskipped = patternskipped + 1
return
end
patterndetected2 = patterndetected2 + 1
elseif text:find(config[19], 1, patternon) ~= nil and text:find(config[20], 1, patternon) ~= nil then
if config[21] == true and config[14] == true and delayed == false then
playSound()
end
if config[38] == true then
patternskipped = patternskipped + 1
return
end
patterndetected3 = patterndetected3 + 1
end
if config[54] and (text:find(' íå â %/â') or text:find(' íå â nîn%-rð ÷àò') or text:find(' íå â íîíðï ÷àò') or text:find(' íå â %/á') or text:find(' íå â b ') or text:find(' íå â á ') or (text:find(' â ðï ÷àò') and text:find(' íå â ðï ÷àò') == nil) or (text:find(' â rp ÷àò') and text:find(' íå â rp ÷àò') == nil) or text:find(' íå â nînrð ÷àò') or text:find(' íå â nrð ÷àò') or (text:find(' â îáû÷íûé ÷àò') and text:find(' íå â îáû÷íûé ÷àò') == nil) or text:find(' â ÷àò') or text:find(' áåç %/â')) then
recognizedchat = true
inb = false
elseif config[54] and (text:find('%/â') or text:find('íîíðï ÷àò') or text:find('nînrð ÷àò') or text:find('nrð ÷àò') or text:find('nîn-rð ÷àò') or text:find('%/á')) then
recognizedchat = true
inb = true
else
recognizedchat = false
end
-- Þçåð âîïðîñû
if config[40] == true then
for i,name in pairs(config[15]) do
if text:find(i, 1, true) and text:find(name[1], 1, true) then
patternyour = patternyour + 1
return printText(paratotext(i,name[1],name[2]), dialog)
end
end
end
-- Ìàòàí ñòàíäàðòèçàöèÿ
local mtext = text
for i, name in pairs(maths) do
mtext = mtext:gsub(i,' ' .. name .. ' ')
end
for i, name in pairs(numbers) do
mtext = mtext:gsub(i,name)
end
-- Îòâåòû
if (text:find('êàê') or text:find('êàêîå')) and (text:find('äåëà') or text:find('æèçíü') or text:find('íàñòðîåíèå') or text:find('æèâå')) then
return printText(config[6], dialog)
elseif (text:find('íàçâàíèå') or text:find('èìÿ') or text:find('íàèìåíîâàíèå') or text:find('íàèìèíîâàíèå') or text:find('íàçîâè')) and (text:find('èãð') or text:find('ñåðâåð') or text:find('ïðîåêò')) then
return printText(config[8], dialog)
elseif (text:find('÷òî') or text:find('÷åì')) and (text:find('çàíèìàåø') or text:find('äåëàåø') or text:find('çàíèìàåì') or text:find('ðàáîòàåø') or text:find('çàíèìàåò')) then
return printText(config[7], dialog)
elseif ( ( ( text:find('êàê') or text:find('êàêîé') ) and (text:find('âàñ') or text:find('òåá'))) or text:find('òâîå') or text:find('âàø')) and (text:find('èìÿ') or text:find('çîâóò') or text:find('ÔÈÎ') or text:find('çâàòü')) then
return printText(config[18], dialog)
elseif ( ( ( text:find('êàê') or text:find('êàêîé') ) and (text:find('âàñ') or text:find('òåá'))) or text:find('òâîå') or text:find('âàø')) and text:find('ôàìèëè') then
return printText(config[45], dialog)
elseif (text:find('âû') or text:find('òû')) and text:find(lower_cyr(config[18])) then
return printText('äà', dialog)
elseif (text:find('ñêîëüê') or text:find('êîë-âî') or text:find('êîëè÷åñòâî')) and (text:find('òåïëû') or text:find('ãîðÿ÷è') or text:find('âåñåí') or text:find('çèìí') or text:find('õîëîäí') or text:find('îñåí') or text:find('ñíåæí')) and text:find('ìåñÿö') then
return printText('3', dialog)
elseif (text:find('ñêîëüê') or text:find('êîë-âî') or text:find('êîëè÷åñòâî')) and text:find('ìåñÿö') then
return printText('12', dialog)
elseif (text:find('òåïë') or text:find('ãîðÿ÷') or text:find('æàð')) and text:find('ìåñÿö') then
return printText('èþëü', dialog)
elseif (text:find('õîëîäí') or (text:find('íîâ') and text:find('ãîä')) or text:find('ñíåæí')) and text:find('ìåñÿö') then
return printText('ÿíâàðü', dialog)
elseif (text:find('äàòà') or text:find('êîãäà')) and text:find('íîâ') and text:find('ãîä') then
return printText('1 ÿíâàðÿ', dialog)
elseif (text:find('äàòà') or text:find('êîãäà')) and text:find('äåíü ïîáåäû') then
return printText('9 ìàÿ', dialog)
elseif (text:find('ìîé') or text:find('ìîå') or (text:find('êàêîé') and text:find('ìåíÿ'))) and (text:find('íèê') or text:find('niñê') or (text:find('èìÿ') and text:find('ôàìèëèÿ'))) and (text:find('ðóññê') or text:find('ðóñê') or text:find('ïåðåâîä')) then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
return printText(translit(nick), dialog)
end
elseif (text:find('ìîé') or text:find('ìîå') or text:find('ìîÿ') or (( text:find('êàê') or text:find('êàêîé') ) and text:find('ìåíÿ'))) and (text:find('íèê') or text:find('niñê') or (text:find('èìÿ') and text:find('ôàìèëèÿ'))) then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
return printText(nick, dialog)
end
elseif (text:find('ìîé') or text:find('ìîå') or (( text:find('êàê') or text:find('êàêîé') ) and text:find('ìåíÿ'))) and (text:find('èìÿ') or text:find('çîâóò') or text:find('çâàòü')) and (text:find('ðóññê') or text:find('ðóñê') or text:find('ïåðåâîä')) then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
nick = nick:match('(%w+)_%w+')
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
return printText(translit(nick), dialog)
end
end
elseif (text:find('ìîé') or text:find('ìîå') or (( text:find('êàê') or text:find('êàêîé') ) and text:find('ìåíÿ'))) and text:find('ôàìèëèÿ') and (text:find('ðóññê') or text:find('ðóñê') or text:find('ïåðåâîä')) then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
nick = nick:match('%w+_(%w+)')
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
return printText(translit(nick), dialog)
end
end
elseif (text:find('ìîé') or text:find('ìîå') or (( text:find('êàê') or text:find('êàêîé') ) and text:find('ìåíÿ'))) and (text:find('èìÿ') or text:find('çîâóò') or text:find('çâàòü')) then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
nick = nick:match('(%w+)_%w+')
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
return printText(nick, dialog)
end
end
elseif (text:find('ìîé') or text:find('ìîå') or text:find('ìîÿ') or (( text:find('êàê') or text:find('êàêîé') ) and text:find('ìåíÿ'))) and text:find('ôàìèëèÿ') then
local nick = otext:match(config[25])
if nick == nil then
nick = otext:match(config[26])
end
if nick == nil then
nick = otext:match(config[27])
end
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
nick = nick:gsub("%{......%}", "")
nick = nick:match('%w+_(%w+)')
if nick == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
return printText(nick, dialog)
end
end
elseif (text:find('ìîé') or (text:find('êàêîé') and text:find('ìåíÿ'))) and (text:find('id') or text:find('àéäè') or text:find('èä')) then
local id = text:match(config[28])
if id == nil then
id = text:match(config[29])
end
if id == nil then
id = text:match(config[30])
end
if id == nil then
return printText(config[35][math.random(#config[35])], dialog)
else
return printText(id, dialog)
end
elseif (text:find('êîãäà') or text:find('äàòà') or text:find('äåíü')) and text:find('îòêðû') and (text:find('àrizînà') or text:find('àðèçîí')) then
return printText('2014', dialog)
elseif (text:find('òåïë') or text:find('ãîðÿ÷') or text:find('æàð')) and (text:find('ñåçîí') or text:find('âðåìÿ') or text:find('ïîðà')) then
return printText('ëåòî', dialog)
elseif (text:find('õîëîäí') or text:find('ñíåæí')) and (text:find('ñåçîí') or text:find('âðåìÿ') or text:find('ïîðà')) then
return printText('çèìà', dialog)
elseif (text:find('ñêîëüê') or text:find('êîë-âî') or text:find('êîëè÷åñòâî')) and text:find('ïàëüöåâ') then
return printText('5', dialog)
elseif (text:find('ðîññè') or text:find('ðîñè')) and (text:find('ñòîëèö') or text:find('ãëàâíûé ãîðîä')) then
return printText('Ìîñêâà', dialog)
elseif (text:find('óêðàèí') or text:find('õîõëÿíä')) and (text:find('ñòîëèö') or text:find('ãëàâíûé ãîðîä')) then
return printText('Êèåâ', dialog)
elseif (text:find('óêðàèí') or text:find('õîõëÿíä')) and (text:find('öâåò') or text:find('ôëàã')) then
return printText('æ¸ëòûé è ñèíèé', dialog)