bucky02 commited on
Commit
2ef2e07
·
verified ·
1 Parent(s): a322d7e

Upload 2 files

Browse files
Files changed (2) hide show
  1. download-server-tools.bat +123 -0
  2. open-fivem-ports.bat +61 -0
download-server-tools.bat ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal EnableExtensions
3
+ title Download Server Tools (MariaDB / HeidiSQL / WinRAR)
4
+
5
+ REM ============================================================
6
+ REM New RDP setup - downloads the 3 tools automatically.
7
+ REM 1) MariaDB 12.3.3 x64 (.msi)
8
+ REM 2) HeidiSQL 12.21 (.exe)
9
+ REM 3) WinRAR 64-bit latest (.exe)
10
+ REM No admin needed to DOWNLOAD. Admin is needed to INSTALL.
11
+ REM ============================================================
12
+
13
+ set "DEST=%USERPROFILE%\Desktop\Server-Tools"
14
+ if not exist "%DEST%" mkdir "%DEST%"
15
+
16
+ set "OK=0"
17
+ set "BAD=0"
18
+
19
+ echo.
20
+ echo Saving to: %DEST%
21
+ echo ------------------------------------------------------------
22
+
23
+ call :Get "https://mirrors.aliyun.com/mariadb//mariadb-12.3.3/winx64-packages/mariadb-12.3.3-winx64.msi" "%DEST%\mariadb-12.3.3-winx64.msi" "MariaDB 12.3.3 x64"
24
+
25
+ call :Get "https://github.com/HeidiSQL/HeidiSQL/releases/download/v12.21/HeidiSQL_12.21.0.7344_Setup.exe" "%DEST%\HeidiSQL_12.21.0.7344_Setup.exe" "HeidiSQL 12.21"
26
+
27
+ REM WinRAR: the win-rar.com page you had is not a direct file link.
28
+ REM These are the official direct URLs - newest version first.
29
+ set "WRDONE="
30
+ for %%V in (721 720 713 712 711 710) do (
31
+ if not defined WRDONE (
32
+ call :TryWinrar %%V
33
+ if not errorlevel 1 set "WRDONE=1"
34
+ )
35
+ )
36
+ if not defined WRDONE (
37
+ echo [FAIL] WinRAR - no version URL responded
38
+ set /a BAD+=1
39
+ )
40
+
41
+ echo ------------------------------------------------------------
42
+ echo.
43
+ echo Downloaded OK : %OK%
44
+ echo Failed : %BAD%
45
+ echo.
46
+ echo Files in %DEST%:
47
+ echo.
48
+ dir /b "%DEST%" 2>nul
49
+ echo.
50
+ echo ------------------------------------------------------------
51
+ echo INSTALL ORDER (run each as Administrator):
52
+ echo 1. WinRAR - plain Next / Next
53
+ echo 2. MariaDB .msi - set a root password, tick "UTF8 as default"
54
+ echo keep port 3306, install as a service
55
+ echo 3. HeidiSQL - connect to 127.0.0.1 : 3306 with that root password
56
+ echo ------------------------------------------------------------
57
+ echo.
58
+
59
+ choice /c YN /n /m " Open the folder now? [Y/N] "
60
+ if %errorlevel% equ 1 start "" explorer.exe "%DEST%"
61
+ exit /b 0
62
+
63
+
64
+ REM ============================================================
65
+ REM :Get <url> <output file> <label>
66
+ REM ============================================================
67
+ :Get
68
+ set "URL=%~1"
69
+ set "OUT=%~2"
70
+ set "LBL=%~3"
71
+
72
+ set "HAVE="
73
+ if exist "%OUT%" for %%F in ("%OUT%") do if %%~zF GTR 1000000 set "HAVE=1"
74
+ if defined HAVE (
75
+ echo [SKIP] %LBL% - already downloaded
76
+ set /a OK+=1
77
+ exit /b 0
78
+ )
79
+
80
+ echo.
81
+ echo [ .. ] %LBL%
82
+ if exist "%OUT%.part" del /q "%OUT%.part" >nul 2>&1
83
+
84
+ where curl.exe >nul 2>&1
85
+ if %errorlevel% equ 0 (
86
+ curl.exe -L --fail --retry 3 --retry-delay 3 --connect-timeout 25 --progress-bar -o "%OUT%.part" "%URL%"
87
+ ) else (
88
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "$ProgressPreference='SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; try { Invoke-WebRequest -Uri '%URL%' -OutFile '%OUT%.part' -UseBasicParsing } catch { exit 1 }"
89
+ )
90
+
91
+ if not exist "%OUT%.part" (
92
+ echo [FAIL] %LBL% - download failed
93
+ set /a BAD+=1
94
+ exit /b 1
95
+ )
96
+ for %%F in ("%OUT%.part") do if %%~zF LSS 100000 (
97
+ del /q "%OUT%.part" >nul 2>&1
98
+ echo [FAIL] %LBL% - file too small, link probably dead
99
+ set /a BAD+=1
100
+ exit /b 1
101
+ )
102
+
103
+ move /y "%OUT%.part" "%OUT%" >nul
104
+ echo [ OK ] %LBL%
105
+ set /a OK+=1
106
+ exit /b 0
107
+
108
+
109
+ REM ============================================================
110
+ REM :TryWinrar <version digits, e.g. 721>
111
+ REM ============================================================
112
+ :TryWinrar
113
+ set "WV=%~1"
114
+ set "WURL=https://www.win-rar.com/fileadmin/winrar-versions/winrar/winrar-x64-%WV%.exe"
115
+
116
+ where curl.exe >nul 2>&1
117
+ if %errorlevel% equ 0 (
118
+ curl.exe -sfIL --connect-timeout 15 "%WURL%" >nul 2>&1
119
+ if errorlevel 1 exit /b 1
120
+ )
121
+
122
+ call :Get "%WURL%" "%DEST%\winrar-x64-%WV%.exe" "WinRAR 64-bit (v%WV%)"
123
+ exit /b %errorlevel%
open-fivem-ports.bat ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal EnableExtensions
3
+ title FiveM Firewall Port Opener (30120 / 40120)
4
+
5
+ REM ============================================================
6
+ REM FiveM Server - Windows Firewall port opener
7
+ REM Opens 30120 TCP+UDP (game) and 40120 TCP+UDP (txAdmin)
8
+ REM Run this ON the RDP / VPS as Administrator.
9
+ REM ============================================================
10
+
11
+ REM ---- Admin check -------------------------------------------
12
+ net session >nul 2>&1
13
+ if %errorlevel% neq 0 (
14
+ echo.
15
+ echo [X] This script needs ADMINISTRATOR rights.
16
+ echo Right-click the file ^> "Run as administrator"
17
+ echo.
18
+ pause
19
+ exit /b 1
20
+ )
21
+
22
+ echo.
23
+ echo Opening FiveM ports in Windows Firewall...
24
+ echo ------------------------------------------------------------
25
+
26
+ call :OpenPort 30120 TCP "FiveM Server 30120 TCP"
27
+ call :OpenPort 30120 UDP "FiveM Server 30120 UDP"
28
+ call :OpenPort 40120 TCP "FiveM txAdmin 40120 TCP"
29
+ call :OpenPort 40120 UDP "FiveM txAdmin 40120 UDP"
30
+
31
+ echo ------------------------------------------------------------
32
+ echo.
33
+ echo Done. Current FiveM rules:
34
+ echo.
35
+ netsh advfirewall firewall show rule name=all dir=in ^| findstr /I "FiveM"
36
+ echo.
37
+ echo NOTE: If this machine is behind a router / cloud provider
38
+ echo (AWS, Azure, OVH, Contabo...), also open 30120 and
39
+ echo 40120 in that provider's own firewall / security group.
40
+ echo.
41
+ pause
42
+ exit /b 0
43
+
44
+
45
+ REM ---- Subroutine: %1=port %2=protocol %3="rule name" ------
46
+ :OpenPort
47
+ set "PORT=%~1"
48
+ set "PROTO=%~2"
49
+ set "RNAME=%~3"
50
+
51
+ REM remove old rules with the same name so re-running stays clean
52
+ netsh advfirewall firewall delete rule name="%RNAME% (In)" >nul 2>&1
53
+ netsh advfirewall firewall delete rule name="%RNAME% (Out)" >nul 2>&1
54
+
55
+ netsh advfirewall firewall add rule name="%RNAME% (In)" dir=in action=allow protocol=%PROTO% localport=%PORT% profile=any enable=yes >nul
56
+ if %errorlevel% equ 0 (echo [OK] IN %PROTO% %PORT%) else (echo [FAIL] IN %PROTO% %PORT%)
57
+
58
+ netsh advfirewall firewall add rule name="%RNAME% (Out)" dir=out action=allow protocol=%PROTO% localport=%PORT% profile=any enable=yes >nul
59
+ if %errorlevel% equ 0 (echo [OK] OUT %PROTO% %PORT%) else (echo [FAIL] OUT %PROTO% %PORT%)
60
+
61
+ exit /b 0