Blame
|
1 | # CT 113 `cs16` |
||||||
| 2 | ||||||||
| 3 | ## Rolle |
|||||||
| 4 | CT 113 betreibt **Counter-Strike 1.6 im Browser** via Xash3D WebAssembly (Projekt: [modesage/cs1.6-browser](https://github.com/modesage/cs1.6-browser)). |
|||||||
| 5 | Der Server ist unter `https://192.168.178.83` erreichbar (selbstsigniertes Zertifikat → „Erweitert → Fortfahren"). |
|||||||
| 6 | ||||||||
| 7 | --- |
|||||||
| 8 | ||||||||
| 9 | ## Basisdaten |
|||||||
| 10 | | Eigenschaft | Wert | |
|||||||
| 11 | |-----------------|-------------------------------| |
|||||||
| 12 | | **CT-ID** | 113 | |
|||||||
| 13 | | **Hostname** | `cs16` | |
|||||||
| 14 | | **IP** | `192.168.178.83` | |
|||||||
| 15 | | **OS** | Debian 13 (trixie) | |
|||||||
| 16 | | **RAM** | 1 GB | |
|||||||
| 17 | | **Disk** | 7,8 GB (ca. 3,2 GB belegt) | |
|||||||
| 18 | ||||||||
| 19 | --- |
|||||||
| 20 | ||||||||
| 21 | ## Ports |
|||||||
| 22 | | Port | Protokoll | Dienst | |
|||||||
| 23 | |------------|-----------|----------------------------| |
|||||||
| 24 | | `443` | TCP/HTTPS | nginx → Reverse Proxy | |
|||||||
| 25 | | `8080` | TCP | cs16browser (node serve, intern) | |
|||||||
| 26 | | `8081` | TCP | WebSocket-Proxy (ws-proxy.js) | |
|||||||
| 27 | | `27015` | UDP | HLDS Game-Server | |
|||||||
| 28 | ||||||||
| 29 | --- |
|||||||
| 30 | ||||||||
| 31 | ## Dateipfade |
|||||||
| 32 | | Datei / Verzeichnis | Beschreibung | |
|||||||
| 33 | |-----------------------------------------------------------------------|-------------------------------| |
|||||||
| 34 | | `/opt/cs16browser/index.html` | Browser-Frontend | |
|||||||
| 35 | | `/opt/cs16browser/index.html.bak` | Backup des Originals | |
|||||||
| 36 | | `/opt/cs16browser/xash.wasm` | Xash3D Engine (gepatcht) | |
|||||||
| 37 | | `/opt/cs16browser/xash.wasm.bak` | Backup vor WASM-Patch | |
|||||||
| 38 | | `/opt/cs16browser/ws-proxy.js` | WebSocket → UDP Proxy | |
|||||||
| 39 | | `/opt/cs16browser/valve.zip` | CS 1.6 Spieldaten | |
|||||||
| 40 | | `/etc/nginx/sites-available/cs16` | nginx Konfiguration | |
|||||||
| 41 | | `/etc/nginx/ssl/cs16.crt` + `cs16.key` | Selbstsigniertes Zertifikat | |
|||||||
| 42 | | `/etc/systemd/system/hlds.service` | HLDS Systemd-Service | |
|||||||
| 43 | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/` | HLDS Root-Verzeichnis | |
|||||||
| 44 | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/` | CS 1.6 Spielverzeichnis | |
|||||||
| 45 | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/server.cfg` | HLDS Server-Konfiguration | |
|||||||
| 46 | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/metamod/` | Metamod-P Installation | |
|||||||
| 47 | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/` | AMX Mod X Installation | |
|||||||
| 48 | ||||||||
| 49 | --- |
|||||||
| 50 | ||||||||
| 51 | ## Services |
|||||||
| 52 | ```bash |
|||||||
| 53 | systemctl status hlds # HLDS Game-Server |
|||||||
| 54 | systemctl status cs16browser # Node.js Frontend (Port 8080) |
|||||||
| 55 | systemctl status cs16-proxy # WebSocket-Proxy (Port 8081) |
|||||||
| 56 | systemctl status nginx # HTTPS Reverse Proxy |
|||||||
| 57 | ``` |
|||||||
| 58 | ||||||||
| 59 | Neustart: |
|||||||
| 60 | ```bash |
|||||||
| 61 | systemctl restart hlds |
|||||||
| 62 | systemctl restart cs16browser |
|||||||
| 63 | systemctl restart cs16-proxy |
|||||||
| 64 | systemctl restart nginx |
|||||||
| 65 | ``` |
|||||||
| 66 | ||||||||
| 67 | --- |
|||||||
| 68 | ||||||||
| 69 | ## HLDS Server-Konfiguration |
|||||||
| 70 | Datei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/server.cfg` |
|||||||
| 71 | ||||||||
| 72 | ``` |
|||||||
| 73 | hostname "LS-CLOUD.biz FunServer" |
|||||||
| 74 | sv_lan 0 # Internet-Play erlaubt |
|||||||
| 75 | sv_maxspeed 320 |
|||||||
| 76 | mp_timelimit 20 |
|||||||
| 77 | sv_cheats 0 |
|||||||
| 78 | ``` |
|||||||
| 79 | ||||||||
| 80 | **Für Internet-Play von außen:** Port `27015 UDP` am Router auf `192.168.178.83` weiterleiten. |
|||||||
| 81 | ||||||||
| 82 | --- |
|||||||
| 83 | ||||||||
| 84 | ## AMX Mod X & Plugins |
|||||||
| 85 | ||||||||
| 86 | **Installierte Software:** |
|||||||
| 87 | - **Metamod-P** (in `addons/metamod/dlls/metamod.so`) |
|||||||
| 88 | - **AMX Mod X 1.10.0 git5474** (in `addons/amxmodx/`) |
|||||||
| 89 | - **GunGame 2.13c** (in `addons/amxmodx/plugins/gungame.amxx`) |
|||||||
| 90 | ||||||||
| 91 | **liblist.gam** zeigt auf Metamod: |
|||||||
| 92 | ``` |
|||||||
| 93 | gamedll_linux "addons/metamod/dlls/metamod.so" |
|||||||
| 94 | ``` |
|||||||
| 95 | ||||||||
| 96 | **Metamod plugins.ini** (`addons/metamod/plugins.ini`): |
|||||||
| 97 | ``` |
|||||||
| 98 | linux addons/amxmodx/dlls/amxmodx_mm_i386.so |
|||||||
| 99 | ``` |
|||||||
| 100 | ||||||||
| 101 | **AMX Mod X plugins.ini** (`addons/amxmodx/configs/plugins.ini`): |
|||||||
| 102 | Hier werden alle AMXX-Plugins geladen. Aktive Plugins (Auswahl): |
|||||||
| 103 | ``` |
|||||||
| 104 | admin.amxx |
|||||||
| 105 | ; GunGame |
|||||||
| 106 | gungame.amxx |
|||||||
| 107 | ``` |
|||||||
| 108 | ||||||||
| 109 | --- |
|||||||
| 110 | ||||||||
| 111 | ## Admin einrichten (SteamID eintragen) |
|||||||
| 112 | ||||||||
| 113 | Datei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/configs/users.ini` |
|||||||
| 114 | ||||||||
| 115 | Format: |
|||||||
| 116 | ``` |
|||||||
| 117 | ; "STEAMID / Name / IP" "Passwort" "Flags" "Zugriffsrechte" |
|||||||
| 118 | "STEAM_0:0:XXXXXXXX" "" "abcdefghijklmnopqrstu" "" |
|||||||
| 119 | ``` |
|||||||
| 120 | ||||||||
| 121 | **Flags-Bedeutung (wichtigste):** |
|||||||
| 122 | | Flag | Bedeutung | |
|||||||
| 123 | |------|--------------------------| |
|||||||
| 124 | | `a` | Immunity | |
|||||||
| 125 | | `b` | Ban/Unban | |
|||||||
| 126 | | `c` | Kick | |
|||||||
| 127 | | `d` | RCON-Befehle | |
|||||||
| 128 | | `e` | Cheats | |
|||||||
| 129 | | `f` | Config-Änderungen | |
|||||||
| 130 | | `g` | Cvar-Änderungen | |
|||||||
| 131 | | `h` | Chat / Mute / Gag | |
|||||||
| 132 | | `i` | Teamwechsel erzwingen | |
|||||||
| 133 | | `j` | Spectator-Verwaltung | |
|||||||
| 134 | | `k` | Passwort-Schutz | |
|||||||
| 135 | | `l` | RCON-Zugriff | |
|||||||
| 136 | | `z` | Root-Zugriff (alles) | |
|||||||
| 137 | ||||||||
| 138 | **Vollständiger Admin (Root):** |
|||||||
| 139 | ``` |
|||||||
| 140 | "STEAM_0:0:XXXXXXXX" "" "z" "" |
|||||||
| 141 | ``` |
|||||||
| 142 | ||||||||
| 143 | **SteamID herausfinden:** |
|||||||
| 144 | ``` |
|||||||
| 145 | # Im HLDS-Log erscheint beim Einloggen: |
|||||||
| 146 | # Player "Name" with STEAMID "STEAM_0:X:XXXXXXX" connected |
|||||||
| 147 | ``` |
|||||||
| 148 | Oder über: [steamid.io](https://steamid.io) / [steamidfinder.com](https://steamidfinder.com) |
|||||||
| 149 | ||||||||
| 150 | **Nach Änderung neu laden (kein Neustart nötig):** |
|||||||
| 151 | ```bash |
|||||||
| 152 | # Entweder HLDS neu starten: |
|||||||
| 153 | systemctl restart hlds |
|||||||
| 154 | ||||||||
| 155 | # Oder im Spiel per RCON (als Admin): |
|||||||
| 156 | amx_reloadadmins |
|||||||
| 157 | ``` |
|||||||
| 158 | ||||||||
| 159 | --- |
|||||||
| 160 | ||||||||
| 161 | ## GunGame konfigurieren |
|||||||
| 162 | ||||||||
| 163 | Konfigurationsdatei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/configs/gungame.cfg` |
|||||||
| 164 | ||||||||
| 165 | Wichtige CVars: |
|||||||
| 166 | ``` |
|||||||
| 167 | gg_multikill_override 0 # Kills pro Waffe (0 = Standard je nach Waffe) |
|||||||
| 168 | gg_knife_pro 1 # Knife-Kill → Gegner stuft ab |
|||||||
| 169 | gg_deathmatch 0 # Deathmatch-Modus (kein Team) |
|||||||
| 170 | gg_vote_intermission 0 # Map-Vote nach dem Spiel |
|||||||
| 171 | ``` |
|||||||
| 172 | ||||||||
| 173 | --- |
|||||||
| 174 | ||||||||
| 175 | ## RCON (Remote Console) |
|||||||
| 176 | ||||||||
| 177 | Im Spiel oder per Tool: |
|||||||
| 178 | ``` |
|||||||
| 179 | rcon_password "PASSWORT" # Passwort setzen (in server.cfg) |
|||||||
| 180 | rcon status # Server-Status |
|||||||
| 181 | rcon amx_plugins # Geladene AMXX-Plugins anzeigen |
|||||||
| 182 | rcon amx_reloadadmins # Admins neu laden |
|||||||
| 183 | rcon changelevel de_dust2 # Map wechseln |
|||||||
| 184 | rcon sv_cheats 1 # Cheats aktivieren |
|||||||
| 185 | ``` |
|||||||
| 186 | ||||||||
| 187 | --- |
|||||||
| 188 | ||||||||
| 189 | ## Technische Fixes & Hintergründe |
|||||||
| 190 | ||||||||
| 191 | ### Problem: `[Xash3D]` vor dem Nicknamen |
|||||||
| 192 | **Ursache:** Xash3D Engine fügt automatisch `[Xash3D]` per `setinfo` vor den Spielernamen. |
|||||||
| 193 | **Fix:** Binary-Patch in `xash.wasm`: |
|||||||
| 194 | - Offset `3187865`: `[Xash3D]%s` → `%s` + Null-Bytes |
|||||||
| 195 | - Offset `3341750`: `[Xash3D]%s"` → Null-Bytes + `%s"` |
|||||||
| 196 | - Backup: `xash.wasm.bak` |
|||||||
| 197 | ||||||||
| 198 | ### Problem: `AsciiToString is not a function` |
|||||||
| 199 | **Fix:** Eigene `wasmReadStr()`-Implementierung über direkten Speicherzugriff. |
|||||||
| 200 | ||||||||
| 201 | ### Problem: `HEAPU8 undefined` |
|||||||
| 202 | **Ursache:** `raw.js` ist eine IIFE, `HEAPU8` ist Closure-Variable – nicht auf `Module` exponiert. |
|||||||
| 203 | **Fix:** `Module["instantiateWasm"]`-Hook fängt WASM-Instance ab → `_wasmMemory` + `_wasmExports.malloc` direkt verfügbar. |
|||||||
| 204 | ||||||||
| 205 | ### Problem: `filesystem_stdio.wasm: file not found` |
|||||||
| 206 | **Fix:** WASM-Bytes werden in mehrere Pfade im virtuellen FS geschrieben (inkl. `/ddls/`-Quirk). |
|||||||
| 207 | ||||||||
| 208 | ### Wichtige Erkenntnis zu `raw.js` |
|||||||
| 209 | - `HEAPU8`, `UTF8ToString`, `_malloc` sind **Closure-Variablen**, NICHT auf `Module` |
|||||||
| 210 | - **Auf Module exponiert:** `Module["ccall"]`, `Module["FS"]`, `Module["_Cmd_ExecuteString"]` |
|||||||
| 211 | ||||||||
| 212 | --- |
|||||||
| 213 | ||||||||
| 214 | ## Wichtige HLDS-Befehle (direkt auf dem Server) |
|||||||
| 215 | ||||||||
| 216 | ```bash |
|||||||
| 217 | # HLDS-Log live ansehen |
|||||||
| 218 | journalctl -u hlds -f |
|||||||
| 219 | ||||||||
| 220 | # Map wechseln (ohne Neustart) |
|||||||
| 221 | # Via RCON im Spiel: rcon changelevel de_dust2 |
|||||||
| 222 | ||||||||
| 223 | # Mapcycle bearbeiten |
|||||||
| 224 | nano /opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/mapcycle.txt |
|||||||
| 225 | ||||||||
| 226 | # Verfügbare Maps anzeigen |
|||||||
| 227 | ls /opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/maps/*.bsp | xargs -n1 basename | sed 's/.bsp//' |
|||||||
| 228 | ``` |
|||||||
| 229 | ||||||||
| 230 | --- |
|||||||
| 231 | ||||||||
| 232 | ## Bekannte Installationshinweise |
|||||||
| 233 | ||||||||
| 234 | ### AMX Mod X neu installieren |
|||||||
| 235 | ```bash |
|||||||
| 236 | # AMX Mod X 1.10.0 Download-URL: |
|||||||
| 237 | # https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5474-base-linux.tar.gz |
|||||||
| 238 | # https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5474-cstrike-linux.tar.gz |
|||||||
| 239 | ||||||||
| 240 | # Metamod-P: |
|||||||
| 241 | # https://github.com/mittorn/metamod-p/releases/download/1/metamod.so |
|||||||
| 242 | ||||||||
| 243 | # Installiert nach: |
|||||||
| 244 | tar -xzf amxxdrop-base.tar.gz -C /opt/.../cstrike/ |
|||||||
| 245 | tar -xzf amxxdrop-cstrike.tar.gz -C /opt/.../cstrike/ |
|||||||
| 246 | mkdir -p /opt/.../cstrike/addons/metamod/dlls |
|||||||
| 247 | cp metamod.so /opt/.../cstrike/addons/metamod/dlls/ |
|||||||
| 248 | ``` |
|||||||
| 249 | ||||||||
| 250 | ### AMXX-Plugin kompilieren (auf Proxmox Host) |
|||||||
| 251 | ```bash |
|||||||
| 252 | # 32-Bit-Libs installieren (einmalig): |
|||||||
| 253 | dpkg --add-architecture i386 && apt-get update && apt-get install -y libc6-i386 |
|||||||
| 254 | ||||||||
| 255 | # Compiler aus Container holen: |
|||||||
| 256 | pct pull 113 /opt/.../scripting/amxxpc /tmp/amxxpc |
|||||||
| 257 | pct pull 113 /opt/.../scripting/amxxpc32.so /tmp/amxxpc32.so |
|||||||
| 258 | ||||||||
| 259 | # Include-Verzeichnis holen: |
|||||||
| 260 | pct exec 113 -- tar -czf /tmp/includes.tar.gz -C /opt/.../scripting include |
|||||||
| 261 | pct pull 113 /tmp/includes.tar.gz /tmp/ |
|||||||
| 262 | ||||||||
| 263 | # Kompilieren: |
|||||||
| 264 | cd /tmp && tar -xzf includes.tar.gz |
|||||||
| 265 | chmod +x amxxpc |
|||||||
| 266 | ./amxxpc mein_plugin.sma -i./include |
|||||||
| 267 | ``` |
|||||||
