Commit 536e5f
2026-04-04 15:57:12 Wiki: Add CT 113 CS 1.6 Browser documentation| /dev/null .. ct-113-cs16.md | |
| @@ 0,0 1,267 @@ | |
| + | # CT 113 `cs16` |
| + | |
| + | ## Rolle |
| + | CT 113 betreibt **Counter-Strike 1.6 im Browser** via Xash3D WebAssembly (Projekt: [modesage/cs1.6-browser](https://github.com/modesage/cs1.6-browser)). |
| + | Der Server ist unter `https://192.168.178.83` erreichbar (selbstsigniertes Zertifikat → „Erweitert → Fortfahren"). |
| + | |
| + | --- |
| + | |
| + | ## Basisdaten |
| + | | Eigenschaft | Wert | |
| + | |-----------------|-------------------------------| |
| + | | **CT-ID** | 113 | |
| + | | **Hostname** | `cs16` | |
| + | | **IP** | `192.168.178.83` | |
| + | | **OS** | Debian 13 (trixie) | |
| + | | **RAM** | 1 GB | |
| + | | **Disk** | 7,8 GB (ca. 3,2 GB belegt) | |
| + | |
| + | --- |
| + | |
| + | ## Ports |
| + | | Port | Protokoll | Dienst | |
| + | |------------|-----------|----------------------------| |
| + | | `443` | TCP/HTTPS | nginx → Reverse Proxy | |
| + | | `8080` | TCP | cs16browser (node serve, intern) | |
| + | | `8081` | TCP | WebSocket-Proxy (ws-proxy.js) | |
| + | | `27015` | UDP | HLDS Game-Server | |
| + | |
| + | --- |
| + | |
| + | ## Dateipfade |
| + | | Datei / Verzeichnis | Beschreibung | |
| + | |-----------------------------------------------------------------------|-------------------------------| |
| + | | `/opt/cs16browser/index.html` | Browser-Frontend | |
| + | | `/opt/cs16browser/index.html.bak` | Backup des Originals | |
| + | | `/opt/cs16browser/xash.wasm` | Xash3D Engine (gepatcht) | |
| + | | `/opt/cs16browser/xash.wasm.bak` | Backup vor WASM-Patch | |
| + | | `/opt/cs16browser/ws-proxy.js` | WebSocket → UDP Proxy | |
| + | | `/opt/cs16browser/valve.zip` | CS 1.6 Spieldaten | |
| + | | `/etc/nginx/sites-available/cs16` | nginx Konfiguration | |
| + | | `/etc/nginx/ssl/cs16.crt` + `cs16.key` | Selbstsigniertes Zertifikat | |
| + | | `/etc/systemd/system/hlds.service` | HLDS Systemd-Service | |
| + | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/` | HLDS Root-Verzeichnis | |
| + | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/` | CS 1.6 Spielverzeichnis | |
| + | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/server.cfg` | HLDS Server-Konfiguration | |
| + | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/metamod/` | Metamod-P Installation | |
| + | | `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/` | AMX Mod X Installation | |
| + | |
| + | --- |
| + | |
| + | ## Services |
| + | ```bash |
| + | systemctl status hlds # HLDS Game-Server |
| + | systemctl status cs16browser # Node.js Frontend (Port 8080) |
| + | systemctl status cs16-proxy # WebSocket-Proxy (Port 8081) |
| + | systemctl status nginx # HTTPS Reverse Proxy |
| + | ``` |
| + | |
| + | Neustart: |
| + | ```bash |
| + | systemctl restart hlds |
| + | systemctl restart cs16browser |
| + | systemctl restart cs16-proxy |
| + | systemctl restart nginx |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## HLDS Server-Konfiguration |
| + | Datei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/server.cfg` |
| + | |
| + | ``` |
| + | hostname "LS-CLOUD.biz FunServer" |
| + | sv_lan 0 # Internet-Play erlaubt |
| + | sv_maxspeed 320 |
| + | mp_timelimit 20 |
| + | sv_cheats 0 |
| + | ``` |
| + | |
| + | **Für Internet-Play von außen:** Port `27015 UDP` am Router auf `192.168.178.83` weiterleiten. |
| + | |
| + | --- |
| + | |
| + | ## AMX Mod X & Plugins |
| + | |
| + | **Installierte Software:** |
| + | - **Metamod-P** (in `addons/metamod/dlls/metamod.so`) |
| + | - **AMX Mod X 1.10.0 git5474** (in `addons/amxmodx/`) |
| + | - **GunGame 2.13c** (in `addons/amxmodx/plugins/gungame.amxx`) |
| + | |
| + | **liblist.gam** zeigt auf Metamod: |
| + | ``` |
| + | gamedll_linux "addons/metamod/dlls/metamod.so" |
| + | ``` |
| + | |
| + | **Metamod plugins.ini** (`addons/metamod/plugins.ini`): |
| + | ``` |
| + | linux addons/amxmodx/dlls/amxmodx_mm_i386.so |
| + | ``` |
| + | |
| + | **AMX Mod X plugins.ini** (`addons/amxmodx/configs/plugins.ini`): |
| + | Hier werden alle AMXX-Plugins geladen. Aktive Plugins (Auswahl): |
| + | ``` |
| + | admin.amxx |
| + | ; GunGame |
| + | gungame.amxx |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## Admin einrichten (SteamID eintragen) |
| + | |
| + | Datei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/configs/users.ini` |
| + | |
| + | Format: |
| + | ``` |
| + | ; "STEAMID / Name / IP" "Passwort" "Flags" "Zugriffsrechte" |
| + | "STEAM_0:0:XXXXXXXX" "" "abcdefghijklmnopqrstu" "" |
| + | ``` |
| + | |
| + | **Flags-Bedeutung (wichtigste):** |
| + | | Flag | Bedeutung | |
| + | |------|--------------------------| |
| + | | `a` | Immunity | |
| + | | `b` | Ban/Unban | |
| + | | `c` | Kick | |
| + | | `d` | RCON-Befehle | |
| + | | `e` | Cheats | |
| + | | `f` | Config-Änderungen | |
| + | | `g` | Cvar-Änderungen | |
| + | | `h` | Chat / Mute / Gag | |
| + | | `i` | Teamwechsel erzwingen | |
| + | | `j` | Spectator-Verwaltung | |
| + | | `k` | Passwort-Schutz | |
| + | | `l` | RCON-Zugriff | |
| + | | `z` | Root-Zugriff (alles) | |
| + | |
| + | **Vollständiger Admin (Root):** |
| + | ``` |
| + | "STEAM_0:0:XXXXXXXX" "" "z" "" |
| + | ``` |
| + | |
| + | **SteamID herausfinden:** |
| + | ``` |
| + | # Im HLDS-Log erscheint beim Einloggen: |
| + | # Player "Name" with STEAMID "STEAM_0:X:XXXXXXX" connected |
| + | ``` |
| + | Oder über: [steamid.io](https://steamid.io) / [steamidfinder.com](https://steamidfinder.com) |
| + | |
| + | **Nach Änderung neu laden (kein Neustart nötig):** |
| + | ```bash |
| + | # Entweder HLDS neu starten: |
| + | systemctl restart hlds |
| + | |
| + | # Oder im Spiel per RCON (als Admin): |
| + | amx_reloadadmins |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## GunGame konfigurieren |
| + | |
| + | Konfigurationsdatei: `/opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/addons/amxmodx/configs/gungame.cfg` |
| + | |
| + | Wichtige CVars: |
| + | ``` |
| + | gg_multikill_override 0 # Kills pro Waffe (0 = Standard je nach Waffe) |
| + | gg_knife_pro 1 # Knife-Kill → Gegner stuft ab |
| + | gg_deathmatch 0 # Deathmatch-Modus (kein Team) |
| + | gg_vote_intermission 0 # Map-Vote nach dem Spiel |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## RCON (Remote Console) |
| + | |
| + | Im Spiel oder per Tool: |
| + | ``` |
| + | rcon_password "PASSWORT" # Passwort setzen (in server.cfg) |
| + | rcon status # Server-Status |
| + | rcon amx_plugins # Geladene AMXX-Plugins anzeigen |
| + | rcon amx_reloadadmins # Admins neu laden |
| + | rcon changelevel de_dust2 # Map wechseln |
| + | rcon sv_cheats 1 # Cheats aktivieren |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## Technische Fixes & Hintergründe |
| + | |
| + | ### Problem: `[Xash3D]` vor dem Nicknamen |
| + | **Ursache:** Xash3D Engine fügt automatisch `[Xash3D]` per `setinfo` vor den Spielernamen. |
| + | **Fix:** Binary-Patch in `xash.wasm`: |
| + | - Offset `3187865`: `[Xash3D]%s` → `%s` + Null-Bytes |
| + | - Offset `3341750`: `[Xash3D]%s"` → Null-Bytes + `%s"` |
| + | - Backup: `xash.wasm.bak` |
| + | |
| + | ### Problem: `AsciiToString is not a function` |
| + | **Fix:** Eigene `wasmReadStr()`-Implementierung über direkten Speicherzugriff. |
| + | |
| + | ### Problem: `HEAPU8 undefined` |
| + | **Ursache:** `raw.js` ist eine IIFE, `HEAPU8` ist Closure-Variable – nicht auf `Module` exponiert. |
| + | **Fix:** `Module["instantiateWasm"]`-Hook fängt WASM-Instance ab → `_wasmMemory` + `_wasmExports.malloc` direkt verfügbar. |
| + | |
| + | ### Problem: `filesystem_stdio.wasm: file not found` |
| + | **Fix:** WASM-Bytes werden in mehrere Pfade im virtuellen FS geschrieben (inkl. `/ddls/`-Quirk). |
| + | |
| + | ### Wichtige Erkenntnis zu `raw.js` |
| + | - `HEAPU8`, `UTF8ToString`, `_malloc` sind **Closure-Variablen**, NICHT auf `Module` |
| + | - **Auf Module exponiert:** `Module["ccall"]`, `Module["FS"]`, `Module["_Cmd_ExecuteString"]` |
| + | |
| + | --- |
| + | |
| + | ## Wichtige HLDS-Befehle (direkt auf dem Server) |
| + | |
| + | ```bash |
| + | # HLDS-Log live ansehen |
| + | journalctl -u hlds -f |
| + | |
| + | # Map wechseln (ohne Neustart) |
| + | # Via RCON im Spiel: rcon changelevel de_dust2 |
| + | |
| + | # Mapcycle bearbeiten |
| + | nano /opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/mapcycle.txt |
| + | |
| + | # Verfügbare Maps anzeigen |
| + | ls /opt/cs16browser/get_cs_assets/steamcmd/cs/cstrike/maps/*.bsp | xargs -n1 basename | sed 's/.bsp//' |
| + | ``` |
| + | |
| + | --- |
| + | |
| + | ## Bekannte Installationshinweise |
| + | |
| + | ### AMX Mod X neu installieren |
| + | ```bash |
| + | # AMX Mod X 1.10.0 Download-URL: |
| + | # https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5474-base-linux.tar.gz |
| + | # https://www.amxmodx.org/amxxdrop/1.10/amxmodx-1.10.0-git5474-cstrike-linux.tar.gz |
| + | |
| + | # Metamod-P: |
| + | # https://github.com/mittorn/metamod-p/releases/download/1/metamod.so |
| + | |
| + | # Installiert nach: |
| + | tar -xzf amxxdrop-base.tar.gz -C /opt/.../cstrike/ |
| + | tar -xzf amxxdrop-cstrike.tar.gz -C /opt/.../cstrike/ |
| + | mkdir -p /opt/.../cstrike/addons/metamod/dlls |
| + | cp metamod.so /opt/.../cstrike/addons/metamod/dlls/ |
| + | ``` |
| + | |
| + | ### AMXX-Plugin kompilieren (auf Proxmox Host) |
| + | ```bash |
| + | # 32-Bit-Libs installieren (einmalig): |
| + | dpkg --add-architecture i386 && apt-get update && apt-get install -y libc6-i386 |
| + | |
| + | # Compiler aus Container holen: |
| + | pct pull 113 /opt/.../scripting/amxxpc /tmp/amxxpc |
| + | pct pull 113 /opt/.../scripting/amxxpc32.so /tmp/amxxpc32.so |
| + | |
| + | # Include-Verzeichnis holen: |
| + | pct exec 113 -- tar -czf /tmp/includes.tar.gz -C /opt/.../scripting include |
| + | pct pull 113 /tmp/includes.tar.gz /tmp/ |
| + | |
| + | # Kompilieren: |
| + | cd /tmp && tar -xzf includes.tar.gz |
| + | chmod +x amxxpc |
| + | ./amxxpc mein_plugin.sma -i./include |
| + | ``` |
