-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTrinity-HUD.lua
More file actions
1071 lines (983 loc) · 44.5 KB
/
Trinity-HUD.lua
File metadata and controls
1071 lines (983 loc) · 44.5 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
-- ABOUT SCRIPT
script_name("Trinity HUD")
script_version("1.3")
script_authors("eweest")
script_description("12.09.2022")
script_url("https://vk.com/gtatrinitymods")
local SCRIPT = thisScript()
local SCRIPT_NAME = string.gsub(SCRIPT.name, "%s", "-")
---- ASSETS [START]
-- SCREEN RESOLUTION
local sX, sY = getScreenResolution()
if sX == 1920 and sY == 1080 then
pX, pY = 1, 1
else
pX, pY = sX/1920, sY/1080
end
local loadTexture = {}
local loadWeaponTexture = {}
local wanted = {us = 0, rc = 0, af = 0, city = "none"}
local jailTimerState = false
local jailTimerEnd = -1
-- LIB
local lib, sampev = pcall(require, "lib.samp.events")
assert(lib, "{FF3232}Îòñóòñòâóåò áèáëèòåêà \"lib.samp.events\"")
local lib, memory = pcall(require, "memory")
assert(lib, "{FF3232}Îòñóòñòâóåò áèáëèòåêà \"memory\"")
local lib, weapons = pcall(require, "game.weapons")
assert(lib, "{FF3232}Îòñóòñòâóåò áèáëèòåêà \"game.weapons\"")
-- FONTS
local FONT_SCRIPT = "PFDinDisplayPro-Medium"
local FONTS = {
["hud-22"] = renderCreateFont(FONT_SCRIPT, 22*pY, 0),
["hud-18"] = renderCreateFont(FONT_SCRIPT, 18*pY, 0),
["hud-16"] = renderCreateFont(FONT_SCRIPT, 16*pY, 0),
["hud-14"] = renderCreateFont(FONT_SCRIPT, 14*pY, 0),
["hud-12"] = renderCreateFont(FONT_SCRIPT, 12*pY, 0),
["hud-10"] = renderCreateFont(FONT_SCRIPT, 10*pY, 0),
}
-- CHAT
local CMD_SCRIPT = "/hud"
local CHAT_MSG = {
["TAG"] = "Trinity Mods",
["done"] = {color = "0xFFCC00", colorText = "FFFFFF", sound_id = 1083},
["warning"] = {color = "0xFF9832", colorText = "9E9E9E", sound_id = 1085},
["error"] = {color = "0xFF3232", colorText = "9E9E9E", sound_id = 1055},
["trinity"] = {color = "0x75C225", colorText = "FFFFFF", sound_id = 0},
}
-- TRINITY SERVERS
local TRINITYGTA_IP = {
["RPG"] = "185.169.134.83",
["RP1"] = "185.169.134.84",
["RP2"] = "185.169.134.85"
}
-- PATHS
local DIRECT = getWorkingDirectory()
local MAIN_PATH = DIRECT .. "\\config\\Trinity GTA Mods\\"
local FOLDER_PATH = SCRIPT.name .. "\\"
-- local MODULES_PATH = "modules\\"
local CONFIG_PATH = "config\\"
local TEXTURES_PATH = "textures\\"
local WEAPON_PATH = "weapon\\"
local SETTINGS_PATH = SCRIPT.name .."-settings.json"
-- MODULE
local TABLE_TDW = {
["EAT"] = -1,
["WATER"] = -1,
["HYGIENE"] = -1,
["INV"] = -1,
["GREEN_ZONE"] = -1,
["CONVOY_ZONE"] = -1,
["SMUGGLE_ZONE"] = -1,
["CHIP"] = -1,
["TIME"] = -1,
["DATE"] = -1,
["OTHER"] = {}
}
-- TEXTURES
local TEXTURES = { -- NAME, URL
["hud-bg"] = {"hud-bg.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-bg.png"},
["hud-bg-head"] = {"hud-bg-head.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-bg-head.png"},
["hud-bg-time"] = {"hud-bg-time.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-bg-time.png"},
["hud-bg-weapon"] = {"hud-bg-weapon.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-bg-weapon.png"},
-- ICONS
["hud-health"] = {"hud-health.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-health.png"},
["hud-armor"] = {"hud-armor.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-armor.png"},
["hud-oxygen"] = {"hud-oxygen.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-oxygen.png"},
["hud-eat"] = {"hud-eat.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-eat.png"},
["hud-water"] = {"hud-water.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-water.png"},
["hud-hygiene"] = {"hud-hygiene.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-hygiene.png"},
["hud-ammo"] = {"hud-ammo.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-ammo.png"},
["hud-money"] = {"hud-money.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-money.png"},
["hud-online"] = {"hud-online.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-online.png"},
["hud-id"] = {"hud-id.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-id.png"},
["hud-time"] = {"hud-time.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/hud-time.png"},
["green-zone"] = {"green-zone.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/green-zone.png"},
["convoy-zone"] = {"convoy-zone.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/convoy-zone.png"},
["smuggle-zone"] = {"smuggle-zone.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/smuggle-zone.png"},
["jailtime"] = {"jailtime.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/jailtime.png"},
["wanted-ls"] = {"wanted-ls.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/wanted-ls.png"},
["wanted-lv"] = {"wanted-lv.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/wanted-lv.png"},
["wanted-sf"] = {"wanted-sf.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/wanted-sf.png"},
-- MATERIALS
["round"] = {"round.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/round.png"},
}
local TEXTURES_WEAPON = { -- ID, URL
["0"] = {"0.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/0.png"},
["1"] = {"1.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/1.png"},
["2"] = {"2.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/2.png"},
["3"] = {"3.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/3.png"},
["4"] = {"4.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/4.png"},
["5"] = {"5.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/5.png"},
["6"] = {"6.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/6.png"},
["7"] = {"7.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/7.png"},
["8"] = {"8.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/8.png"},
["9"] = {"9.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/9.png"},
["10"] = {"10.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/10.png"},
["11"] = {"11.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/11.png"},
["12"] = {"12.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/12.png"},
["13"] = {"13.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/13.png"},
["14"] = {"14.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/14.png"},
["15"] = {"15.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/15.png"},
["16"] = {"16.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/16.png"},
["17"] = {"17.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/17.png"},
["18"] = {"18.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/18.png"},
["22"] = {"22.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/22.png"},
["23"] = {"23.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/23.png"},
["24"] = {"24.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/24.png"},
["25"] = {"25.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/25.png"},
["26"] = {"26.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/26.png"},
["27"] = {"27.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/27.png"},
["28"] = {"28.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/28.png"},
["29"] = {"29.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/29.png"},
["30"] = {"30.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/30.png"},
["31"] = {"31.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/31.png"},
["32"] = {"32.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/32.png"},
["33"] = {"33.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/33.png"},
["34"] = {"34.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/34.png"},
["35"] = {"35.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/35.png"},
["36"] = {"36.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/36.png"},
["37"] = {"37.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/37.png"},
["38"] = {"38.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/38.png"},
["39"] = {"39.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/39.png"},
["40"] = {"40.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/40.png"},
["41"] = {"41.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/41.png"},
["42"] = {"42.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/42.png"},
["43"] = {"43.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/43.png"},
["44"] = {"44.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/44.png"},
["45"] = {"45.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/45.png"},
["46"] = {"46.png", "https://github.com/eweest/Trinity-HUD/raw/main/assets/textures/weapon/46.png"}
}
-- GIT-HUB PATH
local UPDATE_JSON_PATH = "https://raw.githubusercontent.com/eweest/" .. SCRIPT_NAME .. "/main/assets/update.json"
local UPDATE_FILE_PATH = "https://raw.githubusercontent.com/eweest/" .. SCRIPT_NAME .. "/main/" .. SCRIPT_NAME .. ".lua"
-- CONFIG "settings.json"
local SETTINGS = {
["RPG"] = {
["VIEW"] = true,
["VIEW_CHAT"] = false,
["VIEW_TIME"] = true,
},
["RP1"] = {
["VIEW"] = true,
["VIEW_CHAT"] = false,
["VIEW_TIME"] = true,
},
["RP2"] = {
["VIEW"] = true,
["VIEW_CHAT"] = false,
["VIEW_TIME"] = true,
},
["AUTOUPDATE"] = false
}
-- CHECK FOLDERS DIRECTORY
for _, FOLDER in ipairs({CONFIG_PATH, TEXTURES_PATH, TEXTURES_PATH .. WEAPON_PATH}) do
if not doesDirectoryExist(MAIN_PATH .. FOLDER_PATH .. FOLDER) then
createDirectory(MAIN_PATH .. FOLDER_PATH .. FOLDER) -- SCRIPT MAIN FOLDER
print(string.format("Ðàáî÷àÿ ïàïêà {00FF00}%s{CCCCCC} áûëà óñïåøíî ñîçäàíà.", FOLDER))
else
print(string.format("Ðàáî÷àÿ ïàïêà {FFFFFF}%s{CCCCCC} ïðèñóòñòâóåò.", FOLDER))
end
end
print(string.format("Ôàéëû ðåñóðñîâ íàõîäÿòñÿ ïî ïóòè: {FFFFFF}%s{CCCCCC}", MAIN_PATH .. FOLDER_PATH))
for _, NAME_URL in pairs(TEXTURES_WEAPON) do
if not doesFileExist(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. WEAPON_PATH .. NAME_URL[1]) then
downloadUrlToFile(NAME_URL[2], MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. WEAPON_PATH .. NAME_URL[1])
print(string.format("Ôàéë ïî ïóòè: {FFFFFF}%s{32FF32}%s{CCCCCC} óñïåøíî cêà÷åí.", MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. WEAPON_PATH, NAME_URL[1]))
end
end
for _, NAME_URL in pairs(TEXTURES) do
if not doesFileExist(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. NAME_URL[1]) then
downloadUrlToFile(NAME_URL[2], MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. NAME_URL[1])
print(string.format("Ôàéë ïî ïóòè: {FFFFFF}%s{32FF32}%s{CCCCCC} óñïåøíî cêà÷åí.", MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH, NAME_URL[1]))
end
end
-- SETTINGS PATH (JSON)
if not doesFileExist(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH) then
local settingFile = io.open(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH, "w")
settingFile:write(encodeJson(SETTINGS))
io.close(settingFile)
print(string.format("Ôàéë íàñòðîåê {00FF00}%s{CCCCCC} óñïåøíî ñîçäàí.", SETTINGS_PATH))
end
if doesFileExist(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH) then
local settingFile = io.open(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH, "r")
if settingFile then
DB = decodeJson(settingFile:read("*a"))
io.close(settingFile)
end
print(string.format("Ôàéë íàñòðîåê {FFFFFF}%s{CCCCCC} óñïåøíî çàãðóæåí.", SETTINGS_PATH))
end
---- ASSETS [END]
-- <FUNCTION> MAIN [START]
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
-- CHECK UPDATE
if DB["AUTOUPDATE"] then
DB["AUTOUPDATE"] = true
autoupdate(UPDATE_JSON_PATH, CHAT_MSG["TAG"], UPDATE_FILE_PATH)
else
print("Àâòîîáíîâëåíèå Îòêëþ÷åíî.")
end
-- TRINITY SERVERS
local IP = sampGetCurrentServerAddress()
-- CHECK ALL TRINITY SERVERS
if IP:find(TRINITYGTA_IP["RPG"]) or IP:find(TRINITYGTA_IP["RP1"]) or IP:find(TRINITYGTA_IP["RP2"]) then
-- LOAD TEXTURES
for TEXTURE, PATH in pairs(TEXTURES) do
loadTexture[TEXTURE] = renderLoadTextureFromFile(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. PATH[1])
end
-- LOAD TEXTURES (WEAPON)
for TEXTURE, PATH in pairs(TEXTURES_WEAPON) do
loadWeaponTexture[TEXTURE] = renderLoadTextureFromFile(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. WEAPON_PATH .. PATH[1])
end
-- CHECK TRINITY SERVERS
if IP:find(TRINITYGTA_IP["RPG"]) then
GET_SERVER = "RPG"
elseif IP:find(TRINITYGTA_IP["RP1"]) then
GET_SERVER = "RP1"
elseif IP:find(TRINITYGTA_IP["RP2"]) then
GET_SERVER = "RP2"
end
--
TRINITYGTA = true
sendToChatMsg(string.format("Ðåñóðñ {FFCC00}%s (v%s){FFFFFF} çàïóùåí. Àâòîð: {FFCC00}%s{FFFFFF}. Ïîìîùü {FFCC00}%s", SCRIPT.name, SCRIPT.version,unpack(SCRIPT.authors), CMD_SCRIPT), "done")
else
TRINITYGTA = false
sendToChatMsg(string.format("Ðåñóðñ {FFCC00}%s{9E9E9E} íå çàïóùåí. Âû èãðàåòå íå íà {FFFFFF}Trinity{75C225}GTA{FFFFFF}.", SCRIPT.name), "warning")
unloadScript()
end
-- COMMANDS
sampRegisterChatCommand("hud", function(cmd)
if (cmd == "view" or cmd == "vw") then
DB[GET_SERVER]["VIEW"] = not DB[GET_SERVER]["VIEW"]
if DB[GET_SERVER]["VIEW"] then
DB[GET_SERVER]["VIEW"] = true
sendToChatMsg("Âû âêëþ÷èëè ïîêàç HUD.", "done", true)
else
DB[GET_SERVER]["VIEW"] = false
sendToChatMsg("Âû îòêëþ÷èëè ïîêàç HUD.", "warning", true)
end
saveSetting()
elseif cmd == ("chat") then
DB[GET_SERVER]["VIEW_CHAT"] = not DB[GET_SERVER]["VIEW_CHAT"]
if DB[GET_SERVER]["VIEW_CHAT"] then
DB[GET_SERVER]["VIEW_CHAT"] = true
sendToChatMsg("Âû âêëþ÷èëè ïîêàç HUD ïðè ñêðûòîì ÷àòå.", "done", true)
else
DB[GET_SERVER]["VIEW_CHAT"] = false
sendToChatMsg("Âû îòêëþ÷èëè ïîêàç HUD ïðè ñêðûòîì ÷àòå.", "warning", true)
end
saveSetting()
elseif cmd == ("time") then
DB[GET_SERVER]["VIEW_TIME"] = not DB[GET_SERVER]["VIEW_TIME"]
if DB[GET_SERVER]["VIEW_TIME"] then
DB[GET_SERVER]["VIEW_TIME"] = true
sendToChatMsg("Âû âêëþ÷èëè ïîêàç âðåìåíè ïðè ñêðûòèè HUD.", "done", true)
else
DB[GET_SERVER]["VIEW_TIME"] = false
sendToChatMsg("Âû îòêëþ÷èëè ïîêàç âðåìåíè ïðè ñêðûòèè HUD.", "warning", true)
end
saveSetting()
elseif (cmd == "update" or cmd == "up") then -- UPDATE
DB["AUTOUPDATE"] = not DB["AUTOUPDATE"]
if DB["AUTOUPDATE"] then
DB["AUTOUPDATE"] = true
sendToChatMsg(string.format("Âû âêëþ÷èëè àâòîîáíîâëåíèå äëÿ ðåñóðñà %s.", SCRIPT.name), "done", true)
else
DB["AUTOUPDATE"] = false
sendToChatMsg(string.format("Âû îòêëþ÷èëè àâòîîáíîâëåíèå äëÿ ðåñóðñà %s.", SCRIPT.name), "warning", true)
end
reloadScript()
saveSetting()
-- REMOVE CACHE
elseif cmd == "reset" then -- REMOVE SETTINGS
os.remove(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH)
reloadScript()
elseif cmd == "resetall" then -- REMOVE CACHE
sendToChatMsg(string.format("Âû ïðîèçâåëè {FF3232}ñáðîñ âñåõ{FFFFFF} ôàéëîâ ðåñóðñà %s.", SCRIPT.name), "done", true)
removeFilesCache("all")
reloadScript()
--
elseif #cmd == 0 then
createWindowHelp()
else
sendToChatMsg("Íåèçâåñòíàÿ êîìàíäà.", "error", true)
end
end)
lua_thread.create(timerPrison)
-- BODY [START]
while true do wait(0)
if TRINITYGTA then
hidePlayerNeeds() -- HIDE STANDART NEEDS
displayHud(false)
findTextDarwTime()
local spawnPlayer = sampIsLocalPlayerSpawned()
if spawnPlayer then
-- CHECK NEEDS
if not sampIsScoreboardOpen() then
createTime()
if not sampTextdrawIsExists(TABLE_TDW["INV"]) and not sampTextdrawIsExists(TABLE_TDW["CHIP"]) then
if (sampIsChatVisible() or DB[GET_SERVER]["VIEW_CHAT"]) then
createHUD() -- RENDER HUD
end
end
end
end
end
end
-- BODY [END]
wait(-1)
end
-- MAIN [END]
-- <FUNCTION> HUD [START]
function createHUD()
hudX, hudY = 560*pX, 0*pY
-- COLORS
local COLOR = {
["NEED"] ={
["EAT"] = '0xFFFFFFFF', -- WHITE
["WATER"] = '0xFFFFFFFF', -- WHITE
["HYGIENE"] = '0xFFFFFFFF', -- WHITE
},
["RED"] = '0xFFFF0000', -- RED
["GREEN"] = '0xFF63C10F', -- EAT
["YELLOW"] = '0xFFE3A51E', -- WATER
["BLUE"] = '0xFF3B79B3', -- HYGIENE
}
-- COLORS NEEDS
if getPlayerFood(TABLE_TDW["EAT"]) <= 22 then COLOR["GREEN"] = COLOR["RED"]; COLOR["NEED"]["EAT"] = COLOR["RED"] end
if getPlayerFood(TABLE_TDW["WATER"]) <= 22 then COLOR["YELLOW"] = COLOR["RED"]; COLOR["NEED"]["WATER"] = COLOR["RED"] end
if getPlayerFood(TABLE_TDW["HYGIENE"]) <= 22 then COLOR["BLUE"] = COLOR["RED"]; COLOR["NEED"]["HYGIENE"] = COLOR["RED"] end
-- SERVER PLAYER INFO
local playerID = select(2,sampGetPlayerIdByCharHandle(PLAYER_PED))
-- PLAYER INFO
-- WEAPON INFO [START]
local function getAmmoInClip()
local pointer = getCharPointer(PLAYER_PED)
local weapon = getCurrentCharWeapon(PLAYER_PED)
local slot = getWeapontypeSlot(weapon)
local cweapon = pointer + 0x5A0
local current_cweapon = cweapon + slot * 0x1C
return memory.getuint32(current_cweapon + 0x8)
end
local plWeaponID = getCurrentCharWeapon(PLAYER_PED)
local plWeaponAmmo = getAmmoInCharWeapon(PLAYER_PED, getCurrentCharWeapon(PLAYER_PED)) - getAmmoInClip()
-- WEAPON INFO [END]
-- TIME INFO [START]
local TIME = os.time(os.date("!*t"))
local TIME_MSK = TIME + 3 * 60 * 60
local timeFormate = os.date("%H:%M:%S", TIME_MSK)
local dateFormate = os.date("%d.%m.%y", TIME_MSK)
local dateDay = os.date("%A", TIME_MSK)
-- TIME INFO [END]
if DB[GET_SERVER]["VIEW"] then
-- HUD BODY [START]
renderDrawTexture(loadTexture["hud-bg" or dev_hud], sX - hudX, hudY, 512*pX, 256*pY, 0, 0xFFFFFFFF) -- BACKGROUND
-- HP
renderDrawTexture(loadTexture["hud-health"], sX - hudX + 222 *pX, hudY + 64 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(getCharHealth(PLAYER_PED), sX - hudX + 280 *pX, hudY + 68 *pY, FONTS["hud-16"], "center", 0xFFFFFFFF) -- TEXT
dxDrawRoundBox(sX-hudX + 316 *pX, hudY + (76 - 4) *pY, 176 *pX, 16 *pY, 0xFF0C0C17, "horizontal") -- BG
if getCharHealth(PLAYER_PED) ~= 0 then
dxDrawRoundBox(sX-hudX + 316 *pX, hudY + 76 *pY, getCharHealth(PLAYER_PED) * 1.76 *pX, 8 *pY, 0xFFFF3232, "horizontal") -- BAR
end
-- ARMOR
renderDrawTexture(loadTexture["hud-armor"], sX-hudX + 222 *pX, hudY + 102 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(getCharArmour(PLAYER_PED), sX - hudX + 280 *pX, hudY + 106 *pY, FONTS["hud-16"], "center", 0xFFFFFFFF) -- TEXT
dxDrawRoundBox(sX-hudX + 316 *pX, hudY + (114 - 4) *pY, 176 *pX, 16 *pY, 0xFF0C0C17, "horizontal") -- BG
if getCharArmour(PLAYER_PED) ~= 0 then
dxDrawRoundBox(sX-hudX + 316 *pX, hudY + 114 *pY, getCharArmour(PLAYER_PED) * 1.76 *pX, 8 *pY, 0xFFBDCCD4, "horizontal") -- BAR
end
-- HUD BODY [END]
-- HUD HEADER [START]
-- GREEN ZONE
if sampTextdrawIsExists(TABLE_TDW["GREEN_ZONE"]) then
gzX = 168 *pX
renderDrawTexture(loadTexture["green-zone"], sX-hudX + 256 *pX, hudY + 18 *pY, 256 *pX, 32 *pY, 0, 0xFFFFFFFF) -- GREEN ZONE
else gzX = 0 *pX end
-- ONLINE SERVER
renderDrawTexture(loadTexture["hud-bg-head"], sX-hudX - gzX + 448 *pX, hudY + 18 *pY, 64 *pX, 32 *pY, 0, 0xFFFFFFFF) -- BG
renderDrawTexture(loadTexture["hud-online"], sX-hudX - gzX + (448 + 8) *pX, hudY + 26 *pY, 16 *pX, 16 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(sampGetPlayerCount(false) - 24, sX-hudX - gzX + (448 + 42) *pX, hudY + 22 *pY, FONTS["hud-14"], "center", 0xFFFFFFFF) -- TEXT
-- ID
renderDrawTexture(loadTexture["hud-bg-head"], sX-hudX - gzX + 380 *pX, hudY + 18 *pY, 64 *pX, 32 *pY, 0, 0xFFFFFFFF) -- BG
renderDrawTexture(loadTexture["hud-id"], sX-hudX - gzX + (380 + 8) *pX, hudY + 26 *pY, 16 *pX, 16 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(playerID, sX-hudX - gzX + (380 + 42) *pX, hudY + 22 *pY, FONTS["hud-14"], "center", 0xFFFFFFFF) -- TEXT
-- TIME
renderDrawTexture(loadTexture["hud-bg-time"], sX-hudX - gzX + 248 *pX, hudY + 18 *pY, 128 *pX, 32 *pY, 0, 0xFFFFFFFF) -- BG
-- renderDrawTexture(loadTexture["hud-time"], sX - hudX - gzX + 248 + 48, hudY + 26, 16, 16, 0, 0xFFFFFFFF) -- ICON
dxDrawText(timeFormate, sX-hudX - gzX + (248 + 82) *pX, hudY + 18 *pY, FONTS["hud-14"], "center", 0xFFFFFFFF) -- TEXT
dxDrawText(dateFormate, sX-hudX - gzX + (248 + 82) *pX, hudY + 35 *pY, FONTS["hud-10"], "center", 0xAAFFFFFF) -- TEXT
-- CONVOY ZONE
if sampTextdrawIsExists(TABLE_TDW["CONVOY_ZONE"]) then
cnX = 166 *pX
renderDrawTexture(loadTexture["convoy-zone"], sX-hudX - gzX + 26 *pX, hudY + 18 *pY, 256 *pX, 32 *pY, 0, 0xFFFFFFFF) -- CONVOY ZONE
else cnX = 0 *pX end
-- SMUGGLE ZONE
if sampTextdrawIsExists(TABLE_TDW["SMUGGLE_ZONE"]) then
renderDrawTexture(loadTexture["smuggle-zone"], sX-hudX - gzX + 26 *pX, hudY + 18 *pY, 256 *pX, 32 *pY, 0, 0xFFFFFFFF) -- CONVOY ZONE
end
-- end
-- HUD HEADER [END]
-- HUD BOTTOM [START]
-- OXYGEN
renderDrawTexture(loadTexture["hud-oxygen"], sX-hudX + 222 *pX, hudY + 156 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawRoundBox(sX-hudX + 262 *pX, hudY + 164 *pY, 8 *pX, 18 *pY, 0xFF0C0C17, "vertical") -- BG
if math.floor(memory.getfloat(0xB7CDE0) / 39.9 / 5.5) ~= 0 then
dxDrawRoundBox(sX-hudX + (262 + 2) *pX, hudY + (164 + 18 - math.floor(memory.getfloat(0xB7CDE0) / 39.9 / 5.5)) *pY, 4 *pX, math.floor(memory.getfloat(0xB7CDE0) / 39.9 / 5.5) *pY, 0xFF3FA9F5, "vertical") -- BAR
end
-- NEED EAT
renderDrawTexture(loadTexture["hud-eat"], sX-hudX + 298 *pX, hudY + 156 *pY, 32 *pX, 32 *pX, 0, COLOR["NEED"]["EAT"]) -- ICON
dxDrawRoundBox(sX-hudX + 338 *pX, hudY + 164 *pY, 8 *pX, 18 *pY, 0xFF0C0C17, "vertical") -- BG
if getPlayerFood(TABLE_TDW["EAT"]) ~= 0 then
dxDrawRoundBox(sX-hudX + (338 + 2) *pX, hudY + (164 + 18 - math.floor(getPlayerFood(TABLE_TDW["EAT"]) / 5.88)) *pY, 4 *pX, math.floor(getPlayerFood(TABLE_TDW["EAT"]) / 5.88) *pY, COLOR["GREEN"], "vertical") -- BAR
end
-- NEED WATER
renderDrawTexture(loadTexture["hud-water"], sX-hudX + 374 *pX, hudY + 156 *pY, 32 *pX, 32 *pY, 0, COLOR["NEED"]["WATER"]) -- ICON
dxDrawRoundBox(sX-hudX + 414 *pX, hudY + 164 *pY, 8 *pX, 18 *pY, 0xFF0C0C17, "vertical") -- BG
if getPlayerFood(TABLE_TDW["WATER"]) ~= 0 then
dxDrawRoundBox(sX-hudX + (414 + 2) *pX, hudY + (164 + 18 - math.floor(getPlayerFood(TABLE_TDW["WATER"]) / 5.88)) *pY, 4 *pX, math.floor(getPlayerFood(TABLE_TDW["WATER"]) / 5.88) *pY, COLOR["YELLOW"], "vertical") -- BAR
end
-- NEED HYGIENE
renderDrawTexture(loadTexture["hud-hygiene"], sX-hudX + 450 *pX, hudY + 156 *pY, 32 *pX, 32 *pY, 0, COLOR["NEED"]["HYGIENE"]) -- ICON
dxDrawRoundBox(sX-hudX + 490 *pX, hudY + 164 *pY, 8 *pX, 18 *pY, 0xFF0C0C17, "vertical") -- BG
if getPlayerFood(TABLE_TDW["HYGIENE"]) ~= 0 then
dxDrawRoundBox(sX-hudX + (490 + 2) *pX, hudY + (164 + 18 - math.floor(getPlayerFood(TABLE_TDW["HYGIENE"]) / 5.88)) *pY, 4 *pX, math.floor(getPlayerFood(TABLE_TDW["HYGIENE"]) / 5.88) *pY, COLOR["BLUE"], "vertical") -- BAR
end
-- HUD BOTTOM [END]
-- MONEY
renderDrawTexture(loadTexture["hud-money"], sX-hudX + 486 *pX, hudY + 206 *pY, 32 *pX, 32 *pY, 0, 0xAAFFFFFF) -- ICON
if getPlayerMoney() == 0 then
dxDrawText("Íà ðóêàõ íåò äåíåã", sX-hudX + 486 *pX, hudY + 209 *pY, FONTS["hud-16"], "right", 0x40FFFFFF) -- TEXT (MONEY)
else
dxDrawText(convertMoney(getPlayerMoney()), sX-hudX + 486 *pX, hudY + 205 *pY, FONTS["hud-22"], "right", 0xFFFFFFFF) -- TEXT (MONEY)
-- dxDrawText(convertMoney(100000000000), sX-hudX + 486 *pX, hudY + 205 *pY, FONTS["hud-22"], "right", 0xFFFFFFFF) -- TEXT (MONEY)
end
local wanted_us = false
local wanted_rc = false
local wanted_af = false
-- WANTED LEVEL [START]
if wanted.us > 0 then
wanted_us = true
renderDrawTexture(loadTexture["wanted-ls"], sX-hudX + 486 *pX, hudY + 242 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(wanted.us, sX-hudX + 486 *pX, hudY + 248 *pY, FONTS["hud-16"], "right", 0xFFFFFFFF) -- TEXT LS
end
if wanted.rc > 0 then
if not wanted_us then wntX = 0 else wntX = 64 end
wanted_rc = true
renderDrawTexture(loadTexture["wanted-lv"], sX-hudX + (486 - wntX) *pX, hudY + 242 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(wanted.rc, sX-hudX + (486 - wntX) *pX, hudY + 248 *pY, FONTS["hud-16"], "right", 0xFFFFFFFF) -- TEXT LV
end
if wanted.af > 0 then
if wanted_us or wanted_rc then
wntX = 64
if wanted_us and wanted_rc then wntX = 128 end
else
wntX = 0
end
wanted_af = true
renderDrawTexture(loadTexture["wanted-sf"], sX-hudX + (486 - wntX) *pX, hudY + 242 *pY, 32 *pX, 32 *pY, 0, 0xFFFFFFFF) -- ICON
dxDrawText(wanted.af, sX-hudX + (486 - wntX) *pX, hudY + 248 *pY, FONTS["hud-16"], "right", 0xFFFFFFFF) -- TEXT SF
end
-- WANTED LEVEL [END]
-- WEAPON [START]
renderDrawTexture(loadTexture["hud-bg-weapon"], sX - hudX + 80 *pX, hudY *pY, 128 *pX, 256 *pY, 0, 0xFFFFFFFF) -- BG WEAPON BLOCK
for _, weaponID in ipairs({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 46}) do
if getCurrentCharWeapon(PLAYER_PED) == weaponID then
renderDrawTexture(loadWeaponTexture["" .. getCurrentCharWeapon(PLAYER_PED) .. ""], sX - hudX + 98 *pX, hudY + 56 *pY, 128 *pX, 128 *pY, 0, 0xFFFFFFFF) -- ICON WEAPON
end
end
for _, weaponID in ipairs({16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}) do
if getCurrentCharWeapon(PLAYER_PED) == weaponID then
renderDrawTexture(loadWeaponTexture["" .. getCurrentCharWeapon(PLAYER_PED) .. ""], sX - hudX + 98 *pX, hudY + 36 *pY, 128 *pX, 128 *pY, 0, 0xFFFFFFFF) -- ICON WEAPON
renderDrawTexture(loadTexture["hud-ammo"], sX-hudX + 134 *pX, hudY + 166 *pY, 16 *pX, 16 *pY, 0, 0xAAFFFFFF) -- ICON AMMO
dxDrawText(getAmmoInClip(), sX-hudX + 164 *pX, hudY + 136 *pY, FONTS["hud-18"], "center", 0xFFFFFFFF) -- TEXT (CLIP)
if plWeaponAmmo > 10000 then plWeaponAmmo = "10ê+" end
dxDrawText(plWeaponAmmo, sX-hudX + 154 *pX, hudY + 162 *pY, FONTS["hud-16"], "left", 0xAAFFFFFF) -- TEXT (AMMO)
end
end
-- WEAPON [END]
end
end
-- HUD [END]
-- <FUNCTION> CREATE TIME [START]
function createTime()
local hudX, hudY = 560 *pX, 0 *pY
local gzX, gzY = -100 *pX, 0 *pY
-- TIME INFO [START]
local TIME = os.time(os.date("!*t"))
local TIME_MSK = TIME + 3 * 60 * 60
local timeFormate = os.date("%H:%M:%S", TIME_MSK)
local dateFormate = os.date("%d.%m.%y", TIME_MSK)
local dateDay = os.date("%A", TIME_MSK)
-- TIME INFO [END]
if DB[GET_SERVER]["VIEW_TIME"] and not DB[GET_SERVER]["VIEW"] or sampTextdrawIsExists(TABLE_TDW["INV"]) or sampTextdrawIsExists(TABLE_TDW["CHIP"]) then
renderDrawTexture(loadTexture["hud-bg-time"], sX-hudX - gzX + 248 *pX, hudY + 18 *pY, 128 *pX, 32 *pY, 0, 0xFFFFFFFF) -- BG
-- renderDrawTexture(loadTexture["hud-time"], sX - hudX - gzX + 248 + 48, hudY + 26, 16, 16, 0, 0xFFFFFFFF) -- ICON
dxDrawText(timeFormate, sX-hudX - gzX + (248 + 82) *pX, hudY + 18 *pY, FONTS["hud-14"], "center", 0xFFFFFFFF) -- TEXT
dxDrawText(dateFormate, sX-hudX - gzX + (248 + 82) *pX, hudY + 35 *pY, FONTS["hud-10"], "center", 0xAAFFFFFF) -- TEXT
end
end
-- <FUNCTION> CREATE TIME [END]
-- <FUNCTION> PLAYER NEEDS [START]
function hidePlayerNeeds()
if not sampTextdrawIsExists(TABLE_TDW["INV"]) then
for key, val in pairs(TABLE_TDW["OTHER"]) do
if sampTextdrawIsExists(val) then
sampTextdrawDelete(val)
end
end
if TABLE_TDW["EAT"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["EAT"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["EAT"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["EAT"], -20, -20)
end
end
end
if TABLE_TDW["WATER"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["WATER"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["WATER"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["WATER"], -20, -20)
end
end
end
if TABLE_TDW["HYGIENE"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["HYGIENE"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["HYGIENE"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["HYGIENE"], -20, -20)
end
end
end
if TABLE_TDW["GREEN_ZONE"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["GREEN_ZONE"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["GREEN_ZONE"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["GREEN_ZONE"], -20, -20)
end
end
end
if TABLE_TDW["CONVOY_ZONE"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["CONVOY_ZONE"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["CONVOY_ZONE"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["CONVOY_ZONE"], -20, -20)
end
end
end
if TABLE_TDW["SMUGGLE_ZONE"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["SMUGGLE_ZONE"]) then
local posX, posY = sampTextdrawGetPos(TABLE_TDW["SMUGGLE_ZONE"])
if posX ~= -20 and posY ~= -20 then
sampTextdrawSetPos(TABLE_TDW["SMUGGLE_ZONE"], -20, -20)
end
end
end
if TABLE_TDW["TIME"] ~= -1 then
if sampTextdrawIsExists(TABLE_TDW["TIME"]) then
sampTextdrawDelete(TABLE_TDW["TIME"])
sampTextdrawDelete(TABLE_TDW["DATE"])
end
end
end
end
-- PLAYER NEEDS [END]
-- <FUNCTION> Money Formate
function convertMoney(number)
local text = number
while true do
text, k = string.gsub(text, "^(-?%d+)(%d%d%d)", '%1 %2')
if (k == 0) then
break
end
end
return text
end
-- <FUNCTION> Find Textdraw Time
function findTextDarwTime()
for i = 1, 3000 do
letSizeX, letSizeY, _ = sampTextdrawGetLetterSizeAndColor(i)
outline, ocolor = sampTextdrawGetOutlineColor(i)
style = sampTextdrawGetStyle(i)
text = sampTextdrawGetString(i)
prop = sampTextdrawGetProportional(i)
letSizeY = math.floor(letSizeY)
if letSizeX == 0.5 and letSizeY == 2 and outline == 1 and style == 2 and text:match("%d+:%d%d") and prop == 1 then
TABLE_TDW["TIME"] = i
TABLE_TDW["DATE"] = i + 1
return
end
end
end
-- <FUNCTION> Player Needs
function getPlayerFood(id)
if TRINITYGTA then
if id ~= -1 then
if sampTextdrawIsExists(id) then
local box, color, sizeX, sizeY = sampTextdrawGetBoxEnabledColorAndSize(id)
return sizeX
end
end
end
return 0
end
function getPlayerWater(id)
if TRINITYGTA then
if id ~= -1 then
if sampTextdrawIsExists(id) then
local box, color, sizeX, sizeY = sampTextdrawGetBoxEnabledColorAndSize(id)
return sizeX
end
end
end
return 0
end
function getPlayerHygiene(id)
if TRINITYGTA then
if id ~= -1 then
if sampTextdrawIsExists(id) then
local box, color, sizeX, sizeY = sampTextdrawGetBoxEnabledColorAndSize(id)
return sizeX
end
end
end
return 0
end
function search(str, tab)
if str ~= nil then
for key, val in pairs(tab) do
if str == val then
return true
end
end
end
return false
end
local wanted_reason = {
{"Àãåíò {ffffff}%a+_%a+{6495ED} ñíÿë âàì ðîçûñê."},
{"Àãåíò {ffffff}%a+_%a+{6495ED} ñíÿëà âàì ðîçûñê."},
{"Âàø óðîâåíü ðîçûñêà â {FF8282}%u%u{ffffff} ñíèçèëñÿ."},
{"Âàø óðîâåíü ðîçûñêà â {FF8282}%u%u{ffffff} ñíèçèëñÿ. Âû áîëüøå íå ðàçûñêèâàåòåñü â ýòîì ãîñóäàðñòâå."},
{"Òþðåìùèê:{ffffff} Âñ¸, òû ñâîáîäåí. Íàäåþñü áîëüøå íå âèäåòü òåáÿ."},
}
local wanted_unreason = {
{"Âû ïîãèáëè ïðè çàäåðæàíèè îò ðóêè ñîòðóäíèêà RC FBI ïî èìåíè {abcdef}%a+_%a+{ffffff}."},
{"Òþðåìùèê:{ffffff} Äîáðî ïîæàëîâàòü â òþðüìó {D8A903}Àëüêàòðàñ{ffffff}"},
{"Òþðåìùèê:{ffffff} Ñ âîçâðàùåíèåì â òþðüìó {D8A903}Àëüêàòðàñ{ffffff}"},
{"Òþðåìùèê:{ffffff} Âû ïðîâåäåòå â èçîëÿòîðå ýòîãî ïîëèöåéñêîãî ó÷àñòêà"},
{"Àãåíò {ffffff}%a+_%a+{6495ED} âûïóñòèë âàñ íà ñâîáîäó."},
{"Àãåíò {ffffff}%a+_%a+{6495ED} âûïóñòèëà âàñ íà ñâîáîäó."},
}
local jailtime = {
["reason"] = {
"Îñòàòîê ñðîêà âàøåãî çàêëþ÷åíèÿ â äåïàðòàìåíòå ïîëèöèè %a+ %a+ ñîñòàâëÿåò {D8A903}",
"Îñòàòîê ñðîêà âàøåãî çàêëþ÷åíèÿ â òþðüìå «Àëüêàòðàñ» ñîñòàâëÿåò {D8A903}",
"Eweest_Rigz ñêàçàë: Îñòàòîê ñðîêà âàøåãî çàêëþ÷åíèÿ â òþðüìå «Àëüêàòðàñ» ñîñòàâëÿåò ",
},
["jail"] = {
"Òþðåìùèê:{ffffff} Âû ïðîâåäåòå â èçîëÿòîðå ýòîãî ïîëèöåéñêîãî ó÷àñòêà ",
"Òþðåìùèê:{ffffff} Äîáðî ïîæàëîâàòü â òþðüìó {D8A903}Àëüêàòðàñ{ffffff}, âû ïðîâåäåòå ó íàñ ",
}
}
-- <FUNCTION> Jail Timer
function timerPrison()
while true do wait(0)
local timeFormate = os.date("%H:%M:%S", jailTimerEnd - os.time())
if DB[GET_SERVER]["VIEW"] then
if jailTimerEnd ~= -1 and jailTimerState then
renderDrawTexture(loadTexture["jailtime"], sX-hudX + 26 *pX, hudY + 18 *pY, 256 *pX, 32 *pY, 0, 0xFFFFFFFF) -- CONVOY ZONE
dxDrawText(timeFormate, sX-hudX - 0 + (136 + 82) *pX, hudY + 22 *pY, FONTS["hud-16"], "center", 0xFFFFFFFF) -- TEXT
end
if timeFormate == "00:00:00" then
jailTimerState = false
jailTimerEnd = -1
end
end
end
end
-- <FUNCTION sampev> onServerMessage
function sampev.onServerMessage(color, text)
-- JAIL TIMER
for _, reason in ipairs(jailtime["reason"]) do
if text:find(reason) then
local timeZone = 86400 - os.date("%H", 0) * 3600
if text:match(reason .. "(%d+) ÷. (%d+) ìèí. (%d+) ñåê.") then
local hour, min, sec = text:match(reason .. "(%d+) ÷. (%d+) ìèí. (%d+) ñåê.")
jailTimerEnd = os.time() + (timeZone + hour * 3600 + min * 60 + sec)
jailTimerState = true
return false
end
if text:match(reason .. "(%d+) ìèí. (%d+) ñåê.") then
local min, sec = text:match(reason .. "(%d+) ìèí. (%d+) ñåê.")
jailTimerEnd = os.time() + (timeZone + min * 60 + sec)
jailTimerState = true
return false
end
if text:match(reason .. "(%d+) ñåê.") then
local sec = text:match(reason .. "(%d+) ñåê.")
jailTimerEnd = os.time() + (timeZone + sec)
jailTimerState = true
return false
end
end
end
for _, reason in ipairs(jailtime["jail"]) do
if text:find(reason) then
jailTimerState = true
sampSendChat("/jailtime")
end
end
if text:find("Âû íå îòáûâàåòå íàêàçàíèå â òþðüìå.") then
jailTimerState = false
return false
end
-- CHECK WANTED LEVEL
if text:find("Ñ âîçâðàùåíèåì, âû óñïåøíî âîøëè â ñâîé àêêàóíò.") then
lua_thread.create(function()
wait(10000)
sampSendChat("/wlow")
wait(100)
sampSendChat("/jailtime")
end)
return true
end
for _, reason in ipairs(wanted_reason) do
if text:find(reason[1]) then
lua_thread.create(function()
wait(2000)
sampSendChat("/wlow")
end)
return true
end
end
for _, unreason in ipairs(wanted_unreason) do
if text:find(unreason[1]) then
wanted.us, wanted.rc, wanted.af = 0, 0, 0
return true
end
end
if text:find("Âû íå ðàçûñêèâàåòåñü íè â îäíîì èç ãîñóäàðñòâ.") then
wanted.us, wanted.rc, wanted.af = 0, 0, 0
return false
end
if text:find("Âàø òåêóùèé óðîâåíü ðîçûñêà â %u%u ñîñòàâëÿåò %d+ .+") then
wanted.city = text:match("%u%u")
if wanted.city == "US" then wanted.us = tonumber(text:match("%d+")) end
if wanted.city == "RC" then wanted.rc = tonumber(text:match("%d+")) end
if wanted.city == "AF" then wanted.af = tonumber(text:match("%d+")) end
end
end
-- <FUNCTION sampev> onShowDialog
function sampev.onShowDialog(id, style, title, btn1, btn2, text)
if id == 45 and title:find("Èíôîðìàöèÿ î âàøåì ðîçûñêå, âñåãî %d+") then
for city in text:gmatch("(%u%u) %- %d+") do
if city == "US" then wanted.us = tonumber(text:match("US %- (%d+)")) end
if city == "RC" then wanted.rc = tonumber(text:match("RC %- (%d+)")) end
if city == "AF" then wanted.af = tonumber(text:match("AF %- (%d+)")) end
if not text:find("US") then wanted.us = 0 end
if not text:find("RC") then wanted.rc = 0 end
if not text:find("AF") then wanted.af = 0 end
end
sampSendDialogResponse(id, 0, nil, nil)
return false
end
end
-- <FUNCTION sampev> onShowTextDraw
function sampev.onShowTextDraw(id, data)
if data.text:find("A
HEHAP") then
TABLE_TDW["INV"] = id
end
if data.text:find("
K
") then
TABLE_TDW["CHIP"] = id
end
-- FIND EAT BAR
if data.letterColor == -14500865 or data.letterColor == -14518409 then
TABLE_TDW["WATER"] = id
end
-- FIND WATER BAR
if data.letterColor == -15744669 or data.letterColor == -13399996 then
TABLE_TDW["EAT"] = id
end
-- FIND HYGIENE BAR
if data.letterColor == -3372988 then
TABLE_TDW["HYGIENE"] = id
end
-- FIND BLACK BACKGROUND BAR
if data.letterColor == -16777216 then
if not search(id, TABLE_TDW["OTHER"]) then
table.insert(TABLE_TDW["OTHER"], id)
end
end
-- GREEN ZONE
if data.text:find("green zone") then
TABLE_TDW["GREEN_ZONE"] = id
end
-- CONVOY ZONE
if data.text:find("convoy zone") then
TABLE_TDW["CONVOY_ZONE"] = id
end
-- SMUGGLE ZONE
if data.text:find("smuggle zone") then
TABLE_TDW["SMUGGLE_ZONE"] = id
end
end
-- HELP WINDOW [START]
local TITLE = "Ïîìîùü ïî: {FFFFFF}"
local TITLE_COLOR = "{AFE7FF}"
local TEXT = [[
{ffcc00}Îñíîâíûå êîìàíäû:{ffffff}
{AFE7FF}/hud{ffffff} - Îêíî ïîìîùè
{AFE7FF}/hud view (vw){ffffff} - Ïîêàçàòü/Ñêðûòü
{AFE7FF}/hud chat{ffffff} - Ïîêàçàòü/Ñêðûòü ïðè ñêðûòîì ÷àòå
{AFE7FF}/hud time{ffffff} - Ïîêàç âðåìåíè ïðè ñêðûòîì HUD
{AFE7FF}/hud reset{ffffff} - Ñáðîñ âñåõ íàñòðîåê
{AFE7FF}/hud resetall{ffffff} - Óäàëåíèå âñåõ ôàéëîâ êåøà
{AFE7FF}/hud (up)date{ffffff} - Àâòîîáíîâëåíèå (Âêëþ÷èòü/Âûêëþ÷èòü)
{ffcc00}Ïîëåçíûå ñîâåòû:{ffffff}
{AFE7FF}[1]{ffffff} Åñëè âñå ïîòðåáíîñòè ïîêàçûâàþò "0" è {FF3232}ãîðÿò êðàñíûì{ffffff}, îòêðîéòå è çàêðîéòå èíâåíòàðü.
{AFE7FF}[2]{ffffff} Äëÿ êîððåêòíîé ðàáîòû ïîòðåáíîñòåé â HUD, âêëþ÷èòå ñåðâåðíûå ïîòðåáíîñòè.
{F5DEB3}/mm 3{FFFFFF} > {F5DEB3}Óðîâíè ãîëîäà, æàæäû è ãèãèåíû{FFFFFF} > {F5DEB3}Îòîáðàæàòü {32FF32}[Äà]{FFFFFF}
{ffcc00}Î ñêðèïòå:{ffffff}
]]
if DB["AUTOUPDATE"] == true then autoupdate_state = "{32FF32}Âêëþ÷åíî" else autoupdate_state = "{FF3232}Îòêëþ÷åíî" end
local ABOUT = {
{"{AFE7FF}Àâòîð ñêðèïòà", unpack(SCRIPT.authors)},
{"{AFE7FF}Íàçâàíèå ñêðèïòà (Âåðñèÿ)", SCRIPT.name .. "{AFE7FF} ( " .. SCRIPT.version .. " )"},
{"{AFE7FF}Íàøå ñîîáùåñòâî", SCRIPT.url},
{"{AFE7FF}Äàòà ïîñëåäíåãî îáíîâëåíèÿ", SCRIPT.description},
{"{AFE7FF}Àâòîîáíîâëåíèå", autoupdate_state},
}
local function info(num)
local element = table.concat(ABOUT[num], ":{ffffff} ")
return element
end
--
function createWindowHelp()
sampShowDialog(10001, TITLE_COLOR .. TITLE .. thisScript().name, string.format("%s%s\n%s\n%s\n%s\n%s", TEXT, info(1), info(2), info(3), info(4), info(5)), "X")
end
-- HELP WINDOW [END]
-- ASSETS TOOLS
-- <FUNCTION> Send Message to Chat
function sendToChatMsg(text, typeMsg, sound)
if sound then sound_id = CHAT_MSG[typeMsg].sound_id else sound_id = 0 end
sampAddChatMessage(string.format("[%s]: {%s}%s", CHAT_MSG["TAG"], CHAT_MSG[typeMsg].colorText, text), CHAT_MSG[typeMsg].color)
addOneOffSound(0.0, 0.0, 0.0, sound_id)
end
-- <FUNCTION> Render Text
function dxDrawText(text, x, y, font, align, color)
if not align or align == "left" then renderFontDrawText(font, text, x, y, color) end
if align == "right" then renderFontDrawText(font, text, x - renderGetFontDrawTextLength(font, text), y, color) end
if align == "center" then renderFontDrawText(font, text, x - renderGetFontDrawTextLength(font, text) / 2, y, color) end
end
-- <FUNCTION> Render Box Rounded
function dxDrawRoundBox(x, y, x1, y1, color, type)
renderDrawBox(x, y, x1, y1, color) -- BG BAR
if not type or type == "horizontal" then
renderDrawTexture(loadTexture["round"], x - (y1/2), y, y1, y1, 0, color)
renderDrawTexture(loadTexture["round"], x + x1 - (y1/2), y, y1, y1, 180, color)
end
if type == "vertical" then
renderDrawTexture(loadTexture["round"], x, y - (x1/2), x1, x1, 90, color)
renderDrawTexture(loadTexture["round"], x, y + y1 - (x1/2), x1, x1, 270, color)
end
end
-- <FUNCTION> SAVE SETTINGS
function saveSetting()
local settingFile = io.open(MAIN_PATH .. FOLDER_PATH .. CONFIG_PATH .. SETTINGS_PATH, "w")
settingFile:write(encodeJson(DB))
settingFile:flush()
print("Ôàéë {FFFFFF}'" .. SETTINGS_PATH .. "'{CCCCCC} óñïåøíî ñîõðàíåí!")
settingFile:close()
end
-- <FUNCTION> RELOAD SCRIPT
function reloadScript()
lua_thread.create(function()
sendToChatMsg(string.format("×åðåç 5 ñåêíóäû ïðîèçîéäåò ïåðåçàïóñê ñêðèïòà %s.", SCRIPT.name), "warning")
wait(5000) SCRIPT:reload()
end)
end
-- <FUNCTION> UNLOAD SCRIPT
function unloadScript()
lua_thread.create(function()
SCRIPT:unload()
end)
end
-- <FUNCTION> DELETE FILES CACHE
function removeFilesCache(type)
if not type then print("Íå óêàçàí òèï ÷èñòêè ôàéëîâ") end
if type == "all" then
for _, NAME in pairs(TEXTURES) do
os.remove(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. NAME[1]) -- DEL FILES
if not doesFileExist(MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH .. NAME[1]) then
print(string.format("Ôàéë ïî ïóòè: {FFFFFF}%s{FF3232}%s{CCCCCC} óñïåøíî óäàëåí.", MAIN_PATH .. FOLDER_PATH .. TEXTURES_PATH, NAME[1]))
end