-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdonatik.lua
3918 lines (3682 loc) · 197 KB
/
donatik.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
script_name("Donatik")
script_author("bier from Revolution")
script_version("31.03.2023")
script_version_number(26)
script_url("https://vlaek.github.io/Donatik/")
script = {update = false, loaded = false, reload = false}
local main_color, error_color = 0xFFFF00, 0xFF0000
local prefix, error_prefix = "{FFFF00} [" .. thisScript().name .. "] {FFFFFF}", " [" .. thisScript().name .. "] "
function try(f, catch_f)
local status, exception = pcall(f)
if not status then
catch_f(exception)
end
end
try(function()
sampev = require 'lib.samp.events'
inicfg = require 'inicfg'
imgui = require 'imgui'
vkeys = require 'vkeys'
rkeys = require 'rkeys'
effil = require 'effil'
multipart = require 'multipart-post'
dkjson = require 'dkjson'
wm = require 'lib.windows.message'
screenshotIsAvailable, screenshot = pcall(require, 'lib.screenshot')
as_action = require 'moonloader'.audiostream_state
encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
end,
function(e)
sampAddChatMessage(error_prefix .. "An error occurred while loading libraries", error_color)
print(error_prefix .. e)
thisScript():unload()
end)
function script.sendMessage(text)
sampAddChatMessage(prefix .. u8:decode(text), main_color)
end
function script.sendErrorMessage(text)
sampAddChatMessage(error_prefix .. u8:decode(text), error_color)
end
local donatik = {}
local tg = {}
local statistics_ini, todayTopDonaters_ini, donaters_ini, todayDonaters_ini, donatersZiel_ini, statistics_ziel_ini, settings_ini, donatersRating_ini, donatersRatingZiel_ini = {}, {}, {}, {}, {}, {}, {}, {}, {}
local updateid
local skins = {
[0] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[1] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[2] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[3] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[4] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[5] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[6] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[7] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[8] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[9] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[10] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[11] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[12] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[13] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[14] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[15] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[16] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[17] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[18] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[19] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[20] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[21] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[22] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[23] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[24] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[25] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[26] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[27] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[28] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[29] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[30] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[31] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[32] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[33] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[34] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[35] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[36] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[37] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[38] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[39] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[40] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[41] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[42] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[43] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[44] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[45] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[46] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[47] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[48] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[49] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[50] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[51] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[52] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[53] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[54] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[55] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[56] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[57] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[58] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[59] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[60] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[61] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[62] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[63] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[64] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[65] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[66] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[67] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[68] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[69] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[70] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[71] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[72] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[73] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[74] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[75] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[76] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[77] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[78] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[79] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[80] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[81] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[82] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[83] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[84] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[85] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[86] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[87] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[88] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[89] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[90] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[91] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[92] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[93] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[94] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[95] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[96] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[97] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[98] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[99] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[100] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[101] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[102] = {group = u8:decode("Баллас"), gender = u8:decode("Мужской")},
[103] = {group = u8:decode("Баллас"), gender = u8:decode("Мужской")},
[104] = {group = u8:decode("Баллас"), gender = u8:decode("Мужской")},
[105] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[106] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[107] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[108] = {group = u8:decode("Вагос"), gender = u8:decode("Мужской")},
[109] = {group = u8:decode("Вагос"), gender = u8:decode("Мужской")},
[110] = {group = u8:decode("Вагос"), gender = u8:decode("Мужской")},
[111] = {group = u8:decode("РМ"), gender = u8:decode("Мужской")},
[112] = {group = u8:decode("РМ"), gender = u8:decode("Мужской")},
[113] = {group = u8:decode("ЛКН"), gender = u8:decode("Мужской")},
[114] = {group = u8:decode("Ацтек"), gender = u8:decode("Мужской")},
[115] = {group = u8:decode("Ацтек"), gender = u8:decode("Мужской")},
[116] = {group = u8:decode("Ацтек"), gender = u8:decode("Мужской")},
[117] = {group = u8:decode("Якудза"), gender = u8:decode("Мужской")},
[118] = {group = u8:decode("Якудза"), gender = u8:decode("Мужской")},
[119] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[120] = {group = u8:decode("Якудза"), gender = u8:decode("Мужской")},
[121] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[122] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[123] = {group = u8:decode("Якудза"), gender = u8:decode("Мужской")},
[124] = {group = u8:decode("ЛКН"), gender = u8:decode("Мужской")},
[125] = {group = u8:decode("РМ"), gender = u8:decode("Мужской")},
[126] = {group = u8:decode("РМ"), gender = u8:decode("Мужской")},
[127] = {group = u8:decode("ЛКН"), gender = u8:decode("Мужской")},
[128] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[129] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[130] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[131] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[132] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[133] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[134] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[135] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[136] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[137] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[138] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[139] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[140] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[141] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[142] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[143] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[144] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[145] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[146] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[147] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[148] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[149] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[150] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[151] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[152] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[153] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[154] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[155] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[156] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[157] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[158] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[159] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[160] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[161] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[162] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[163] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[164] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[165] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[166] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[167] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[168] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[169] = {group = u8:decode("Якудза"), gender = u8:decode("Женский")},
[170] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[171] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[172] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[173] = {group = u8:decode("Рифа"), gender = u8:decode("Мужской")},
[174] = {group = u8:decode("Рифа"), gender = u8:decode("Мужской")},
[175] = {group = u8:decode("Рифа"), gender = u8:decode("Мужской")},
[176] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[177] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[178] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[179] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[180] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[181] = {group = u8:decode("Байкер"), gender = u8:decode("Мужской")},
[182] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[183] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[184] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[185] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[186] = {group = u8:decode("Якудза"), gender = u8:decode("Мужской")},
[187] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[188] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[189] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[190] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[191] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[192] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[193] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[194] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[195] = {group = u8:decode("Баллас"), gender = u8:decode("Женский")},
[196] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[197] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[198] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[199] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[200] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[201] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[202] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[203] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[204] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[205] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[206] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[207] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[208] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[209] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[210] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[211] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[212] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[213] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[214] = {group = u8:decode("РМ"), gender = u8:decode("Женский")},
[215] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[216] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[217] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[218] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[219] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[220] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[221] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[222] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[223] = {group = u8:decode("ЛКН"), gender = u8:decode("Мужской")},
[224] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[225] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[226] = {group = u8:decode("Рифа"), gender = u8:decode("Женский")},
[227] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[228] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[229] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[230] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[231] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[232] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[233] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[234] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[235] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[236] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[237] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[238] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[239] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[240] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[241] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[242] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[243] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[244] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[245] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[246] = {group = u8:decode("Байкер"), gender = u8:decode("Женский")},
[247] = {group = u8:decode("Байкер"), gender = u8:decode("Мужской")},
[248] = {group = u8:decode("Байкер"), gender = u8:decode("Мужской")},
[249] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[250] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[251] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[252] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[253] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[254] = {group = u8:decode("Байкер"), gender = u8:decode("Мужской")},
[255] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[256] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[257] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[258] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[259] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[260] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[261] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[262] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[263] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[264] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[265] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[266] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[267] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[268] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[269] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[270] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[271] = {group = u8:decode("Грув"), gender = u8:decode("Мужской")},
[272] = {group = u8:decode("РМ"), gender = u8:decode("Мужской")},
[273] = {group = u8:decode("Рифа"), gender = u8:decode("Мужской")},
[274] = {group = u8:decode("Врач"), gender = u8:decode("Мужской")},
[275] = {group = u8:decode("Врач"), gender = u8:decode("Мужской")},
[276] = {group = u8:decode("Врач"), gender = u8:decode("Мужской")},
[277] = {group = u8:decode("Пожарный"), gender = u8:decode("Мужской")},
[278] = {group = u8:decode("Пожарный"), gender = u8:decode("Мужской")},
[279] = {group = u8:decode("Пожарный"), gender = u8:decode("Мужской")},
[280] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[281] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[282] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[283] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[284] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[285] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[286] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[287] = {group = u8:decode("Военный"), gender = u8:decode("Мужской")},
[288] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[289] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[290] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[291] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[292] = {group = u8:decode("Ацтек"), gender = u8:decode("Мужской")},
[293] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[294] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[295] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[296] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[297] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[298] = {group = u8:decode("Гражданский"), gender = u8:decode("Женский")},
[299] = {group = u8:decode("Гражданский"), gender = u8:decode("Мужской")},
[300] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[301] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[302] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[303] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[304] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[305] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[306] = {group = u8:decode("Полицейский"), gender = u8:decode("Женский")},
[307] = {group = u8:decode("Полицейский"), gender = u8:decode("Женский")},
[308] = {group = u8:decode("Врач"), gender = u8:decode("Женский")},
[309] = {group = u8:decode("Полицейский"), gender = u8:decode("Женский")},
[310] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")},
[311] = {group = u8:decode("Полицейский"), gender = u8:decode("Мужской")}
}
local servers = {
SRP = {
"02",
"Revolution",
"Legacy",
"Classic"
},
Evolve = {
"Saint-Louis",
"Cleveland"
},
Arizona = {
"Phoenix",
"Tucson",
"Scottdale",
"Chandler",
"Brainburg",
"Saint Rose",
"Mesa",
"Red Rock",
"Yuma",
"Surprise",
"Prescott",
"Glendale",
"Kingman",
"Winslow",
"Payson",
"Gilbert",
"Show-Low",
"Casa Grande",
"Page",
"Sun City",
"Queen Creek",
"Sedona",
"Holiday",
"Wednesday"
},
Advance = {
"Red",
"Green",
"Blue",
"Lime",
"Chocolate"
}
}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
repeat wait(0) until sampGetCurrentServerName() ~= "SA-MP"
local serverName = sampGetCurrentServerName()
project = (serverName:find('Samp%-Rp.Ru') and 'SRP' or (serverName:find('Evolve') and 'Evolve' or (serverName:find('Arizona') and 'Arizona' or (serverName:find('Advance') and 'Advance' or ''))))
if project == '' then script.sendErrorMessage("Сервер " .. serverName .. " не поддерживается") thisScript():unload() return false end
server = ''
sampAddChatMessage(serverName, -1)
for k, v in pairs(servers[project]) do
if k ~= nil then
if string.find(serverName, v, 1, true) then
server = v
break
end
if string.find(serverName, "Revo", 1, true) then
server = "Revolution"
break
end
end
end
repeat wait(0) until sampIsLocalPlayerSpawned()
if server == '' then script.sendMessage("Сервер не поддерживается") thisScript():unload() return false end
local _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
my_name = sampGetPlayerNickname(my_id)
my_day = os.date("%d")
my_month = os.date("%m")
my_year = os.date("%Y")
AdressConfig = string.format("%s\\moonloader\\config" , getGameDirectory())
AdressFolder = string.format("%s\\moonloader\\config\\Donatik\\%s\\%s\\%s", getGameDirectory(), project, server, my_name)
if not doesDirectoryExist(AdressConfig) then createDirectory(AdressConfig) end
if not doesDirectoryExist(AdressFolder) then createDirectory(AdressFolder) end
directStatistics = string.format("Donatik\\%s\\%s\\%s\\DonateMoney.ini", project, server, my_name)
directTodayTopDonaters = string.format("Donatik\\%s\\%s\\%s\\todayTopDonaters.ini", project, server, my_name)
directDonaters = string.format("Donatik\\%s\\%s\\%s\\Donaters.ini", project, server, my_name)
directTodayDonaters = string.format("Donatik\\%s\\%s\\%s\\todayDonaters.ini", project, server, my_name)
directSettings = string.format("Donatik\\%s\\%s\\%s\\Settings.ini", project, server, my_name)
directDonatersRating = string.format("Donatik\\%s\\%s\\%s\\DonatersRating.ini", project, server, my_name)
if screenshotIsAvailable then
screenshot_dir = string.format('%s\\SAMP\\%s', screenshot.getUserDirectoryPath(), "Donatik")
end
sampRegisterChatCommand("donaters", donatik.sendTodayDonaters) -- список донатеров
sampRegisterChatCommand("topdonaters", donatik.sendTopDonaters) -- список топ донатеров за все время
sampRegisterChatCommand("topdonatersziel", donatik.sendTopDonatersZiel) -- список топ донатеров на цель за все время
sampRegisterChatCommand("todayDonateMoney", donatik.sendTodayDonateMoney) -- заработанный деньги за сегодня
sampRegisterChatCommand("DonateMoney", donatik.sendDonateMoney) -- заработанные деньги за все время
sampRegisterChatCommand("DonateMoneyZiel", donatik.sendDonateMoneyZiel) -- заработанные деньги на цель за все время
sampRegisterChatCommand("dHud", donatik.hud) -- полоска худа
sampRegisterChatCommand("dtop", donatik.sendTopToN) -- топ донатеров до N
sampRegisterChatCommand("dtopZiel", donatik.sendTopZielToN) -- топ донатеров на цель до N
sampRegisterChatCommand('dMenu',
function()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end)
DonateMoney = string.format('DonateMoney')
if statistics_ini[DonateMoney] == nil then
statistics_ini = inicfg.load({
[DonateMoney] = {
money = 0,
target = 1000000,
hud = false,
zielName = "1kk"
}
}, directStatistics)
inicfg.save(statistics_ini, directStatistics)
end
todayTopPlayers = string.format('%s-%s-%s', my_day, my_month, my_year)
if todayTopDonaters_ini[todayTopPlayers] == nil then
todayTopDonaters_ini = inicfg.load({
[todayTopPlayers] = {
firstName = u8:decode"Пусто",
firstSumma = 0,
secondName = u8:decode"Пусто",
secondSumma = 0,
thirdName = u8:decode"Пусто",
thirdSumma = 0,
money = 0,
count = 0
}
}, directTodayTopDonaters)
inicfg.save(todayTopDonaters_ini, directTodayTopDonaters)
end
PlayerCount = string.format('Count')
if donatersRating_ini[PlayerCount] == nil then
donatersRating_ini = inicfg.load({
[PlayerCount] = {
count = 0
}
}, directDonatersRating)
inicfg.save(donatersRating_ini, directDonatersRating)
end
resX, resY = getScreenResolution()
if settings_ini.Settings == nil then
settings_ini = inicfg.load({
Settings = {
DonateNotify = true,
DonatersNotify = true,
TodayDonatersNotify = true,
Sound = false,
themeId = 0,
Switch = true,
textLabel = false,
DonaterJoined = false,
donateSize = 10000,
x = resX/2,
y = resY/2
},
Telegram = {
token = " ",
chat_id = " ",
bool = false
},
HotKey = {
bindDonaters = "[18,49]",
bindTopDonaters = "[18,50]",
bindTopDonatersZiel = "[18,51]",
bindTodayDonateMoney = "[18,52]",
bindDonateMoney = "[18,53]",
bindDonateMoneyZiel = "[18,54]",
bindHud = "[18,72]"
},
MyStyle = {
Text_R = 1.00,
Text_G = 1.00,
Text_B = 1.00,
Text_A = 1.00,
Button_R = 0.98,
Button_G = 0.43,
Button_B = 0.26,
Button_A = 0.40,
ButtonActive_R = 0.98,
ButtonActive_G = 0.43,
ButtonActive_B = 0.26,
ButtonActive_A = 1.00,
FrameBg_R = 0.48,
FrameBg_G = 0.23,
FrameBg_B = 0.16,
FrameBg_A = 0.25,
FrameBgHovered_R = 0.98,
FrameBgHovered_G = 0.43,
FrameBgHovered_B = 0.26,
FrameBgHovered_A = 0.40,
Title_R = 0.48,
Title_G = 0.23,
Title_B = 0.16,
Title_A = 1.00,
Separator_R = 0.43,
Separator_G = 0.43,
Separator_B = 0.50,
Separator_A = 0.50,
CheckMark_R = 0.98,
CheckMark_G = 0.43,
CheckMark_B = 0.26,
CheckMark_A = 1.00,
WindowBg_R = 0.06,
WindowBg_G = 0.06,
WindowBg_B = 0.06,
WindowBg_A = 0.94
}
}, directSettings)
inicfg.save(settings_ini, directSettings)
end
AdressFolderZiel = string.format("%s\\moonloader\\config\\Donatik\\%s\\%s\\%s\\%s", getGameDirectory(), project, server, my_name, statistics_ini[DonateMoney].zielName)
if not doesDirectoryExist(AdressFolderZiel) then createDirectory(AdressFolderZiel) end
directDonatersZiel = string.format("Donatik\\%s\\%s\\%s\\%s\\Donaters.ini", project, server, my_name, statistics_ini[DonateMoney].zielName)
directStatisticsZiel = string.format("Donatik\\%s\\%s\\%s\\%s\\DonateMoney.ini", project, server, my_name, statistics_ini[DonateMoney].zielName)
directDonatersRatingZiel = string.format("Donatik\\%s\\%s\\%s\\%s\\DonatersRating.ini", project, server, my_name, statistics_ini[DonateMoney].zielName)
PlayerZielCount = string.format('Count')
if donatersRatingZiel_ini[PlayerZielCount] == nil then
donatersRatingZiel_ini = inicfg.load({
[PlayerZielCount] = {
count = 0
}
}, directDonatersRatingZiel)
inicfg.save(donatersRatingZiel_ini, directDonatersRatingZiel)
end
DonateMoneyZiel = string.format('DonateMoneyZiel')
if statistics_ziel_ini[DonateMoneyZiel] == nil then
statistics_ziel_ini = inicfg.load({
[DonateMoneyZiel] = {
money = 0,
target = statistics_ini[DonateMoney].target,
count = 0
}
}, directStatisticsZiel)
inicfg.save(statistics_ziel_ini, directStatisticsZiel)
end
lua_thread.create(function()
wait(0)
imgui.SwitchContext()
imgui.GetIO().Fonts:Clear()
glyph_ranges_cyrillic = imgui.GetIO().Fonts:GetGlyphRangesCyrillic()
imgui.GetIO().Fonts:AddFontFromFileTTF("C:/Windows/Fonts/arial.ttf", toScreenX(6), nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic())
imgui.RebuildFonts()
imgui.updateMyStyle(settings_ini.Settings.themeId)
end)
statistics_ini = inicfg.load(nil, directStatistics)
statistics_ziel_ini = inicfg.load(nil, directStatisticsZiel)
settings_ini = inicfg.load(nil, directSettings)
donaters_ini = inicfg.load(donaters_ini, directDonaters)
donatersZiel_ini = inicfg.load(donatersZiel_ini, directDonatersZiel)
donatersRating_ini = inicfg.load(nil, directDonatersRating)
donatersRatingZiel_ini = inicfg.load(nil, directDonatersRatingZiel)
todayDonaters_ini = inicfg.load(todayDonaters_ini, directTodayDonaters)
todayTopDonaters_ini = inicfg.load(nil, directTodayTopDonaters)
jsonDonaters = { v = decodeJson(settings_ini.HotKey.bindDonaters) }
jsonTopDonaters = { v = decodeJson(settings_ini.HotKey.bindTopDonaters) }
jsonTopDonatersZiel = { v = decodeJson(settings_ini.HotKey.bindTopDonatersZiel) }
jsonTodayDonateMoney = { v = decodeJson(settings_ini.HotKey.bindTodayDonateMoney) }
jsonDonateMoney = { v = decodeJson(settings_ini.HotKey.bindDonateMoney) }
jsonDonateMoneyZiel = { v = decodeJson(settings_ini.HotKey.bindDonateMoneyZiel) }
jsonHud = { v = decodeJson(settings_ini.HotKey.bindHud) }
bindDonaters = rkeys.registerHotKey(jsonDonaters.v, true, donatik.sendTodayDonaters)
bindTopDonaters = rkeys.registerHotKey(jsonTopDonaters.v, true, donatik.sendTopDonaters)
bindTopDonatersZiel = rkeys.registerHotKey(jsonTopDonatersZiel.v, true, donatik.sendTopDonatersZiel)
bindTodayDonateMoney = rkeys.registerHotKey(jsonTodayDonateMoney.v, true, donatik.sendTodayDonateMoney)
bindDonateMoney = rkeys.registerHotKey(jsonDonateMoney.v, true, donatik.sendDonateMoney)
bindDonateMoneyZiel = rkeys.registerHotKey(jsonDonateMoneyZiel.v, true, donatik.sendDonateMoneyZiel)
bindHud = rkeys.registerHotKey(jsonHud.v, true, donatik.hud)
imgui.initBuffers()
soundManager.loadSound("100k")
soundManager.loadSound("75k")
soundManager.loadSound("50k")
soundManager.loadSound("25k")
soundManager.loadSound("10k")
soundManager.loadSound("5k")
soundManager.loadSound("1k")
soundManager.loadSound("100")
soundManager.loadSound("0")
chatManager.initQueue()
lua_thread.create(chatManager.checkMessagesQueueThread)
lua_thread.create(tg.getUpdates)
tg.getLastUpdate()
checkUpdates()
donatik.getGroupsCount()
percent = (tonumber(statistics_ziel_ini[DonateMoneyZiel].money)/tonumber(statistics_ziel_ini[DonateMoneyZiel].target))
script.loaded = true
imgui.Process = true
script.sendMessage("Успешно загрузился! {40E0D0}[" .. project .. "-" .. server .. "]")
if not settings_ini.Settings.Switch then
script.sendMessage("Скрипт в данный момент выключен! Включить /dhud > Информация > Включить")
end
while true do
wait(0)
imgui.ShowCursor = false
if isKeyJustPressed(VK_ESCAPE) and main_window_state.v then
main_window_state.v = false
end
if not sampIsDialogActive() and not sampIsChatInputActive() then
if (isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_P)) or isKeyJustPressed(vkeys.VK_PAUSE) then
script.sendMessage("Сообщения остановлены")
chatManager.initQueue()
end
end
donatik.textLabelOverPlayerNickname()
donatik.topDonaterJoined()
end
end
------------------------------------------ Donatik Functions ------------------------------------------
textlabel = {}
function donatik.textLabelOverPlayerNickname()
if settings_ini.Settings.textLabel then
for i = 0, 999 do
if textlabel[i] ~= nil then
sampDestroy3dText(textlabel[i])
textlabel[i] = nil
end
end
for i = 0, 999 do
if sampIsPlayerConnected(i) and sampGetPlayerScore(i) ~= 0 then
donaterNick = sampGetPlayerNickname(i)
if donaters_ini[donaterNick] ~= nil then
if donaterNick == donaters_ini[donaterNick].nick then
if textlabel[i] == nil then
textlabel[i] = sampCreate3dText(convertNumber(donaters_ini[donaterNick].money) .. " [" .. donatik.getDonaterPlace(donaterNick) .. "]", 0xFFFFFF00, 0.0, 0.0, 0.35, 22, false, i, -1)
end
end
end
else
if textlabel[i] ~= nil then
sampDestroy3dText(textlabel[i])
textlabel[i] = nil
end
end
end
else
for i = 0, 999 do
if textlabel[i] ~= nil then
sampDestroy3dText(textlabel[i])
textlabel[i] = nil
end
end
end
end
donatersOnline = {}
donatersOnlineNickname = {}
function donatik.topDonaterJoined()
if settings_ini.Settings.DonaterJoined then
for i = 0, 999 do
if sampIsPlayerConnected(i) and sampGetPlayerScore(i) ~= 0 then
donatersOnlineNickname[i] = sampGetPlayerNickname(i)
if donaters_ini[donatersOnlineNickname[i]] ~= nil then
if donatersOnlineNickname[i] == donaters_ini[donatersOnlineNickname[i]].nick then
if not donatersOnline[i] then
if tonumber(donaters_ini[donatersOnlineNickname[i]].money) >= tonumber(settings_ini.Settings.donateSize) then
script.sendMessage("На сервер зашёл{40E0D0} " .. donaters_ini[donatersOnlineNickname[i]].nick .. " [" .. i .. "]")
donatersOnline[i] = true
end
end
end
end
else
if donatersOnline[i] then
script.sendMessage("С сервера вышел{40E0D0} " .. donatersOnlineNickname[i])
donatersOnline[i] = false
donatersOnlineNickname[i] = nil
end
end
end
end
end
function donatik.sortDonatersRating()
local tempDonaterMoney, tempDonaterNick
for i = 1, tonumber(donatersRating_ini[PlayerCount].count) do
for j = 0, tonumber(donatersRating_ini[PlayerCount].count) - i do
if donatersRating_ini[j] ~= nil and donatersRating_ini[j + 1] ~= nil then
if tonumber(donatersRating_ini[j].money) < tonumber(donatersRating_ini[j + 1].money) then
tempDonaterMoney = donatersRating_ini[j].money
donatersRating_ini[j].money = donatersRating_ini[j + 1].money
donatersRating_ini[j + 1].money = tempDonaterMoney
tempDonaterNick = donatersRating_ini[j].nick
donatersRating_ini[j].nick = donatersRating_ini[j + 1].nick
donatersRating_ini[j + 1].nick = tempDonaterNick
end
end
end
end
inicfg.save(donatersRating_ini, directDonatersRating)
end
function donatik.sortDonatersZielRating()
local tempDonaterZielMoney, tempDonaterZielNick
for i = 1, tonumber(donatersRatingZiel_ini[PlayerZielCount].count) do
for j = 0, tonumber(donatersRatingZiel_ini[PlayerZielCount].count) - i do
if donatersRatingZiel_ini[j] ~= nil and donatersRatingZiel_ini[j + 1] ~= nil then
if tonumber(donatersRatingZiel_ini[j].money) < tonumber(donatersRatingZiel_ini[j + 1].money) then
tempDonaterZielMoney = donatersRatingZiel_ini[j].money
donatersRatingZiel_ini[j].money = donatersRatingZiel_ini[j + 1].money
donatersRatingZiel_ini[j + 1].money = tempDonaterZielMoney
tempDonaterZielNick = donatersRatingZiel_ini[j].nick
donatersRatingZiel_ini[j].nick = donatersRatingZiel_ini[j + 1].nick
donatersRatingZiel_ini[j + 1].nick = tempDonaterZielNick
end
end
end
end
inicfg.save(donatersRatingZiel_ini, directDonatersRatingZiel)
end
function donatik.getDonaterPlace(nickname)
for i = 0, tonumber(donatersRating_ini[PlayerCount].count) do
if donatersRating_ini[i] ~= nil then
if donatersRating_ini[i].nick == nickname then
return i
end
end
end
end
function donatik.getDonaterZielPlace(nickname)
for i = 0, tonumber(donatersRatingZiel_ini[PlayerZielCount].count) do
if donatersRatingZiel_ini[i] ~= nil then
if donatersRatingZiel_ini[i].nick == nickname then
return i
end
end
end
end
function donatik.hud()
statistics_ini[DonateMoney].hud = not statistics_ini[DonateMoney].hud
printStringNow((statistics_ini[DonateMoney].hud and '~g~DonatikHUD: ON' or '~r~DonatikHUD: OFF'), 2000)
inicfg.save(statistics_ini, directStatistics)
end
function donatik.sendTodayDonaters()
chatManager.addMessageToQueue("Список пожертвований от уважаемых людей за сегодня: ", false)
local rankFirst, rankSecond, rankThird = "Господин", "Господин", "Господин"
if donaters_ini[todayTopDonaters_ini[todayTopPlayers].firstName] ~= nil then
rankFirst = u8(donaters_ini[todayTopDonaters_ini[todayTopPlayers].firstName].rank)
end
if donaters_ini[todayTopDonaters_ini[todayTopPlayers].secondName] ~= nil then
rankSecond = u8(donaters_ini[todayTopDonaters_ini[todayTopPlayers].secondName].rank)
end
if donaters_ini[todayTopDonaters_ini[todayTopPlayers].thirdName] ~= nil then
rankThird = u8(donaters_ini[todayTopDonaters_ini[todayTopPlayers].thirdName].rank)
end
chatManager.addMessageToQueue("1. " .. rankFirst .. " " .. u8(todayTopDonaters_ini[todayTopPlayers].firstName) .. " с суммой " .. convertNumber(todayTopDonaters_ini[todayTopPlayers].firstSumma) .. " вирт", false)
chatManager.addMessageToQueue("2. " .. rankSecond .. " " .. u8(todayTopDonaters_ini[todayTopPlayers].secondName) .. " с суммой " .. convertNumber(todayTopDonaters_ini[todayTopPlayers].secondSumma) .. " вирт", false)
chatManager.addMessageToQueue("3. " .. rankThird .. " " .. u8(todayTopDonaters_ini[todayTopPlayers].thirdName) .. " с суммой " .. convertNumber(todayTopDonaters_ini[todayTopPlayers].thirdSumma) .. " вирт", false)
chatManager.addMessageToQueue("Чтобы занять определенное место в списке, необходимо пожертвовать больше денег", false)
end
function donatik.sendTopDonaters()
chatManager.addMessageToQueue("Список пожертвований от уважаемых людей за все время: ", false)
for i = 1, 3 do
donatersRating_ini = inicfg.load(i, directDonatersRating)
if donatersRating_ini[i] ~= nil then
if donaters_ini[donatersRating_ini[i].nick] ~= nil then
chatManager.addMessageToQueue(i .. ". " .. u8(donaters_ini[donatersRating_ini[i].nick].rank) .. " " .. donatersRating_ini[i].nick .. " с суммой " .. convertNumber(donatersRating_ini[i].money) .. " вирт", false)
else
chatManager.addMessageToQueue(i .. ". Господин " .. donatersRating_ini[i].nick .. " с суммой " .. convertNumber(donatersRating_ini[i].money) .. " вирт", false)
end
else
chatManager.addMessageToQueue(i .. ". Господин Пусто с суммой 0 вирт", false)
end
end
chatManager.addMessageToQueue("Чтобы занять определенное место в списке, необходимо пожертвовать больше денег", false)
end
function donatik.sendTopDonatersZiel()
chatManager.addMessageToQueue("Список пожертвований от уважаемых людей на \"" .. statistics_ini[DonateMoney].zielName .. "\" за все время", false)
for i = 1, 3 do
donatersRatingZiel_ini = inicfg.load(i, directDonatersRatingZiel)
if donatersRatingZiel_ini[i] ~= nil then
if donaters_ini[donatersRatingZiel_ini[i].nick] ~= nil then
chatManager.addMessageToQueue(i .. ". " .. u8(donaters_ini[donatersRatingZiel_ini[i].nick].rank) .. " " .. donatersRatingZiel_ini[i].nick .. " с суммой " .. convertNumber(donatersRatingZiel_ini[i].money) .. " вирт", false)
else
chatManager.addMessageToQueue(i .. ". Господин " .. donatersRatingZiel_ini[i].nick .. " с суммой " .. convertNumber(donatersRatingZiel_ini[i].money) .. " вирт", false)
end
else
chatManager.addMessageToQueue(i .. ". Господин Пусто с суммой 0 вирт", false)
end
end
chatManager.addMessageToQueue("Чтобы занять определенное место в списке, необходимо пожертвовать больше денег", false)
end
function donatik.sendTodayDonateMoney()
chatManager.addMessageToQueue("Всего за день собрано: " .. convertNumber(todayTopDonaters_ini[todayTopPlayers].money), true)
end
function donatik.sendDonateMoney()
chatManager.addMessageToQueue("Денег собрано за все время: " .. convertNumber(statistics_ini[DonateMoney].money), true)
end
function donatik.sendDonateMoneyZiel()
chatManager.addMessageToQueue(string.format("Денег на цель \"%s\" собрано: %s/%s [%s]", statistics_ini[DonateMoney].zielName, convertNumber(statistics_ziel_ini[DonateMoneyZiel].money), convertNumber(statistics_ziel_ini[DonateMoneyZiel].target), string.sub(tostring(percent * 100), 1, 5)), true)
end
function donatik.sendTopToN(arg)
if arg ~= nil and arg ~= "" then
chatManager.addMessageToQueue("Список пожертвований от уважаемых людей за все время до " .. arg .. " места", false)
for i = 0, arg do
donatersRating_ini = inicfg.load(i, directDonatersRating)
if donatersRating_ini[i] ~= nil then
if donaters_ini[donatersRating_ini[i].nick] ~= nil then
chatManager.addMessageToQueue(i .. ". " .. u8(donaters_ini[donatersRating_ini[i].nick].rank) .. " " .. donatersRating_ini[i].nick .. " с суммой " .. convertNumber(donatersRating_ini[i].money) .. " вирт", false)
end
end
end
chatManager.addMessageToQueue("Всего " .. convertNumber(donatersRating_ini[PlayerCount].count) .. " пожертвующих", false)
end
end
function donatik.sendTopZielToN(arg)
if arg ~= nil and arg ~= "" then
chatManager.addMessageToQueue("Список пожертвований от уважаемых людей на \"" .. statistics_ini[DonateMoney].zielName .. "\" за все время до" .. arg .. " места", false)
for i = 0, arg do
donatersRatingZiel_ini = inicfg.load(i, directDonatersRatingZiel)
if donatersRatingZiel_ini[i] ~= nil then
if donaters_ini[donatersRatingZiel_ini[i].nick] ~= nil then
chatManager.addMessageToQueue(i .. ". " .. u8(donaters_ini[donatersRatingZiel_ini[i].nick].rank) .. " " .. donatersRatingZiel_ini[i].nick .. " с суммой " .. convertNumber(donatersRatingZiel_ini[i].money) .. " вирт", false)
end
end
end
chatManager.addMessageToQueue("Всего " .. convertNumber(donatersRatingZiel_ini[PlayerCount].count) .. " пожертвующих", false)
end
end
function donatik.sendSelectedDayDonaters(d, m, y, firstName, firstSumma, secondName, secondSumma, thirdName, thirdSumma)
chatManager.addMessageToQueue(string.format("Список пожертвований от уважаемых людей за %s.%s.%s", d, m, y), false)
local rankFirst, rankSecond, rankThird = "", "", ""
if donaters_ini[firstName] ~= nil then
rankFirst = u8(donaters_ini[firstName].rank)
end
if donaters_ini[secondName] ~= nil then
rankSecond = u8(donaters_ini[secondName].rank)
end
if donaters_ini[thirdName] ~= nil then
rankThird = u8(donaters_ini[thirdName].rank)
end
chatManager.addMessageToQueue("1. " .. rankFirst .. " " .. u8(firstName) .. " с суммой " .. convertNumber(firstSumma) .. " вирт", false)
chatManager.addMessageToQueue("2. " .. rankSecond .. " " .. u8(secondName) .. " с суммой " .. convertNumber(secondSumma) .. " вирт", false)
chatManager.addMessageToQueue("3. " .. rankThird .. " " .. u8(thirdName) .. " с суммой " .. convertNumber(thirdSumma) .. " вирт", false)
end
function donatik.sendDonaterInfo(PlayerName)
Player = string.format('%s', PlayerName)
if donaters_ini[Player] == nil then
chatManager.addMessageToQueue(PlayerName .. " в базе данных не обнаружен", false)
else
if donatik.getDonaterZielPlace(donaters_ini[Player].nick) ~= nil then
chatManager.addMessageToQueue(u8(donaters_ini[Player].rank) .. " " .. donaters_ini[Player].nick .. " находится на " .. donatik.getDonaterPlace(donaters_ini[Player].nick) .. " месте в списке за все время и на " .. donatik.getDonaterZielPlace(donaters_ini[Player].nick) .. " в списке на цель \"" .. statistics_ini[DonateMoney].zielName .. "\"", false)
else
chatManager.addMessageToQueue(u8(donaters_ini[Player].rank) .. " " .. donaters_ini[Player].nick .. " находится на " .. donatik.getDonaterPlace(donaters_ini[Player].nick) .. " месте в списке за все время", false)
end
chatManager.addMessageToQueue("Сумма пожертвований за все время составляет: " .. convertNumber(donaters_ini[Player].money), false)
if donatersZiel_ini[Player] ~= nil then
chatManager.addMessageToQueue("На цель \"" .. statistics_ini[DonateMoney].zielName .. "\" составляет: " .. convertNumber(donatersZiel_ini[Player].money), false)
end
todayPlayer = string.format('%s-%s-%s-%s', my_day, my_month, my_year, PlayerName)
if todayDonaters_ini[todayPlayer] == nil then
chatManager.addMessageToQueue("Сегодня пожертвований не было", false)
else
chatManager.addMessageToQueue("За сегодня составляет: " .. convertNumber(todayDonaters_ini[todayPlayer].money), false)
end
end
end
function donatik.setRank(nick)
money = tonumber(donaters_ini[nick].money)
if money >= 1000000 then
donaters_ini[nick].rank = u8:decode("Легенда")
elseif money >= 500000 and money < 1000000 then
donaters_ini[nick].rank = u8:decode("Меценат")
elseif money >= 250000 and money < 500000 then
donaters_ini[nick].rank = u8:decode("Спонсор")
elseif money >= 100000 and money < 250000 then
donaters_ini[nick].rank = u8:decode("Щедрая душа")
elseif money >= 50000 and money < 100000 then
if donaters_ini[nick].gender == u8:decode("Мужской") then donaters_ini[nick].rank = u8:decode("Покровитель") else donaters_ini[nick].rank = u8:decode("Покровительница") end
elseif money >= 25000 and money < 50000 then
donaters_ini[nick].rank = u8:decode("Филантроп")
elseif money >= 10000 and money < 25000 then
if donaters_ini[nick].gender == u8:decode("Мужской") then donaters_ini[nick].rank = u8:decode("Господин") else donaters_ini[nick].rank = u8:decode("Госпожа") end
elseif money >= 5000 and money < 10000 then
if donaters_ini[nick].gender == u8:decode("Мужской") then donaters_ini[nick].rank = u8:decode("Уважаемый") else donaters_ini[nick].rank = u8:decode("Уважаемая") end
elseif money >= 1000 and money < 5000 then
donaters_ini[nick].rank = u8:decode("Доброжелатель")
elseif money >= 500 and money < 1000 then
donaters_ini[nick].rank = u8:decode("Добряк")
elseif money > 0 and money < 500 then
donaters_ini[nick].rank = u8:decode("Бомжик")
elseif money == 0 then
donaters_ini[nick].rank = u8:decode("Нулевый")