-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMAIN.bat
1091 lines (1055 loc) · 42.6 KB
/
MAIN.bat
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
REM Yes I understand this program is free, free to copy and all.
REM I hope you (as an awesome person) can keep my name on the product for it ^.^
REM Feel free to make any modifications and submit them to me!! I'd love to credit you for helping out in the patch notes! And in the program! :)
REM My project resources are at https://github.com/alexlyee/Unturned-Server-Manager
@echo off
cls
echo.
echo // Requesting admin...
REM Get admin \/
IF '%PROCESSOR_ARCHITECTURE%' EQU 'amd64' (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\icacls.exe" "%SYSTEMROOT%\SysWOW64\config"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\icacls.exe" "%SYSTEMROOT%\system32\config"
)
if '%errorlevel%' NEQ '0' ( goto UACPrompt ) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 3 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
echo.
echo // // Intilizing...
REM Start Section \/
REM 1#.2#.3# - 1> Major changes, you need to reinstall.
REM 2> Significant changes, need to redo filesystem.
REM 3> Minor changes, nothing needed.
set VMajor=3
set VMiddle=0
set VMinor=1
set V=%VMajor%.%VMiddle%.%VMinor%
title Untured Server Manager! V%V%
setlocal EnableDelayedExpansion EnableExtensions
REM Get Time \/
echo.
echo // Catching time...
For /F "tokens=1,2,3,4 delims=:,. " %%A in ('echo %time%') do (
set "Hour24=%%A"
set "Min=%%B"
set "Sec=%%C"
set "MSec=%%D"
)
For /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do (
Set "DayW=%%A"
Set "Day=%%B"
Set "Month=%%C"
Set "Year=%%D"
)
set "Hour12=%Hour24%"
if %Hour12% geq 12 (
set AMPM=PM
set /a "Hour12-=12"
) else set "AMPM=AM"
if /I {%Hour12%}=={0} (set "Hour12=12")
REM testing area...
rem set "dev=true"
if /I not {%dev%}=={true} goto :skipDevTest
echo .. Dev testing area pause.
pause>nul'
:skipDevTest
REM end testing area...
REM Synchronization with MAIN.bat. \/ -- new with 3.0!
set NAMEe=%~n0
echo.
echo // Checking name for possible problems...
if /I {%NAMEe%}=={MAIN} (
echo Please copy and rename this app [MAIN] to something for your server. Such as: ManagedServer
ping 192.0.2.2 -n 1 -w 1000 > nul
goto :exit
)
if /I {%NAMEe%}=={update} (
echo Please copy and rename this app [update] to something for your server. Such as: ManagedServer
ping 192.0.2.2 -n 1 -w 1000 > nul
goto :exit
)
echo.
echo // Looking for local update.
if NOT EXIST MAIN.bat (
echo .. Oops^! This program can't run without MAIN.bat, please download it and move it to this folder.
ping 192.0.2.2 -n 1 -w 1000 > nul
goto :exit
)
echo .. Dev mode check...
REM Dev mode check
set devmode=false
if exist "%CD%\%NAMEe%.key" (set "devmode=true")
if /I {%devmode%}=={true} (
echo .. Developer mode enabled. This may be due to a failed start.
echo .. Program will continue in 4 seconds...
ping 192.0.2.2 -n 1 -w 4000 > nul
@echo on
)
REM STARTUP KEY HERE
echo. >"%CD%\%NAMEe%.key"
REM STARTUP KEY HERE
fc /b MAIN.bat %NAMEe%.bat > nul
if errorlevel 1 (
goto :MAINSync
) else (
echo .. Yep^!
)
REM Update Checker. \/
echo.
echo // Searching for git install...
WHERE git >Nul
IF %ERRORLEVEL% NEQ 0 goto :InstallGIT
echo.
echo // Looking for program update online...
>nul git init
>nul git remote add master https://github.com/alexlyee/Unturned-Server-Manager
for /f %%a in ('git pull --allow-unrelated-histories -f https://github.com/alexlyee/Unturned-Server-Manager master ^| findstr "Updating"') do set update=%%a
if /I NOT {%update%}=={} (goto :UpdateProgram)
echo .. All updated^!
echo.
echo // Reading filesystem for updates...
REM File need update? \/
set /p Vfile=<"%CD%\%NAMEe%_res\V.txt"
for /f "tokens=1,2,3 delims=." %%A in ("%Vfile%") do (set "VfileMajor=%%A" & set "VfileMiddle=%%B" & set "VfileMinor=%%C")
if not "%VfileMajor%"=="%VMajor%" (set "MajorUpdate=true")
if not "%VfileMiddle%"=="%VMiddle%" (set "MiddleUpdate=true")
if not "%VfileMinor%"=="%VMinor%" (set "MinorUpdate=true")
REM START \/
:start
echo.
echo // // // Starting...
REM Capturing starting time.
set t0=%time: =0%
echo.
echo // Searching for Unturned...
REM Ensure Unturned isn't running \/
set count=0
goto :findtask
:locatedtask
del search.txt
set /a count=%count% + 1
if NOT %count%==1 (goto :locatedtaskskip)
echo.
echo Unturned is running currently.
echo 1 // All unturned tasks will be shutdown forcefully.
echo Otherwise, it will return to the start and reprocess.
echo.
set /p "choice= - "
if /I NOT {%choice%}=={1} (goto :start)
:locatedtaskskip
echo Unturned task found^! Try %count%
taskkill /IM Unturned.exe /F
:findtask
tasklist /FI "IMAGENAME eq Unturned.exe" /FO CSV > search.txt
ping 192.0.2.2 -n 1 -w 10 > nul
for %%A in (search.txt) do (
if /I NOT {%%~zA}=={64} (
goto :locatedtask
)
)
if %count%==0 (
echo .. No Unturned Tasks Found!
) else (
echo .. No More Unturned Tasks Found!
)
del search.txt
echo.
echo // Are directories ready for the program?
REM Detect if files need refresh... \/
if NOT EXIST "%CD%\%NAMEe%_res\V.txt" (
echo.
echo Building program filesystem... [Filesystem not done]
echo ...... This will compile the necessary files in this current directory for the program to function.
echo.
set "build=true"
goto :build
)
echo .. Yep
REM Analyze auto... \/
echo.
echo // Finding set automations...
set autocount=0
for /F "delims=" %%A in ('dir /b "%CD%\%NAMEe%_res\auto"') do (
set /a "autocount=!autocount! + 1"
set "auto!autocount!=%%A"
for /F "tokens=1 delims=." %%B in ('dir /b "%CD%\%NAMEe%_res\auto\%%A"') do (
set "auto!autocount!.type=%%B"
)
)
REM Analyze plugins... \/
echo.
echo // Finding set plugins...
if EXIST "%CD%\%NAMEe%_res\plugins\plugins.txt" (
set /p plugins=<"%CD%\%NAMEe%_res\plugins\plugins.txt"
if /I {!plugins!}=={} (del "%CD%\%NAMEe%_res\plugins\plugins.txt")
)
set count=0
if EXIST "%CD%\%NAMEe%_res\plugins\plugins.txt" (
for /F "usebackq tokens=*" %%A in ("%CD%\%NAMEe%_res\plugins\plugins.txt") do (
set /a "count=!count! + 1"
set "plugincount=!count!"
set "plugin!count!=%%A"
)
)
if NOT EXIST "%CD%\%NAMEe%_res\plugins\plugins.txt" (set plugincount=0)
echo.
echo // Is the system up-to-date^?
REM Detect if files need refresh... \/
if /I {%MajorUpdate%}=={true} (
echo.
echo Building program filesystem... [Updating] [Major Update]
echo ...... This will compile the necessary files in this current directory for the program to function.
echo.
goto :build
)
if /I {%MiddleUpdate%}=={true} (
echo.
echo Building program filesystem... [Updating]
echo ...... This will compile the necessary files in this current directory for the program to function.
echo.
goto :build
)
if /I {%MinorUpdate%}=={true} (
del /Q "%CD%\%NAMEe%_res\V.txt"
echo %V%>"%CD%\%NAMEe%_res\V.txt"
)
set /p Dfile=<"%CD%\%NAMEe%_res\Directory.txt"
if /I NOT "%Dfile%"=="%~dp0" (
echo.
echo Building program filesystem... [Change in directory]
echo ...... This will compile the necessary files in this current directory for the program to function.
echo.
goto :build
)
echo .. Yep
echo.
echo // Applying variables...
set /p serverusername=<"%CD%\%NAMEe%_res\username.txt"
set /p serverpassword=<"%CD%\%NAMEe%_res\password.txt"
echo.
echo // Checking for SteamCMD...
REM Install steamcmd if needed. \/
if not {%SteamCMD%}=={true} (if EXIST "%CD%\steamcmd\steamcmd.exe" (goto :SkipSteamCMD))
REM This will install and manage SteamCMD, which grabs updates for your game without the Steam client.
cls
echo.
echo The program will now // Install SteamCMD.
echo ...... This will install and manage SteamCMD, which grabs updates for your game without the Steam client.
echo.
echo Press any key to continue.
pause>nul
:FixSteamCMD
echo.
echo Downloading SteamCMD...
cscript //nologo "%CD%\%NAMEe%_res\steamcmd.vbs"
echo.
echo Extracting SteamCMD...
cscript //nologo "%CD%\%NAMEe%_res\extract.vbs"
echo.
echo Deleting download...
>NUL del /f /q "%CD%\%NAMEe%_res\downloads\current.zip"
echo.
echo Moving SteamCMD to "%CD%\steamcmd"
mkdir "%CD%\steamcmd"
>nul robocopy /move /e "%CD%\%NAMEe%_res\unzipped\current" "%CD%\steamcmd"
echo.
echo Building SteamCMD filesystem...
echo // To view progress, open the "Building SteamCMD filesystem..." window.
>NUL start "Building SteamCMD filesystem..." /WAIT /MIN /HIGH "%CD%\steamcmd\steamcmd.exe" +exit
goto :SkipSteamLoginBroke
:SteamLoginBroke
echo.
echo I've opened up the error file, take a look. Close when you're done.
notepad "%CD%\temp.txt"
echo I've noticed the most simple error is steam gaurd.
echo // Enter 1 if you want me to take you to the page to disable it!
echo // Enter 2 if you want to reset your username and password!
echo // Enter anything else to continue.
set "choice="
set /P "choice= - "
if /I {%choice%}=={1} (start "" https://store.steampowered.com/twofactor/manage)
if /I {%choice%}=={2} (goto :ResetSteamAccount)
goto :SkipResetSteamAccount
:ResetSteamAccount
echo.
echo If you haven't yet, you may want to make a SEPERATE steam account for the server.
echo Use an email you would want to check for info on your server.
echo You will need to have one, make sure it has Unturned.
echo.
set /p "username= Enter your Steam username: "
set /p "password= Enter your Steam password: "
echo.
echo Applying...
goto :SkipBuildPlugins
:SkipResetSteamAccount
del /Q "%CD%\temp.txt"
echo Sending you back to the login process...
:SkipSteamLoginBroke
echo.
echo Logging you in for the first time...
echo // If it doesn't log you in right away:
echo // Try to complete logging in, then enter "logout"
echo // If you can login without entering anything but "login %serverusername% %serverpassword%", you're golden.
echo.
:RetrySteamCMD
>NUL start "" /WAIT /MIN "%CD%\steamcmd\steamcmd.exe" +login %serverusername% %serverpassword%
echo.
echo If that did not work, type N.
set "choice="
set /P "choice= - "
if /I {%choice%}=={N} (goto :RetrySteamCMD)
set "SteamCMD="
if exist "%CD%\%NAMEe%.key" (
del /F /Q "%CD%\%NAMEe%.key"
echo .. Deleted startup key.
)
goto :start
:SkipSteamCMD
echo.
echo // Attempting Steam Login...
>"%CD%\temp.txt" call "%CD%\steamcmd\steamcmd.exe" +login %serverusername% %serverpassword% +info +quit
for /f "skip=2 tokens=1,2,3" %%A in ('find "Email: " temp.txt') do (echo %%B>"%CD%\%NAMEe%_res\email.txt")
for /f "skip=2 tokens=1,2" %%A in ('find "SteamID: " temp.txt') do (echo %%B>"%CD%\%NAMEe%_res\steamid.txt")
if NOT EXIST "%CD%\%NAMEe%_res\email.txt" goto :SteamLoginBroke
if NOT EXIST "%CD%\%NAMEe%_res\steamid.txt" goto :SteamLoginBroke
del /Q "%CD%\temp.txt"
echo.
echo // Checking for Unturned...
if not {%Unturned%}=={true} (if EXIST "%CD%\unturned" (goto :LS_SkipUnturned))
:LS_UnturnedInstall
cls
echo.
echo The program will now // Deploy an Unturned server.
echo ...... This will use SteamCMD to download and install an unturned gamefile. Overwriting any current Unturned server.
echo ...... Ensure you are SUBSCRIBED to Unturned by logging in and pressing "Play".
echo.
echo Press any key to continue.
pause>nul
REM This will use SteamCMD to download and install an unturned gamefile. Overwriting any current Unturned server.
echo.
echo Installing Unturned through SteamCMD...
echo // To view progress, open the "Installing Unturned through SteamCMD..." window.
start "Installing Unturned through SteamCMD..." /WAIT /MIN /HIGH "%CD%\steamcmd\steamcmd.exe" +login %serverusername% %serverpassword% +force_install_dir ..\unturned\ +app_update 304930 +exit
echo.
echo Choose a type of server:
echo Is it a "lanserver", "secureserver", or "insecureserver"^?
echo.
set /p "servertype2= "
echo %servertype2%>"%CD%\%NAMEe%_res\server.txt"
mkdir "%CD%\unturned\Servers"
cls
echo.
echo Use command shutdown once done loading.
echo // Type the command "shutdown" into the server once it is done loading for the first time.
start "Use command shutdown once done loading." /D "%CD%\unturned" /MAX /HIGH /WAIT "%CD%\unturned\Unturned.exe" -nographics -batchmode +%servertype2%/%NAMEe%
REM setup server!
set "Unturned="
if exist "%CD%\%NAMEe%.key" (
del /F /Q "%CD%\%NAMEe%.key"
echo .. Deleted startup key.
)
goto :start
:LS_SkipUnturned
REM Begin to use LS_ as the marker for before loadstart.
echo.
echo // Finishing loading...
set /p servertype=<"%CD%\%NAMEe%_res\server.txt"
set /p owneremail=<"%CD%\%NAMEe%_res\email.txt"
set /p ownersteamid=<"%CD%\%NAMEe%_res\steamid.txt"
if exist "%CD%\update.bat" (
del /F /Q "%CD%\update.bat"
echo .. Deleted update.bat
)
REM Processing time to initialize.
setlocal
set t=%time: =0%
set /a h=1%t0:~0,2%-100
set /a m=1%t0:~3,2%-100
set /a s=1%t0:~6,2%-100
set /a c=1%t0:~9,2%-100
set /a starttime = %h% * 360000 + %m% * 6000 + 100 * %s% + %c%
set /a h=1%t:~0,2%-100
set /a m=1%t:~3,2%-100
set /a s=1%t:~6,2%-100
set /a c=1%t:~9,2%-100
set /a endtime = %h% * 360000 + %m% * 6000 + 100 * %s% + %c%
set /a runtime = %endtime% - %starttime%
set runtime = %s%.%c%
REM converting to ms.
set /a runtime = %runtime% * 10
echo.
echo // Done^!
if /I {%devmode%}=={true} (
@echo off
echo Developer mode has been enabled. This may have been as a result of a failed start.
) else (cls)
if exist "%CD%\%NAMEe%.key" (
del /F /Q "%CD%\%NAMEe%.key"
echo .. Deleted startup key.
)
:skiploadstart
echo.
echo Unturned Server Manager V%V% // Made by Alex Lindstrom (steam~ alexlyee)
echo // took %runtime%ms to startup.
if /I {%servertype%}=={} (
echo Logged in to %owneremail% %ownersteamid%. Missing server type.
) else (
echo Logged in to %owneremail% %ownersteamid%. Hosting server type %servertype%
)
echo.
if EXIST "%CD%\%NAMEe%_res\Hide.txt" goto :SkipYMenuMessage
echo Make sure you don't click inside of this program; whenever you select anything in CMD,
echo it pauses the script^! Type Y to hide this message.
:SkipYMenuMessage
echo.
echo.
echo 1 // Extract the newest Rocket mod.
echo ...... This will download and apply the newest Rocket mod file to Unturned.
echo.
echo 2 // Extract set Rocket plugins.
echo ...... This will download and apply the newest Rocket plugins you've set. Or set the plugins.
echo.
echo 3 // Apply the latest Unturned update.
echo ...... This will download and update Unturned to it's newest form.
echo.
echo /\
echo \/
echo.
echo 4 // Help me host.
echo ...... This will help you in hosting Untured servers in any way possible.
echo.
echo 5 // Change settings.
echo ...... This will let you change things like your steam username and password that the server uses.
echo.
echo 6 // Start server.
echo ...... Starts the server.
echo.
echo 7 // Fix SteamCMD.
echo ...... Go through the SteamCMD initialization process once more.
echo.
echo 8 // Fix Unturned.
echo ...... Go through the Unturned installation process once more.
echo.
echo // Press enter to exit properly please.
echo.
echo 9 // Edit the automatic updater and/or server restart system. // NOT WORKING
echo ...... This will enable the program to keep your mods updated and your server running with them. :^)
echo.
echo.
set "choice="
set /p "choice= - 0 to enable/disable developer mode: "
if /I {%choice%}=={} (goto :exit)
if /I {%choice%}=={1} (goto :1)
if /I {%choice%}=={2} (goto :2)
if /I {%choice%}=={3} (goto :3)
if /I {%choice%}=={4} (goto :4)
if /I {%choice%}=={5} (goto :5)
if /I {%choice%}=={6} (goto :6)
if /I {%choice%}=={7} (goto :7)
if /I {%choice%}=={8} (goto :8)
if /I {%choice%}=={9} (goto :9)
if /I {%choice%}=={Y} (echo Hide) >"%CD%\%NAMEe%_res\Hide.txt"
goto :start
REM /////////////////////////////////////////////////////// functions below
:1
REM 100%!
REM This will download and apply the newest Rocket mod file to Unturned.
echo If you see errors. Then it did not download correctly.
echo.
echo Downloading the Rocket patch...
cscript //nologo "%CD%\%NAMEe%_res\rocket.vbs"
echo.
echo Unzipping the file...
cscript //nologo "%CD%\%NAMEe%_res\extract.vbs"
echo.
echo Deleting download...
del /f /q "%CD%\%NAMEe%_res\downloads\current.zip"
echo.
echo Applying Rocket to Unturned...
>nul robocopy /move /e "%CD%\%NAMEe%_res\unzipped\current" "%CD%\unturned"
echo.
echo Deleting unzipped folder...
>nul rmdir /S /Q "%CD%\%NAMEe%_res\unzipped\current"
echo.
pause
goto :start
:2
REM This will download and apply the newest Rocket plugins you've set. Or set the plugins.
if EXIST "%CD%\%NAMEe%_res\plugins\plugins.txt" (goto :2skip)
echo.
echo You may still have other plugins, this will only manage the one's you want for you.
echo You currently have no plugins to manage. If you would like to add some, type "Y".
echo.
set /P "choice= - "
if /I {%choice%}=={Y} (goto :21)
goto :start
:2skip
REM This will list all of the plugins.
echo.
echo Scanning plugin list...
echo.
echo Plugins: %plugincount%
for /l %%A in (1,1,%plugincount%) do (echo // Plugin %%A - !plugin%%A!)
echo.
echo You may still have other plugins, this will only manage the one's you want for you.
echo.
echo 1 - Change plugins to manage.
echo 2 - Update all plugins.
echo.
set /p "choice= "
if %choice%==1 (goto :21)
if %choice%==2 (goto :22)
goto :start
:21
REM This will relist all of the plugins
echo.
echo Here you can add all the plugins you want.
echo Enter them all seperated by ONLY a comma.
echo Go to the rocket plugins page, and find all of the plugins.
echo.
echo For EACH PLUGIN, look at the link, like:
echo "https://hub.rocketmod.net/product/plugins/PLUGINNAME/"
echo Enter the "PLUGINNAME" part of the link as the plugin only^! Otherwise this won't work^!
echo.
echo This will completely delete the list and them add them all back, so add all the plugins here!
echo If you want no plugins, type nothing.
echo.
set /p "plugins= "
if EXIST "%CD%\%NAMEe%_res\plugins\plugins.txt" (del "%CD%\%NAMEe%_res\plugins\plugins.txt")
set plugincount=0
for %%A in ("%plugins:,=" "%") do (
echo.
echo Adding %%A to memory...
set "plugintemp=%%A"
set "plugintemp=!plugintemp:"=!
set /a "plugincount=!plugincount! + 1"
set "plugin!plugincount!=!plugintemp!"
echo // Added !plugintemp!.
)
echo.
echo // Totaled %plugincount% plugin/s.
for /l %%A in (1,1,%plugincount%) do (
echo // Adding !plugin%%A! to plugin list... #%%A
if %%A==1 (
echo !plugin%%A!>"%CD%\%NAMEe%_res\plugins\plugins.txt"
)
if NOT %%A==1 (
echo !plugin%%A!>>"%CD%\%NAMEe%_res\plugins\plugins.txt"
)
)
set count=0
if %plugincount%==0 (goto :start)
echo.
echo // Forming download scripts for each plugin...
:21loop
set /a "count=%count% + 1"
for /l %%A in (1,1,%plugincount%) do (
if %%A==%count% (
set "tempplugin=!plugin%%A!"
)
)
echo.
echo // Developing download script for %tempplugin%... %count%/%plugincount%.
del /Q "%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs" >nul
echo strFileURL="https://hub.rocketmod.net/product/%tempplugin%/latest.zip">"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\downloads\current.zip">>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo End if>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
if NOT %count%==%plugincount% (goto :21loop)
:21loopend
echo.
echo Now that that's done, you can download the plugin/s.
echo If you would like to apply the plugins now, type "Y".
echo.
set /p "choice= "
if /I {%choice%}=={Y} (goto :22)
goto :start
:22
echo.
echo Scanning plugin list...
echo.
echo Plugins: %plugincount%
for /l %%A in (1,1,%plugincount%) do (
echo // Plugin %%A - !plugin%%A!
)
echo.
echo.
echo Installing plugins...
echo.
set count=0
:22loop
set /a "count=%count% + 1"
for /l %%A in (1,1,%plugincount%) do (
if %%A==%count% (
set "tempplugin=!plugin%%A!"
)
)
echo // Adding Plugin %count% - %tempplugin%
echo // Downloading package...
cscript //nologo "%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo // Extracting file...
cscript //nologo "%CD%\%NAMEe%_res\extract.vbs"
echo // Applying plugin...
>nul robocopy /move /e "%CD%\%NAMEe%_res\unzipped\current" "%CD%\unturned\Servers\%NAMEe%\Rocket\Plugins"
echo // Cleaning up remnence...
>nul rmdir /S /Q "%CD%\%NAMEe%_res\unzipped\current"
if NOT %count%==%plugincount% (goto :22loop)
:22loopend
echo.
echo Done.
echo Take note you should start the server up and make sure all of the plugins are still compatible :D
echo Press any key to let me know you read that.
pause>nul
goto :start
:3
REM 100%!
REM This will download and update Unturned to it's newest form.
echo.
echo Downloading and installing latest Unturned update.
echo // To view progress, open the "Downloading and installing latest Unturned update..." window.
>NUL start "Downloading and installing latest Unturned update..." /WAIT /MIN /HIGH "%CD%\steamcmd\steamcmd.exe" +login %serverusername% %serverpassword% +force_install_dir ..\Unturned +app_update 304930 +exit
exit
:4
REM 50%!
REM This will help you in hosting Untured servers in any way possible.
for /f "tokens=2 delims=: " %%A in (
'nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"'
) Do set ExternalIP=%%A
for /f "tokens=2 delims=:" %%a in ('ipconfig^|find "IPv4 Address"') do (set InternalIP=%%a)
for /f "tokens=2 delims=:" %%a in ('ipconfig^|find "Default Gateway"') do (set DefaultGateway=%%a)
echo.
echo Assuming this system is connected to a router, through a modem:
echo - Make sure you have port forwarded the ports around your server (ex. 27015-27017)
echo - Ensure your firewall is not blocking these, ports. Visit the advanced firewall control and open them up for all traffic.
echo - Start by checking if you can connect to your server locally before you share it!
echo - Do this by direct connecting to your server from another computer.
echo - You should create a static lease to this computer on your network.
echo - Although I've never found it useful, the DMZ zone may be of use if all else fails.
echo.
echo If you're still having issues:
echo - Check the modem, it is possible it is responsible for blocking traffic,
echo - you may want to simply connect this server directly to the modem.
echo - Check the files, commands.dat should have a port and bind command in there.
echo - If you can't connect from this computer, the problem is with this computer.
echo - If you can connect from this subnet, but not outside it, the problem is most likely with the router.
echo.
echo ExternalIP: %ExternalIP%
echo InternalIP: %InternalIP%
echo Default Gateway: %DefaultGateway%
echo.
pause
goto :start
:5
REM 100%!
REM This will let you change things like your steam username and password that the server uses.
echo.
echo 1 - Change steam username
echo 2 - Change steam password
echo 3 - Change server type
echo.
set "choice="
set /p "choice= - Pick: "
if /I {%choice%}=={} (goto :exit)
if /I {%choice%}=={1} (goto :51)
if /I {%choice%}=={2} (goto :52)
if /I {%choice%}=={3} (goto :53)
goto :start
:51
echo.
set /p "username= Enter your Steam username: "
echo.
echo Applying...
del "%CD%\%NAMEe%_res\username.txt">nul
echo !username!>"%CD%\%NAMEe%_res\username.txt"
goto :start
:52
echo.
set /p "password= Enter your Steam password: "
echo.
echo Applying...
del "%CD%\%NAMEe%_res\username.txt">nul
echo !password!>"%CD%\%NAMEe%_res\username.txt"
goto :start
:53
echo.
echo Is it a "lanserver", "secureserver", or "insecureserver"^?
echo.
set /p "servertype2= "
del "%CD%\%NAMEe%_res\server.txt">nul
echo %servertype2%>"%CD%\%NAMEe%_res\server.txt"
goto :start
:6
REM Starts the server.
goto :server
:7
REM Skips back to the Start of SteamCMD installation.
goto :FixSteamCMD
:8
REM Skips back to the start of Unturned installation.
echo.
goto :LS_UnturnedInstall
:9
REM This will enable the program to keep your mods updated and your server running with them.
echo.
echo Welcome to my automatic task scheduler^!
echo This will allow you to commit FUNCTIONS for ACTIVATORS.
echo In essence, this means you can customize something that will activate a function. That you can also modify.
echo Every activator and function are designed by me. But are made to be changed to your liking! :)
echo A function triggered by an activator is called a task.
echo.
echo It is a basic automator, I will expand on it in the future. The hard part is getting it working!
echo.
echo 1 // Create an activator
echo 2 // Create a function
echo 3 // Create a task
echo 4 // View, edit, and remove all
echo.
set "choice="
set /p "choice= - Enter option: "
if /I {%choice%}=={} (goto :start)
if /I {%choice%}=={1} (goto :81)
if /I {%choice%}=={2} (goto :82)
if /I {%choice%}=={3} (goto :83)
if /I {%choice%}=={4} (goto :84)
goto :start
:91
goto :start
:92
goto :start
:93
goto :start
:94
goto :start
REM sendemail function.
REM input to server function.
REM mobile mode. - designed for pop up use. make it fast, take all info on laptops battery.
REM allow for output of any variable through functions.
REM sendtext function.
REM this program can advertise.
REM onstartup server activations. and on exit.
REM all functions are activated through automation of tasks.
REM logging each line?
REM sifting each line. to variable.
REM self activated activator.
REM Start with activators, these are methods of initiating A function, it can be based on time, server start,
REM or a whole host of things!
REM Functions, are initiated by these activators, and make it automatic.
REM these functions are very customizable. But the limitations include:
REM - access to specific variables
REM - specific actions only; no creation of functions within functions.
REM - these functions commit actions, with one goal.
REM Together they are labeled, automations.
REM Showcase servers that advertise, let players play them instead of donating!
REM make a system for logging in through steam to use app.
REM also, you can choose to auto login (storing the password insecurely)
REM or you have to input it each time.
REM changing the steam account you are linked to (the one stored) will
:build
echo.
echo / Generating folders...
mkdir "%CD%\%NAMEe%_res\downloads">NUL
mkdir "%CD%\%NAMEe%_res\plugins">NUL
mkdir "%CD%\%NAMEe%_res\unzipped">NUL
mkdir "%CD%\%NAMEe%_res\updater">NUL
mkdir "%CD%\%NAMEe%_res\logs">NUL
mkdir "%CD%\%NAMEe%_res\auto">NUL
mkdir "%CD%\%NAMEe%_res\backups">NUL
echo.
echo / Forming download and extract scripts...
echo strFileURL="https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip">"%CD%\%NAMEe%_res\steamcmd.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\downloads\current.zip">>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo End if>>"%CD%\%NAMEe%_res\steamcmd.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\steamcmd.vbs"
REM Github \/\/\/\/
echo strFileURL="https://github.com/git-for-windows/git/releases/download/v2.18.0.windows.1/Git-2.18.0-64-bit.exe">"%CD%\%NAMEe%_res\git.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\downloads\current.exe">>"%CD%\%NAMEe%_res\git.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\git.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\git.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\git.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\git.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\git.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\git.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\git.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\git.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\git.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\git.vbs"
echo End if>>"%CD%\%NAMEe%_res\git.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\git.vbs"
echo.
echo // Creating shortcuts...
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%CD%\Rocket Website.lnk');$s.TargetPath='https://hub.rocketmod.net/';$s.Save()"
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%CD%\Server Files.lnk');$s.TargetPath='%CD%\unturned\Servers\%NAMEe%';$s.Save()"
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%CD%\Server Manager.lnk');$s.WindowStyle=2;$s.TargetPath='%CD%\%NAMEe%.bat';$s.IconLocation = '%CD%\%NAMEe%_res\icon.ico';$s.Description ='Runs Server Manager Program';$s.WorkingDirectory ='%CD%';$s.Save()"
echo.
echo / ...
echo strFileURL="https://ci.rocketmod.net/job/Rocket.Unturned/lastSuccessfulBuild/artifact/Rocket.Unturned/bin/Release/Rocket.zip">"%CD%\%NAMEe%_res\rocket.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\downloads\current.zip">>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\rocket.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\rocket.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\rocket.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\rocket.vbs"
echo End if>>"%CD%\%NAMEe%_res\rocket.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\rocket.vbs"
if exist "%CD%\%NAMEe%_res\username.txt" (goto :skipBuildInput)
echo.
echo If you haven't yet, you may want to make a SEPERATE steam account for the server.
echo Use an email you would want to check for info on your server.
echo You will need to have one, make sure it has Unturned.
echo.
set /p "username= Enter your Steam username: "
set /p "password= Enter your Steam password: "
:skipBuildInput
>"%CD%\%NAMEe%_res\extract.vbs" echo Set fso = CreateObject("Scripting.FileSystemObject")
>>"%CD%\%NAMEe%_res\extract.vbs" echo If NOT fso.FolderExists("%CD%\%NAMEe%_res\unzipped\current") Then
>>"%CD%\%NAMEe%_res\extract.vbs" echo fso.CreateFolder("%CD%\%NAMEe%_res\unzipped\current")
>>"%CD%\%NAMEe%_res\extract.vbs" echo End If
>>"%CD%\%NAMEe%_res\extract.vbs" echo set objShell = CreateObject("Shell.Application")
>>"%CD%\%NAMEe%_res\extract.vbs" echo set FilesInZip=objShell.NameSpace("%CD%\%NAMEe%_res\downloads\current.zip").items
>>"%CD%\%NAMEe%_res\extract.vbs" echo objShell.NameSpace("%CD%\%NAMEe%_res\unzipped\current").CopyHere(FilesInZip)
>>"%CD%\%NAMEe%_res\extract.vbs" echo Set fso = Nothing
>>"%CD%\%NAMEe%_res\extract.vbs" echo Set objShell = Nothing
echo strFileURL="https://raw.githubusercontent.com/alexly123/Unturned-Server-Manager/master/icon.ico">"%CD%\%NAMEe%_res\updater\icon.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\icon.ico">>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo End if>>"%CD%\%NAMEe%_res\updater\icon.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\updater\icon.vbs"
if not exist "%CD%\%NAMEe%_res\plugins\plugins.txt" (goto :SkipBuildPlugins)
echo.
echo / Rebuilding plugin scripts...
set count=0
:StartBuildPlugins
set /a "count=%count% + 1"
for /l %%A in (1,1,%plugincount%) do (
if %%A==%count% (
set "tempplugin=!plugin%%A!"
)
)
echo.
echo // Developing download script for %tempplugin%... %count%/%plugincount%.
del /Q "%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs" >nul
echo strFileURL="https://hub.rocketmod.net/product/%tempplugin%/latest.zip">"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo strHDLocation = "%CD%\%NAMEe%_res\downloads\current.zip">>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objXMLHTTP.open "GET", strFileURL, false>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objXMLHTTP.send()>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo If objXMLHTTP.Status = 200 Then>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objADOStream = CreateObject("ADODB.Stream")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Open>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Type = 1 >>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Write objXMLHTTP.ResponseBody>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Position = 0 >>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objFSO = Createobject("Scripting.FileSystemObject")>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile(strHDLocation)>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objFSO = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.SaveToFile strHDLocation>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo objADOStream.Close>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objADOStream = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo End if>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
echo Set objXMLHTTP = Nothing>>"%CD%\%NAMEe%_res\plugins\%tempplugin%.vbs"
if NOT %count%==%plugincount% (goto :StartBuildPlugins)
:SkipBuildPlugins
echo.
echo / Downloading icon...
cscript //nologo "%CD%\%NAMEe%_res\updater\icon.vbs"
echo.
echo / Adding program files...
echo %~dp0>"%CD%\%NAMEe%_res\Directory.txt"
if not {%username%}=={} (echo %username%>"%CD%\%NAMEe%_res\username.txt")
if not {%password%}=={} (echo %password%>"%CD%\%NAMEe%_res\password.txt")
if exist "%CD%\%NAMEe%_res\V.txt" (del "%CD%\%NAMEe%_res\V.txt")
echo %V%>"%CD%\%NAMEe%_res\V.txt"
if /I {%MajorUpdate%}=={true} (
echo.
echo Done. You might want to check out the page for the MAJOR UPDATE that just passed. Else you might not be able to take advantage of seomthing new^!
start "" https://github.com/alexlyee/Unturned-Server-Manager/commits/master
pause
goto :exit
)
if exist "%CD%\%NAMEe%.key" (
del /F /Q "%CD%\%NAMEe%.key"
echo .. Deleted startup key.
)
echo.
echo Done. :) - Enter Y if you would like to see the github update page and close.
echo Anything else to close.
set "choice="
set /p "choice= - Enter option: "
if /I {%choice%}=={Y} (start "" https://github.com/alexlyee/Unturned-Server-Manager/commits/master)
goto :exit
:exit
REM Create log file. and proper exit. \/
set count=0
for /f "tokens=*" %%A in ('dir /b "%CD%\%NAMEe%_res\logs"') do (
set /a "count=!count! + 1"
set "LogCount=!count!"
)
set "count=" & set /a "LogCount=%LogCount% + 1"
set "LogName=Log%LogCount%"
set /a "LogCount=%LogCount% - 1"
>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo -Log.Start
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo --Log.Dump.Start
for /f "tokens=*" %%A in ('set') do (
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo %%A
)
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo --Log.Dump.End
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo --Log.DumpDynamics.Start
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo CD=%CD%
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo DATE=%DATE%
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo TIME=%TIME%
>>"%CD%\%NAMEe%_res\logs\%LogName%.log" echo RANDOM=%RANDOM%