diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..61d47ca --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +# Half-Life Server Configuration +# Copy this file and customize the values + +SERVER_NAME=Half-Life Crossfire Server +MAX_PLAYERS=16 +SERVER_PASSWORD= +RCON_PASSWORD=changeme +WELCOME_MESSAGE=Welcome to Crossfire! Fight until the last player stands! diff --git a/.gitignore b/.gitignore index 4ea0bee..6d2b584 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,36 @@ -# MacOS filesystem +# Environment variables with sensitive data +.env + +# Docker volumes and data +server_data/ + +# Docker build cache +.dockerignore + +# Logs +*.log +logs/ + +# Compiled AMX plugins +*.amxx + +# OS files .DS_Store +Thumbs.db +*.swp +*.swo +*~ + +# IDE files +.vscode/ +.idea/ +*.sublime-* + +# Backup files +*.bak +*.backup +*~ + +# Temporary files +tmp/ +temp/ diff --git a/Dockerfile b/Dockerfile index adec61b..31e40f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,79 +1,88 @@ -# Custom half life server - Steam & No Steam classic -# pre 2024 anniversary patches edition +FROM debian:bullseye-slim -FROM debian:buster-slim +# Build arguments +# ARG HLDS_BUILD=7559 +ARG HLDS_BUILD=7882 +ARG METAMOD_VERSION=1.21p38 +ARG AMXMODX_VERSION=1.8.1-300 -ARG hlds_build=7882 -ARG metamod_version=1.21p38 -ARG amxmod_version=1.8.2 -ARG steamcmd_url=https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz -ARG hlds_url="https://github.com/DevilBoy-eXe/hlds/releases/download/$hlds_build/hlds_build_$hlds_build.zip" -ARG metamod_url="https://github.com/Bots-United/metamod-p/releases/download/v$metamod_version/metamod_i686_linux_win32-$metamod_version.tar.xz" -ARG amxmod_url="http://www.amxmodx.org/release/amxmodx-$amxmod_version-base-linux.tar.gz" +# Install dependencies +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y \ + lib32gcc-s1 \ + lib32stdc++6 \ + libc6-i386 \ + wget \ + curl \ + unzip \ + ca-certificates \ + xz-utils \ + && rm -rf /var/lib/apt/lists/* -RUN groupadd -r steam && useradd -r -g steam -m -d /opt/steam steam +# Create steam user and directories +RUN useradd -m steam && \ + mkdir -p /opt/steam/hlds -RUN apt-get -y update && apt-get install -y ca-certificates curl lib32gcc1 unzip xz-utils zip - -USER steam -WORKDIR /opt/steam -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -COPY ./lib/hlds.install /opt/steam - -RUN curl -sL "$steamcmd_url" | tar xzvf - \ - && ./steamcmd.sh +runscript hlds.install - -RUN curl -sLJO "$hlds_url" \ - && unzip "hlds_build_$hlds_build.zip" -d "/opt/steam" \ - && cp -R "hlds_build_$hlds_build"/* hlds/ \ - && rm -rf "hlds_build_$hlds_build" "hlds_build_$hlds_build.zip" - -# Fix error that steamclient.so is missing -RUN mkdir -p "$HOME/.steam" \ - && ln -s /opt/steam/linux32 "$HOME/.steam/sdk32" - -# Fix warnings: -# couldn't exec listip.cfg -# couldn't exec banned.cfg -RUN touch /opt/steam/hlds/valve/listip.cfg -RUN touch /opt/steam/hlds/valve/banned.cfg +# Download HLDS +WORKDIR /tmp +RUN wget "https://github.com/EXORTEM/hlds/releases/download/${HLDS_BUILD}/hlds_build_${HLDS_BUILD}.zip" && \ + unzip "hlds_build_${HLDS_BUILD}.zip" && \ + mv hlds_build_${HLDS_BUILD}/* /opt/steam/hlds/ && \ + rm -rf "hlds_build_${HLDS_BUILD}.zip" "hlds_build_${HLDS_BUILD}" && \ + chmod +x /opt/steam/hlds/hlds_run && \ + chmod +x /opt/steam/hlds/hlds_linux # Install Metamod-P -RUN mkdir -p /opt/steam/hlds/valve/addons/metamod/dlls \ - && touch /opt/steam/hlds/valve/addons/metamod/plugins.ini -RUN curl -sqL "$metamod_url" | tar -C /opt/steam/hlds/valve/addons/metamod/dlls -xJ -RUN sed -i 's/dlls\/hl\.so/addons\/metamod\/dlls\/metamod.so/g' /opt/steam/hlds/valve/liblist.gam +RUN mkdir -p /opt/steam/hlds/valve/addons/metamod/dlls && \ + touch /opt/steam/hlds/valve/addons/metamod/plugins.ini && \ + wget "https://github.com/Bots-United/metamod-p/releases/download/v${METAMOD_VERSION}/metamod_i686_linux_win32-${METAMOD_VERSION}.tar.xz" && \ + tar -xJf "metamod_i686_linux_win32-${METAMOD_VERSION}.tar.xz" -C /opt/steam/hlds/valve/addons/metamod/dlls && \ + rm "metamod_i686_linux_win32-${METAMOD_VERSION}.tar.xz" && \ + sed -i 's/dlls\/hl\.so/addons\/metamod\/dlls\/metamod.so/g' /opt/steam/hlds/valve/liblist.gam -# Install AMX mod X -RUN curl -sqL "$amxmod_url" | tar -C /opt/steam/hlds/valve/ -zxvf - \ - && echo 'linux addons/amxmodx/dlls/amxmodx_mm_i386.so' >> /opt/steam/hlds/valve/addons/metamod/plugins.ini +# Install AMX Mod X 1.9 (stable, fixes crashes with newer HLDS) +RUN wget "https://www.amxmodx.org/latest.php?version=1.9&os=linux&package=base" -O amxmodx-base.tar.gz && \ + tar -xzf amxmodx-base.tar.gz -C /opt/steam/hlds/valve/ && \ + rm amxmodx-base.tar.gz && \ + echo 'linux addons/amxmodx/dlls/amxmodx_mm_i386.so' >> /opt/steam/hlds/valve/addons/metamod/plugins.ini + +# Copy maps to AMX config RUN cat /opt/steam/hlds/valve/mapcycle.txt >> /opt/steam/hlds/valve/addons/amxmodx/configs/maps.ini -# Install dproto -RUN mkdir -p /opt/steam/hlds/valve/addons/dproto -COPY lib/dproto/bin/Linux/dproto_i386.so /opt/steam/hlds/valve/addons/dproto/dproto_i386.so -COPY lib/dproto/dproto.cfg /opt/steam/hlds/valve/dproto.cfg -RUN echo 'linux addons/dproto/dproto_i386.so' >> /opt/steam/hlds/valve/addons/metamod/plugins.ini -COPY lib/dproto/amxx/* /opt/steam/hlds/valve/addons/amxmodx/scripting/ +# Copy custom configuration files +COPY server.cfg /opt/steam/hlds/valve/server.cfg +COPY mapcycle.txt /opt/steam/hlds/valve/mapcycle.txt +COPY motd.txt /opt/steam/hlds/valve/motd.txt +COPY roundstart.cfg /opt/steam/hlds/valve/roundstart.cfg -# Install bind_key -COPY lib/bind_key/amxx/bind_key.amxx /opt/steam/hlds/valve/addons/amxmodx/plugins/bind_key.amxx -RUN echo 'bind_key.amxx ; binds keys for voting' >> /opt/steam/hlds/valve/addons/amxmodx/configs/plugins.ini +# Fix error that steamclient.so is missing +RUN mkdir -p /home/steam/.steam && \ + ln -s /opt/steam/hlds/linux32 /home/steam/.steam/sdk32 +# Fix warnings for missing config files +RUN touch /opt/steam/hlds/valve/listip.cfg && \ + touch /opt/steam/hlds/valve/banned.cfg + +# Create steam_appid.txt +RUN echo 70 > /opt/steam/hlds/steam_appid.txt + +# Copy and setup startup script +COPY start-server.sh /start-server.sh +RUN chmod +x /start-server.sh && \ + chown steam:steam /start-server.sh + +# Change ownership +RUN chown -R steam:steam /opt/steam + +# Switch to steam user +USER steam + +# Set working directory WORKDIR /opt/steam/hlds -# Copy default config -COPY valve valve +# Expose ports +EXPOSE 27015/tcp 27015/udp -RUN chmod +x hlds_run hlds_linux - -RUN echo 70 > steam_appid.txt - -EXPOSE 27015 -EXPOSE 27015/udp - -# Start server -ENTRYPOINT ["./hlds_run", "-timeout 3", "-pingboost 1"] - -# Default start parameters -CMD ["+map crossfire", "+rcon_password 12345678"] +# Set entrypoint +ENTRYPOINT ["/start-server.sh"] diff --git a/README.md b/README.md index abbf47b..a0a3133 100644 --- a/README.md +++ b/README.md @@ -8,92 +8,153 @@ ![banner](banner.png) - -# HLDS Docker dproto(47/48 Steam+noSteam) - Crossfire 24/7 +# HLDS Docker - Crossfire 24/7 ## Half-Life Dedicated Server as a Docker image Probably the fastest and easiest way to set up an old-school Half-Life -Deathmatch Dedicated Server (HLDS).
-Both Steam and noSteam, old and new half-life clients can connect and play together!
-You don't need to know anything about Linux or HLDS to start a server. You just need Docker and -this image. +Deathmatch Dedicated Server (HLDS) running Crossfire map 24/7 with 15-minute rounds. -## Repository +You don't need to know anything about Linux or HLDS to start a server. You just need Docker and this image. -This project is a fork of: [artkirienko/hlds-docker-dproto](https://github.com/artkirienko/hlds-docker-dproto) +## Features + +✅ **Included:** +- 15-minute rounds with automatic map cycling +- Crossfire map only +- Customizable server settings via `.env` +- Auto-restart on crash +- **MetaMod + AMX Mod X 1.9 installed** +- Built-in `timeleft` command (type in chat to see remaining time) +- Admin commands ready ## Quick Start -#### Docker Hub Image +#### Docker Hub Image (Recommended) -The latest image of this repo is available in docker hub [josejsalinas/hl-server](https://hub.docker.com/r/josejsalinas/hl-server) 🐋 +The latest image of this repo is available in docker hub [josejsalinas/hl-server](https://hub.docker.com/r/josejsalinas/hl-server) ```bash -# To quickly run the image -docker run -it --rm -d --name hl-server -p27015:27015 -p27015:27015/udp josejsalinas/hl-server +map crossfire +maxplayers 12 +docker run -d --name hl-server \ + -p 27015:27015 \ + -p 27015:27015/udp \ + -e SERVER_NAME="My Crossfire Server" \ + -e MAX_PLAYERS=16 \ + -e RCON_PASSWORD=changeme \ + josejsalinas/hl-server:latest ``` -#### Locally +Or use docker compose with the hub image by creating a `docker-compose.yml`: -Build the image `hl-server`: +```yaml +services: + halflife: + image: hl-server:latest + container_name: halflife-server + restart: unless-stopped + ports: + - "27015:27015/tcp" + - "27015:27015/udp" + environment: + - SERVER_NAME=${SERVER_NAME:-Half-Life Crossfire Server} + - MAX_PLAYERS=${MAX_PLAYERS:-16} + - SERVER_PASSWORD=${SERVER_PASSWORD:-} + - RCON_PASSWORD=${RCON_PASSWORD:-changeme} + - WELCOME_MESSAGE=${WELCOME_MESSAGE:-Welcome to Crossfire!} +``` + +#### Build Locally + +Build the image yourself: ```bash -docker build -t hl-server . +docker compose build ``` -Run your image +Run your server: ```bash -docker run -it --rm -d --name hl-server -p27015:27015 -p27015:27015/udp +docker compose up -d ``` -You can add extra parameters when starting the image +That's it! Your server is now running on port 27015. + +## Configuration + +Edit the `.env` file to customize your server: + ```bash -docker run -it --rm --name hl-server -p27015:27015 -p27015:27015/udp hl-server +map crossfire +maxplayers 16 +password 1 +sv_password "password" +cp .env.example .env +nano .env ``` -> **Note:** Any [server config command](http://sr-team.clan.su/K_stat/hlcommandsfull.html) - can be passed by using `+` after the docker command options. +| Variable | Description | Default | +|----------|-------------|---------| +| `SERVER_NAME` | Server name shown in server browser | Half-Life Crossfire Server | +| `MAX_PLAYERS` | Maximum number of players | 16 | +| `SERVER_PASSWORD` | Password to join server (leave empty for public) | (empty) | +| `RCON_PASSWORD` | RCON admin password | changeme | +| `WELCOME_MESSAGE` | Message shown when players join | Welcome to Crossfire! Fight until the last player stands! | - #### Customization +### Example Configuration - Adjust things as you like in `default.cfg` file to set them to your liking. - Like `hostname` to set your server name, or `sv_password` to set a password. +```env +SERVER_NAME=My Awesome Crossfire Server +MAX_PLAYERS=20 +SERVER_PASSWORD=secret123 +RCON_PASSWORD=adminpass456 +WELCOME_MESSAGE=Welcome! 15-minute Crossfire rounds! +``` ## What is included -* [HLDS Build](https://github.com/DevilBoy-eXe/hlds) `7882`. This is the last - known version that is compatible with last version of **dproto** that's `0.9.582` +* [HLDS Build](https://github.com/EXORTEM/hlds) `7882`. Stable version compatible with MetaMod and AMX Mod X. ``` - Protocol version 47/48 + Protocol version 48 Exe version 1.1.2.2/Stdio (valve) Exe build: 17:23:32 May 24 2018 (7882) ``` -* [Metamod-p](https://github.com/Bots-United/metamod-p) version `1.21p38` +* [Metamod-P](https://github.com/Bots-United/metamod-p) version `1.21p38` -* [AMX Mod X](https://github.com/alliedmodders/amxmodx) version `1.8.2` +* [AMX Mod X](https://www.amxmodx.org/) version `1.9` (latest stable) -* **dproto** version `0.9.582`. This is the last version of **dproto**, - the project is abandoned. +* Minimal config with 15-minute rounds and Crossfire map only -* Patched list of master servers (official and unofficial master servers - included), so your game server appear in game server browser of all the clients - -* Minimal config present, such as `mp_timelimit` and mapcycle +* Customizable via environment variables ## Default mapcycle - crossfire 24/7 -* crossfire - +* crossfireS ## Advanced -In order to use a custom server config file, add your settings -to `valve/config/server.cfg` of this project and mount the directory as volume -to `/opt/steam/hlds/valve/config` by running: +### Custom Server Configuration +In order to use additional custom settings, you can modify `server.cfg` before building, or: + +1. Enter the running container: ```bash -# Using docker hub image -docker run -it --rm -d -p27015:27015 -p27015:27015/udp -v $(pwd)/valve/config:/opt/steam/hlds/valve/config josejsalinas/hl-server +docker exec -it halflife-server bash ``` + +2. Edit the config: +```bash +nano /opt/steam/hlds/valve/server.cfg +``` + +3. Restart the server: +```bash +docker compose restart +``` + +## Notes + +- The server uses HLDS build 7882 for better compatibility with AMX Mod X +- Round duration is set to 15 minutes +- Only the Crossfire map is in rotation +- Server automatically restarts on crash + +## License + +This configuration is provided as-is for running Half-Life dedicated servers. +Half-Life is a trademark of Valve Corporation. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6a49d36 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +services: + halflife: + build: . + image: hl-server:latest + container_name: halflife-server + restart: unless-stopped + ports: + - "27015:27015/tcp" + - "27015:27015/udp" + environment: + - SERVER_NAME=${SERVER_NAME:-Half-Life Crossfire Server} + - MAX_PLAYERS=${MAX_PLAYERS:-16} + - SERVER_PASSWORD=${SERVER_PASSWORD:-} + - RCON_PASSWORD=${RCON_PASSWORD:-changeme} + - WELCOME_MESSAGE=${WELCOME_MESSAGE:-Welcome to Crossfire! Fight until the last player stands!} + - STEAM_0AUTH=1 + # Uncomment to persist server data (logs, stats, etc) + # volumes: + # - ./server_data:/hlds/valve + stdin_open: true + tty: true diff --git a/lib/bind_key/amxx/bind_key.amxx b/lib/bind_key/amxx/bind_key.amxx deleted file mode 100644 index 23f2417..0000000 Binary files a/lib/bind_key/amxx/bind_key.amxx and /dev/null differ diff --git a/lib/bind_key/amxx/bind_key.sma b/lib/bind_key/amxx/bind_key.sma deleted file mode 100644 index 1f0d1cf..0000000 --- a/lib/bind_key/amxx/bind_key.sma +++ /dev/null @@ -1,35 +0,0 @@ -#include - -public plugin_init() { - register_plugin( "Bind key", "1.0", "Arvy" ) - set_task(1.0, "setDefault", 0, "", 0, "b") -} - -stock client_cmd_ex(id, const command[], any:...) -{ - if (id == 0 || is_user_connected(id)) - { - new szMessage[256] - - format_args(szMessage, charsmax(szMessage), 1) - - message_begin(id == 0 ? MSG_ALL : MSG_ONE, 51, _, id) - write_byte(strlen(szMessage) + 2) - write_byte(10) - write_string(szMessage) - message_end() - } -} - -public setDefault() { - client_cmd_ex(0, "bind ^"1^" ^"slot1^"") - client_cmd_ex(0, "bind ^"2^" ^"slot2^"") - client_cmd_ex(0, "bind ^"3^" ^"slot3^"") - client_cmd_ex(0, "bind ^"4^" ^"slot4^"") - client_cmd_ex(0, "bind ^"5^" ^"slot5^"") - client_cmd_ex(0, "bind ^"6^" ^"slot6^"") - client_cmd_ex(0, "bind ^"7^" ^"slot7^"") - client_cmd_ex(0, "bind ^"8^" ^"slot8^"") - client_cmd_ex(0, "bind ^"9^" ^"slot9^"") - client_cmd_ex(0, "bind ^"0^" ^"slot10^"") -} diff --git a/lib/dproto/Readme.txt b/lib/dproto/Readme.txt deleted file mode 100644 index 5a8a5ce..0000000 --- a/lib/dproto/Readme.txt +++ /dev/null @@ -1,107 +0,0 @@ -dproto is a plugin for metamod that allows p.47 and 48 no-steam clients to join the hlds-based server. - -CURRENT VERSION: 0.9.582 -For more information and updates please check http://cs.rin.ru/forum/viewtopic.php?f=29&t=55986 - -ARCHIVE CONTAINS: - bin directory - Binaries (libraries) for linux and windows. - amxx directory - some AmxModX plugins that uses dproto functionality - dproto.cfg - dproto configuration file. - Readme.txt - This file. - -REQUIREMENTS: - - clean (unpatched) engine files (swds.dll for windows; engine_i686.so for linux) - - metamod 1.19 or 1.19p32 or higher - - currently supported builds are all p48 engines for windows and linux - -INSTALLATION: - 1. Go to /addons/ and make new directory named dproto - - it is a game directory; cstrike for Counter-Strike, valve for Half-Life, etc - 2. Copy dproto.dll or dproto_i386.so to /addons/dproto/ - 3. Go to metamod installation directory (usually its /addons/metamod/) and edit plugins.ini: - add this line for windows - win32 addons\dproto\dproto.dll - or this for linux - linux addons/dproto/dproto_i386.so - at the beginning of the file - 4. Copy dproto.cfg to server root or gamedir. - 5. Start the server. You should use this command on linux: - ./hlds_run -binary ./hlds_i686 - - when server loads, type "meta list" in console. You'll see something like this: - Currently loaded plugins: - description stat pend file vers src load unlod - [ 1] dproto RUN - dproto_i386.so v0.9.582 ini Start Never - [ 2] AMX Mod X RUN - amxmodx_mm_i386. v1.8.1.3 ini Start ANY - 2 plugins, 2 running - 6. If status is not "RUN", start server with "+log on +mp_logecho 1" parameters and look through console output. In 99% cases you'll find reason there. - 7. Installation of AmxModX plugins from amxx directory is not necessary. - -HOW TO CHANGE STEAMIDS OF CLIENTS - Use cid* options in AUTHID MANAGEMENT section of dproto.cfg - For example, if you want to assign steamids generated by IP for p47 clients that not support unique id generation, you should set: - cid_NoSteam47 = 3 for assigning STEAM_x:y:z steamid to these clients - cid_NoSteam47 = 4 for assigning VALVE_x:y:z steamid to these clients - - If you want to drop these clients, just set clientid to 5: - cid_NoSteam47 = 5 - And all p47 clients without emulators will be dropped with message that you can customize (see next section). - -HOW TO CHANGE REJECT MESSAGES WHEN CLIENTID IS 5 (DEPRECATED) - This could be done using these cvars: - dp_rejmsg_steam for legit steam (cid_Steam) clients - dp_rejmsg_nosteam47 for no-steam p47 (cid_NoSteam47) clients - dp_rejmsg_nosteam48 for no-steam p48 (cid_NoSteam48) clients - dp_rejmsg_hltv for HLTV (cid_HLTV) clients - dp_rejmsg_pending for unathorized (cid_cid_SteamPending) clients - dp_rejmsg_revemu for revEmu (>= 9.74 && <= 9.82) clients - dp_rejmsg_steamemu for steamEmu clients - dp_rejmsg_oldrevemu for old revEmu clients (< 9.74) - dp_rejmsg_avsmp for AVSMP clients - dp_rejmsg_revemu_sc2009 for revEmu (>9.82) and SteamClient2009 clients - dp_rejmsg_sxei for clients with sXe Injected if EnableSXEIdGeneration is set to 1 - dp_rejmsg_revemu2013 for revEmu 2013 clients - - Just put message to them and it will be displayed for rejected clients. - - Example, a part of server.cfg: - dp_rejmsg_nosteam47 "Sorry, you're using old client, download a new one and come back ;)" - -HOW TO GET CLIENT PROTOCOL IN AMXX: - check the amxx/dp_test.sma. This is sample plugin that outputs protocol number when client connecting. - NOTE: this is _sample_ plugin and its installation is not necessary. - -USEFUL COMMANDS/CVARS: - dp_ipsessions (command) - lists active connectionless sessions and info about them. - dp_secplrinfo (command) - lists active players with some boolean options: U = Slot is used; A = Active network client; P = passed fakeplayer check; - dp_lastthreats (command) - lists last threats. - dp_heapinfo (command) - writes internal heap usage to /mem.txt. - dp_log_msgoverflows (cvar) - enables/disables dumping contents of messages on overflow. - -THANKS TO: - Armind for testing, bugreporting; - AlexALX for testing; - bDy for testing on FreeBSD; - Co6aka for tesing; - Dark-Master for testing, bugreporting; - debugger_perm for original idea and testing; - DrilLer for testing, bugreporting; - GoD2.0 for redirection fix idea; - gromo for testing, bugreporting; - ineya for Hybrid serverinfo trick; - jamess for "deprecated" id idea; - La_Vladimir for testing, bugreporting; - Lev (aka Flasher) for help and testing; - P4rD0nM3 for testing, bugreporting; - Shidla for testing; - SISA for hard testing of eST support and deprecated clientids; - **$n@!ke** for testing, hlstats fix idea; - Asmodai for help with commands order; - Chuvi for voice init solution; - PRoSToTeM@ for deltas processing bugfix, user info filtering and other good ideas; - S0m3Th1nG_AwFul for testing, bugreporting; - coolman for testing, bugreporting; - Sanlerus (aka Freedo.m) for reproducing bug with hanging clients and testing - Valve for good games ;) - All people from this (http://cs.rin.ru/forum/viewtopic.php?f=10&t=50689) thread - And all other people whom I forgot diff --git a/lib/dproto/amxx/dp_test.sma b/lib/dproto/amxx/dp_test.sma deleted file mode 100644 index ce02ba4..0000000 --- a/lib/dproto/amxx/dp_test.sma +++ /dev/null @@ -1,116 +0,0 @@ -/* - This sample plugin shows how to get information about client's protocol and Steam ID. (plugin will write this info when client connecting) - - It works only with dproto >= 0.4.4 - -*/ - -#include -#include - - -#define DP_AUTH_NONE 0 -#define DP_AUTH_DPROTO 1 -#define DP_AUTH_STEAM 2 -#define DP_AUTH_STEAMEMU 3 -#define DP_AUTH_REVEMU 4 -#define DP_AUTH_OLDREVEMU 5 -#define DP_AUTH_HLTV 6 -#define DP_AUTH_SC2009 7 -#define DP_AUTH_AVSMP 8 -#define DP_AUTH_SXEI 9 -#define DP_AUTH_REVEMU2013 10 -#define DP_AUTH_SSE3 11 - - -// -// pointers to dp_r_protocol and dp_r_id_provider cvars -// dproto will store information in these cvars - -new pcv_dp_r_protocol -new pcv_dp_r_id_provider - -public plugin_init() -{ - register_plugin("dproto testing", "1", "") - - // - // Initialize cvar pointers - // - pcv_dp_r_protocol = get_cvar_pointer ("dp_r_protocol") - pcv_dp_r_id_provider = get_cvar_pointer ("dp_r_id_provider") - -} - -public client_connect(id) -{ - if (!pcv_dp_r_protocol || !pcv_dp_r_id_provider) - { - log_amx ("cant find dp_r_protocol or dp_r_id_provider cvars") - return PLUGIN_HANDLED - } - - /* - The "dp_clientinfo" command are exported by dproto. The syntax is: - dp_clientinfo - where id is slot index (1 to 32) - After executing this command dproto will set dp_r_protocol and dp_r_id_provider cvars. - The dp_r_protocol keeps client's protocol - The dp_r_id_provider cvar will be set to: - 1: if client's steam id assigned by dproto (player uses no-steam client without emulator) - 2: if client's steam id assigned by native steam library (or by another soft that emulates this library, server-side revEmu for example) - 3: if client's steam id assigned by dproto's SteamEmu emulator - 4: if client's steam id assigned by dproto's revEmu emulator - 5: if client's steam id assigned by dproto's old revEmu emulator - 6: if client is HLTV - 7: if client's steam id assigned by dproto's SC2009 emulator - 8: if client's steam id assigned by dproto's AVSMP emulator - 9: if client's steam id assigned by SXEI's *HID userinfo field - 10: if client's steam id assigned by dproto's revEmu2013 emulator - 11: if client's steam id assigned by dproto's SmartSteamEmu emulator - - If slot is empty, both dp_r_protocol and dp_r_id_provider cvars will be set to 0 - If slot is invalid (id < 1 or id > max players), both dp_r_protocol and dp_r_id_provider cvars will be set to -1 - */ - - // - // add command to queue - // - server_cmd("dp_clientinfo %d", id) - - // - // make server to execute all queued commands - // - server_exec() - - // - // now parse cvar values - // - new proto = get_pcvar_num(pcv_dp_r_protocol) - new authprov = get_pcvar_num(pcv_dp_r_id_provider) - new auth_prov_str[32] - new user_name[33] - - switch (authprov) - { - case DP_AUTH_NONE: copy(auth_prov_str, 32, "N/A") //slot is free - case DP_AUTH_DPROTO: copy(auth_prov_str, 32, "dproto") - case DP_AUTH_STEAM: copy(auth_prov_str, 32, "Steam(Native)") - case DP_AUTH_STEAMEMU: copy(auth_prov_str, 32, "SteamEmu") - case DP_AUTH_REVEMU: copy(auth_prov_str, 32, "revEmu") - case DP_AUTH_OLDREVEMU: copy(auth_prov_str, 32, "old revEmu") - case DP_AUTH_HLTV: copy(auth_prov_str, 32, "HLTV") - case DP_AUTH_SC2009: copy(auth_prov_str, 32, "SteamClient2009") - case DP_AUTH_AVSMP: copy(auth_prov_str, 32, "AVSMP") - case DP_AUTH_SXEI: copy(auth_prov_str, 32, "SXEI") - case DP_AUTH_REVEMU2013: copy(auth_prov_str, 32, "RevEmu2013") - case DP_AUTH_SSE3: copy(auth_prov_str, 32, "SSE3") - default: copy(auth_prov_str, 32, "Erroneous") //-1 if slot id is invalid - } - - get_user_name (id, user_name, 33) - - server_print("User %s (%d) uses protocol %d; SteamID assigned by %s", user_name, id, proto, auth_prov_str) - - return PLUGIN_HANDLED -} diff --git a/lib/dproto/amxx/updatehint.sma b/lib/dproto/amxx/updatehint.sma deleted file mode 100644 index 2db1005..0000000 --- a/lib/dproto/amxx/updatehint.sma +++ /dev/null @@ -1,206 +0,0 @@ -/* AMXModX Script -* -* Title: Update Client Hint -* Author: Lev/Crock -* -* Changelog: -* -* 23.03.2010 -* - Added HLTV recognition -* -* 04.08.2010 -* - Added new emulators support (AVSMP, SC2009) -* -* 19.10.2010 -* - Fixed AVSMP and SteamClient2009 support -* -* 07.08.2013 -* - Added sXeI support -* - Added RevEmu2013 support -* -* 11.04.2015 -* - Added SmartSteamEmu support -* -*/ - -#pragma semicolon 1 -#pragma ctrlchar '\' - -#include -#include -#include -#include -#include - -#define DP_AUTH_NONE 0 // "N/A" - slot is free -#define DP_AUTH_DPROTO 1 // dproto -#define DP_AUTH_STEAM 2 // Native Steam -#define DP_AUTH_STEAMEMU 3 // SteamEmu -#define DP_AUTH_REVEMU 4 // RevEmu -#define DP_AUTH_OLDREVEMU 5 // Old RevEmu -#define DP_AUTH_HLTV 6 // HLTV -#define DP_AUTH_SC2009 7 // SteamClient 2009 -#define DP_AUTH_AVSMP 8 // AVSMP -#define DP_AUTH_SXEI 9 // sXe Injected -#define DP_AUTH_REVEMU2013 10 // RevEmu 2013 -#define DP_AUTH_SSE3 11 // SmartSteamEmu - -new const PLUGIN[] = "UpdateHint"; -new const VERSION[] = "1.3"; -new const AUTHOR[] = "Lev"; - -const BASE_TASK_ID_HINT = 3677; // random number -const BASE_TASK_ID_KICK = 6724; // random number -const MIN_SHOW_INTERVAL = 20; // minimum constrain for hint show interval -const MAX_URL_LENGTH = 70; // max length of the URL - -new bool:playerPutOrAuth[33]; // Player was put in server or auth. - -new pcvar_uh_url; -new pcvar_uh_interval; -new pcvar_uh_kickinterval; -new pcvar_dp_r_protocol; -new pcvar_dp_r_id_provider; - -public plugin_init() -{ - register_plugin(PLUGIN, VERSION, AUTHOR); - register_cvar("updatehint", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED); - - register_dictionary("updatehint.txt"); - - pcvar_uh_url = register_cvar("uh_url", "http://some.addr/somefile"); // URL where player can goto to download new client. - pcvar_uh_interval = register_cvar("uh_interval", "60.0"); // Interval between hint shows. - pcvar_uh_kickinterval = register_cvar("uh_kickinterval", "0"); // Interval bwfoew kick client. - pcvar_dp_r_protocol = get_cvar_pointer ("dp_r_protocol"); // Dproto interface. - pcvar_dp_r_id_provider = get_cvar_pointer ("dp_r_id_provider"); // Dproto interface. -} - -public client_connect(id) -{ - playerPutOrAuth[id] = false; -} - -public client_authorized(id) -{ - if (playerPutOrAuth[id]) - { - return check_client_type(id); - } - playerPutOrAuth[id] = true; - return PLUGIN_CONTINUE; -} - -public client_putinserver(id) -{ - if (playerPutOrAuth[id]) - { - return check_client_type(id); - } - playerPutOrAuth[id] = true; - return PLUGIN_CONTINUE; -} - -stock NeedShowUpdateMsg(proto, authprov) { - if (authprov == DP_AUTH_HLTV) - return false; - - if (proto < 48) - return true; - - if (authprov == DP_AUTH_STEAM || - authprov == DP_AUTH_REVEMU || - authprov == DP_AUTH_SC2009 || - authprov == DP_AUTH_AVSMP || - authprov == DP_AUTH_SXEI || - authprov == DP_AUTH_REVEMU2013 || - authprov == DP_AUTH_SSE3) - return false; - - return true; -} - -check_client_type(id) -{ - if (!pcvar_dp_r_protocol || !pcvar_dp_r_id_provider) - return PLUGIN_CONTINUE; - - server_cmd("dp_clientinfo %d", id); - server_exec(); - - new proto = get_pcvar_num(pcvar_dp_r_protocol); - new authprov = get_pcvar_num(pcvar_dp_r_id_provider); - - switch(authprov) - { - case DP_AUTH_DPROTO: - console_print(0, "Protocol: %d, authprovider: %s", proto, "DPROTO"); - case DP_AUTH_STEAM: - console_print(0, "Protocol: %d, authprovider: %s", proto, "STEAM"); - case DP_AUTH_REVEMU: - console_print(0, "Protocol: %d, authprovider: %s", proto, "REVEMU"); - case DP_AUTH_STEAMEMU: - console_print(0, "Protocol: %d, authprovider: %s", proto, "STEAMEMU"); - case DP_AUTH_OLDREVEMU: - console_print(0, "Protocol: %d, authprovider: %s", proto, "OLDREVEMU"); - case DP_AUTH_HLTV: - console_print(0, "Protocol: %d, authprovider: %s", proto, "HLTV"); - case DP_AUTH_SC2009: - console_print(0, "Protocol: %d, authprovider: %s", proto, "SteamClient2009/revEmu"); - case DP_AUTH_AVSMP: - console_print(0, "Protocol: %d, authprovider: %s", proto, "AVSMP"); - case DP_AUTH_SXEI: - console_print(0, "Protocol: %d, authprovider: %s", proto, "SXEI"); - case DP_AUTH_REVEMU2013: - console_print(0, "Protocol: %d, authprovider: %s", proto, "REVEMU2013"); - case DP_AUTH_SSE3: - console_print(0, "Protocol: %d, authprovider: %s", proto, "SSE3"); - } - - if (NeedShowUpdateMsg(proto, authprov)) - { - set_task(get_uh_interval(), "show_update_hint", BASE_TASK_ID_HINT + id, _, _, "b"); - new kick_interval = get_pcvar_num(pcvar_uh_kickinterval); - if (kick_interval > 0) - set_task(float(kick_interval), "kick_client", BASE_TASK_ID_KICK + id); - } - - return PLUGIN_CONTINUE; -} - -public client_disconnect(id) -{ - remove_task(BASE_TASK_ID_HINT + id); - remove_task(BASE_TASK_ID_KICK + id); -} - -Float:get_uh_interval() -{ - new interval = get_pcvar_num(pcvar_uh_interval); - // Check to be no less then minimum value - return float((interval < MIN_SHOW_INTERVAL ) ? MIN_SHOW_INTERVAL : interval); -} - -public show_update_hint(id) -{ - id -= BASE_TASK_ID_HINT; - if (0 > id || id > 31) - return; - new url[MAX_URL_LENGTH]; - get_pcvar_string(pcvar_uh_url, url, charsmax(url)); - set_hudmessage(255, 100, 100, -1.0, 0.35, 0, 3.0, 5.0, 0.1, 0.1, 4); - show_hudmessage(id, "%L", id, "HUDHINT"); - client_print(id, print_chat, "%L", id, "CHATHINT", url); -} - -public kick_client(id) -{ - id -= BASE_TASK_ID_KICK; - if (0 > id || id > 31) - return; - new url[MAX_URL_LENGTH]; - get_pcvar_string(pcvar_uh_url, url, charsmax(url)); - client_print(id, print_chat, "%L", id, "CHATHINT", url); - new userid = get_user_userid(id); - server_cmd("kick #%d \"%L\"", userid, id, "HUDHINT"); -} diff --git a/lib/dproto/amxx/updatehint.txt b/lib/dproto/amxx/updatehint.txt deleted file mode 100644 index 9841c65..0000000 --- a/lib/dproto/amxx/updatehint.txt +++ /dev/null @@ -1,7 +0,0 @@ -[en] -HUDHINT = Your client is outdated. Check chat and console for download URL. -CHATHINT = Download new client @ %s - -[ru] -HUDHINT = TBOU KJIUEHT YCTAPEJI. CMOTPU CCbIJIKY B 4ATE U B KOHCOJIU. -CHATHINT = Cka4au HoBbIU kJIUHT TYT: %s diff --git a/lib/dproto/bin/Linux/dproto_i386.so b/lib/dproto/bin/Linux/dproto_i386.so deleted file mode 100644 index 0861c61..0000000 Binary files a/lib/dproto/bin/Linux/dproto_i386.so and /dev/null differ diff --git a/lib/dproto/bin/Windows/dproto.dll b/lib/dproto/bin/Windows/dproto.dll deleted file mode 100644 index 7082200..0000000 Binary files a/lib/dproto/bin/Windows/dproto.dll and /dev/null differ diff --git a/lib/dproto/dproto.cfg b/lib/dproto/dproto.cfg deleted file mode 100644 index 2a36da6..0000000 --- a/lib/dproto/dproto.cfg +++ /dev/null @@ -1,252 +0,0 @@ -# ======================================================== -# DPROTO CONFIGURATION -# ======================================================== - -# -# General rule for modifying this file: -# DONT CHANGE ANYTHING IF YOU DONT KNOW WHAT IT MEANS! -# - - -# ======================================================== -# AUTHID MANAGEMENT -# ======================================================== - -# ClientID types (for cid_* options) -# 1: Real (or generated by HW) steam (STEAM_xx:xx:xx) -# 2: Real (or generated by HW) valve (VALVE_xx:xx:xx) -# 3: STEAM_ by IP -# 4: VALVE_ by IP -# 5: Deprecated - client will be rejected -# 6: reserved for future use -# 7: HLTV -# 8: STEAM_ID_LAN -# 9: STEAM_ID_PENDING -# 10: VALVE_ID_LAN -# 11: VALVE_ID_PENDING -# 12: STEAM_666:88:666 - -# Use these options to set authid's for clients - -# for HLTV (default is HLTV [7]) -cid_HLTV = 7 - -# for p.47 clients that do not support unique id generation (default is VALVE_ by IP [4]) -cid_NoSteam47 = 4 - -# for p.48 clients that do not support unique id generation (default is VALVE_ by IP [4]) -cid_NoSteam48 = 4 - -# For Legit Steam clients (default is real STEAM_xx:xx:xx [1]) -cid_Steam = 1 - -# Client recognized as pending when they sucessfully authorized, but did not get steam id -# REMARK: Actually, it got steamid, but it is useless (STEAM_0:0:0 for example) -# default is STEAM_ID_PENDING [9] -cid_SteamPending = 9 - -# For players having revEmu ( >= 9.74) on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_RevEmu = 1 - -# For players having RevEmu 2013 on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_RevEmu2013 = 1 - -# For players having SteamClient 2009 / revEmu > 9.82 on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_SC2009 = 1 - -# For players having old revEmu on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_OldRevEmu = 1 - -# For players having hCupa's SteamEmu on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_SteamEmu = 1 - -# For players having AVSMP (Cracked Steam) on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_AVSMP = 1 - -# For players having SmartSteamEmu > 1.2.4 on client-side: -# default is real STEAM_xx:xx:xx [1] -cid_SSE3 = 1 - -# For SETTI ServerScanner -# default is STEAM_xx:xx:xx generated by IP [3] -cid_Setti = 3 - -# For SXEI Clients -# default is real STEAM_xx:xx:xx [1] -cid_SXEI = 1 - -# EnableSXEIdGeneration (0 / 1) -# Turns on steamid generation based on info sent by sXeI client -# Enable this only if you have sXeI server installed! -EnableSXEIdGeneration = 0 - -# SC2009_RevCompatMode (0 / 1) -# Enable fix to make steamids generated for SC2009 compatible with revEmu -SC2009_RevCompatMode = 1 - -# SteamEmuCompatMode (0 / 1) -# An analog for eSTEAMATiON's EnforceSteamEmuCompatIDMode option. -# Affects only Old RevEmu and SteamEmu emulators. -SteamEmuCompatMode = 1 - -# OldEstCompatMode (0 / 1) -# Enables/Disables fix for steamids generated by eST in 0.3.1 version. -# Set this to 1 if you want to make steamids generated by eST as in < 0.3.0 versions. -OldEstCompatMode = 0 - -# SteamIdHashSalt (string) -# Salt string for SteamIDs hashing. Irreversibly changes SteamIDs. Applies only to SteamIDs generated by emulators. -# Should be more than 16 chars length. If string is empty, hashing is not applied. -SteamIdHashSalt = - -# IPGen_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by IP -IPGen_Prefix1 = 0 - -# IPGen_Prefix2 (int) -# STEAM_a:b:c -# second prefix (b) for authids generated by IP -IPGen_Prefix2 = 4 - -# Native_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by native auth method (Steam) -Native_Prefix1 = 0; - -# SC2009_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by Steamclient 2009 -SC2009_Prefix1 = 0; - -# RevEmu_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by RevEmu -RevEmu_Prefix1 = 0; - -# RevEmu2013_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by RevEmu2013 -RevEmu2013_Prefix1 = 0; - -# OldRevEmu_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by old RevEmu -OldRevEmu_Prefix1 = 0; - -# SteamEmu_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids generated by SteamEmu -SteamEmu_Prefix1 = 0; - -# AVSMP_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids assigned for AVSMP clients (Cracked steam) -AVSMP_Prefix1 = 0; - -# SSE3_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids assigned for SSE3 -SSE3_Prefix1 = 0; - -# Setti_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids assigned for Setti server scanner -Setti_Prefix1 = 0; - -# SXEI_Prefix1 (int) -# STEAM_a:b:c -# first prefix (a) for authids assigned for sXeI clients -SXEI_Prefix1 = 0; - - -# Note that banid will use steamid WITHOUT any prefixes! - - -# ======================================================== -# ATTACKS SUPRESSION -# ======================================================== - -# FakePlayers_AntiReconnect (0/1) -# Enables detection of fakeplayers that reconnects quickly (every < 10 seconds) -# before fake players checks have completed. -# Default is 1 (ON). -FakePlayers_AntiReconnect = 1 - -# FakePlayers_BanTime (minutes) -# Dproto will ban IP spamming fakeplayers for time (in minutes) specified in this variable -# Default is 120 minutes. -# Use 0 for permanent ban. -# Use negative vaules to disable ban (fake players will only be kicked). -FakePlayers_BanTime = 120 - -# Exploits_CheckDownloads (0/1) -# Enable checking of requested download files against precached resources. -# Default is 1 (ON). -Exploits_CheckDownloads = 1 - -# Exploits_DisableUploads (0/1) -# Disable file uploads (not customizations) to the server. -# Default is 1 (ON). -Exploits_DisableUploads = 1 - - -# ======================================================== -# OTHER STUFF -# ======================================================== - -# LoggingMode: -# 0 = None -# 1 = Console -# 2 = Log Files -# 3 = Both -LoggingMode = 2 - -# ThreatsLoggingMode (0/1) -# Enable logging of threats details. -# Default is 0 (OFF). -ThreatsLoggingMode = 0 - -# DisableNativeAuth (0/1) -# Disables valve/steam auth system. -# For p.47 Based: Server will not connect to auth servers. -# For All: Server will not call authorization functions. -# This is a fix for startup freeze for old (p.47) servers. -DisableNativeAuth = 0 - -# ServerInfoAnswerType (0/1/2) -# Sets server answer type for query requests -# 0 = New style (Source Engine) -# 1 = Old Style (Fix favorites list for p.47 clients) -# 2 = Hybrid mode (Old Style sent first) -# Default is 0 (Source Engine). -ServerInfoAnswerType = 0 - -# Game_Name (string) -# Sets game name displayed for clients -# If Game_Name is empty, native game name will be used -Game_Name = - -# Enables fix for proper player id displaying on HLStats server monitoring -# Enable this only if you have HLStats -HLStatsPlayerIdFix = 0 - -# Enables spreading of user setinfo topcolor and bottomcolor settings. -# Disable this if mod doesn't support coloring of player models. -SpreadUserInfoColors = 1 - -# ExportVersion (0/1) -# Enables/Disables exporting of dp_version cvar -# 1 = dp_version cvar will be exported to server rules. It will be visible in server monitoring tools (like HLSW) -# 0 = dp_version cvar will not be exported to server rules. -ExportVersion = 1 - -# HLTVExcept_IP (ip addr) -# HLTV from this IP will be able to join the server even if cid_HLTV is set to 5 (deprecated) -HLTVExcept_IP = 127.0.0.1 diff --git a/lib/hlds.install b/lib/hlds.install deleted file mode 100644 index a56ccfd..0000000 --- a/lib/hlds.install +++ /dev/null @@ -1,8 +0,0 @@ -login anonymous -force_install_dir ./hlds -app_set_config 90 mod valve -app_update 90 -app_update 90 -app_update 90 validate -app_update 90 validate -quit diff --git a/mapcycle.txt b/mapcycle.txt new file mode 100644 index 0000000..b94665a --- /dev/null +++ b/mapcycle.txt @@ -0,0 +1 @@ +crossfire diff --git a/motd.txt b/motd.txt new file mode 100644 index 0000000..3d7e656 --- /dev/null +++ b/motd.txt @@ -0,0 +1,10 @@ +========================================= + + WELCOME TO THE SERVER! + + Map: Crossfire Only + Round Time: 15 Minutes + + Have fun and play fair! + +========================================= diff --git a/roundstart.cfg b/roundstart.cfg new file mode 100644 index 0000000..65219f2 --- /dev/null +++ b/roundstart.cfg @@ -0,0 +1,24 @@ +// Round Start Configuration +// This file is executed at the start of each round + +// Display round start message +say "=========================================" +say "ROUND STARTING - 15 MINUTE TIMER!" +say "Map: Crossfire" +say "=========================================" + +// Play round start sound +play "fvox/bell.wav" + +// 10 second voice countdown using speak command +wait 300; say "10 seconds until round begins!"; speak "ten" +wait 60; speak "nine" +wait 60; speak "eight" +wait 60; speak "seven" +wait 60; speak "six" +wait 60; speak "five" +wait 60; speak "four" +wait 60; speak "three" +wait 60; speak "two" +wait 60; speak "one" +wait 60; say "FIGHT!"; play "fvox/activated.wav" diff --git a/roundtimer.sma b/roundtimer.sma new file mode 100644 index 0000000..c1b3d2c --- /dev/null +++ b/roundtimer.sma @@ -0,0 +1,71 @@ +/* Round Timer Plugin + * Shows time remaining in scoreboard and plays voice countdown + */ + +#include +#include + +new g_iRoundTime +new g_iRoundStart + +public plugin_init() +{ + register_plugin("Round Timer", "1.0", "Custom") + + // Set the round time from mp_timelimit (in minutes, convert to seconds) + g_iRoundTime = get_cvar_num("mp_timelimit") * 60 + + // Start the timer + set_task(1.0, "check_time", 0, "", 0, "b") + + // Hook player scoreboard + register_event("StatusValue", "show_time", "be", "1=2") +} + +public plugin_cfg() +{ + g_iRoundStart = get_systime() +} + +public check_time() +{ + new iElapsed = get_systime() - g_iRoundStart + new iRemaining = g_iRoundTime - iElapsed + + // Voice countdown for last 10 seconds + if(iRemaining <= 10 && iRemaining > 0) + { + new szNumber[16] + num_to_word(iRemaining, szNumber, 15) + + client_cmd(0, "spk ^"vox/%s^"", szNumber) + + if(iRemaining == 10) + client_print(0, print_chat, "[Round Timer] 10 seconds remaining!") + } + + // Round end + if(iRemaining <= 0) + { + client_cmd(0, "spk ^"vox/time is up^"") + client_print(0, print_chat, "[Round Timer] Time is up! Changing map...") + + // Trigger map change + server_cmd("mp_timelimit 0.1") + } +} + +public show_time(id) +{ + new iElapsed = get_systime() - g_iRoundStart + new iRemaining = g_iRoundTime - iElapsed + + if(iRemaining < 0) + iRemaining = 0 + + new iMinutes = iRemaining / 60 + new iSeconds = iRemaining % 60 + + set_hudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 1.0, 0.0, 0.0, 4) + show_hudmessage(id, "Time Remaining: %02d:%02d", iMinutes, iSeconds) +} diff --git a/server.cfg b/server.cfg new file mode 100644 index 0000000..f5df31a --- /dev/null +++ b/server.cfg @@ -0,0 +1,54 @@ +// Half-Life Server Configuration +// Crossfire Only Server + +// Server name (will be overwritten by environment variable) +hostname "Half-Life Crossfire Server" + +// RCON password (will be overwritten by environment variable) +rcon_password "changeme" + +// Server password (will be overwritten by environment variable) +sv_password "" + +// Max players (will be overwritten by environment variable) +maxplayers 16 + +// Round settings - 15 minutes (900 seconds) +mp_timelimit 15 +mp_roundtime 15 + +// Gameplay settings +mp_friendlyfire 0 +mp_footsteps 1 +mp_flashlight 1 +mp_autocrosshair 1 +mp_autoteambalance 1 +mp_limitteams 2 + +// Server settings +sv_maxrate 25000 +sv_minrate 5000 +sv_maxupdaterate 101 +sv_minupdaterate 10 +sv_maxcmdrate 101 +sv_mincmdrate 10 + +// Voice communication +sv_voiceenable 1 +sv_voicecodec voice_speex +sv_voicequality 5 + +// Download settings +sv_allowdownload 1 +sv_allowupload 1 +sv_sendvelocity 1 + +// Server logging +log on +sv_logbans 1 +sv_logecho 1 +sv_logfile 1 +sv_log_onefile 0 + +// Execute on map start +exec roundstart.cfg diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..f449182 --- /dev/null +++ b/setup.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +echo "Half-Life Crossfire Server - Setup Script" +echo "==========================================" +echo "" + +# Check if running in the correct directory +if [ ! -f "docker-compose.yml" ]; then + echo "❌ Error: docker-compose.yml not found!" + echo "Please run this script from the directory containing all server files." + exit 1 +fi + +# Check if all required files exist +required_files=("Dockerfile" "docker-compose.yml" "server.cfg" "mapcycle.txt" "motd.txt" "start-server.sh" "roundstart.cfg") +missing_files=() + +for file in "${required_files[@]}"; do + if [ ! -f "$file" ]; then + missing_files+=("$file") + fi +done + +if [ ${#missing_files[@]} -gt 0 ]; then + echo "❌ Missing required files:" + printf '%s\n' "${missing_files[@]}" + exit 1 +fi + +echo "✅ All required files found" +echo "" + +# Create .env file if it doesn't exist +if [ ! -f ".env" ]; then + echo "Creating .env file from template..." + cp .env.example .env + echo "✅ Created .env file - please edit it with your settings" + echo "" +fi + +# Make start-server.sh executable +chmod +x start-server.sh + +echo "Setup complete! You can now:" +echo "" +echo "1. Edit .env file with your server settings:" +echo " nano .env" +echo "" +echo "2. Build and start the server:" +echo " docker-compose up -d" +echo "" +echo "3. View logs:" +echo " docker-compose logs -f" +echo "" diff --git a/start-server.sh b/start-server.sh new file mode 100755 index 0000000..da38c38 --- /dev/null +++ b/start-server.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Apply environment variables to server.cfg +if [ -n "$SERVER_NAME" ]; then + sed -i "s/^hostname.*/hostname \"$SERVER_NAME\"/" /opt/steam/hlds/valve/server.cfg +fi + +if [ -n "$MAX_PLAYERS" ]; then + sed -i "s/^maxplayers.*/maxplayers $MAX_PLAYERS/" /opt/steam/hlds/valve/server.cfg +fi + +if [ -n "$SERVER_PASSWORD" ]; then + sed -i "s/^sv_password.*/sv_password \"$SERVER_PASSWORD\"/" /opt/steam/hlds/valve/server.cfg +fi + +if [ -n "$RCON_PASSWORD" ]; then + sed -i "s/^rcon_password.*/rcon_password \"$RCON_PASSWORD\"/" /opt/steam/hlds/valve/server.cfg +fi + +# Update MOTD with custom welcome message +if [ -n "$WELCOME_MESSAGE" ]; then + sed -i "s/WELCOME TO THE SERVER!/$WELCOME_MESSAGE/" /opt/steam/hlds/valve/motd.txt +fi + +# Start the Half-Life server on crossfire map +cd /opt/steam/hlds +./hlds_run \ + -game valve \ + +maxplayers ${MAX_PLAYERS:-16} \ + +map crossfire \ + -port 27015 \ + +sv_lan 1 \ + +exec server.cfg diff --git a/valve/addons/amxmodx/configs/maps.ini b/valve/addons/amxmodx/configs/maps.ini deleted file mode 100644 index d7749bf..0000000 --- a/valve/addons/amxmodx/configs/maps.ini +++ /dev/null @@ -1,19 +0,0 @@ -; Maps configuration file -; File location: $moddir/addons/amxmodx/configs/maps.ini -; To use with Maps Menu plugin - -; Add in your mod's maps here -; Delete this file to use mapcycle.txt - -crossfire -; bounce -; datacore -; frenzy -; gasworks -; lambda_bunker -; rapidcore -; snark_pit -; stalkyard -; subtransit -; undertow -; boot_camp diff --git a/valve/config/server.cfg b/valve/config/server.cfg deleted file mode 100644 index ebd1b0b..0000000 --- a/valve/config/server.cfg +++ /dev/null @@ -1,19 +0,0 @@ -echo "########################################################################" -echo "# ### DOCKER INFO ###" -echo "# To override the default server.cfg" -echo "# mount a volume to /opt/steam/hlds/valve/config" -echo "# and create a server.cfg inside that folder." -echo "# For more information visit:" -echo "# https://github.com/artkirienko/hlds-docker-dproto" -echo "#" -echo "# Example:" -echo "# docker run -it --rm -d -p27015:27015 -p27015:27015/udp \" -echo "# -v $(pwd)/valve/config:/opt/steam/hlds/valve/config artkirienko/hlds" -echo "########################################################################" - -// hostname "Half Life" -// maxplayers 12 - -// // password -// password 1 -// sv_password YOURPASSWORD diff --git a/valve/default.cfg b/valve/default.cfg deleted file mode 100644 index 649e875..0000000 --- a/valve/default.cfg +++ /dev/null @@ -1,51 +0,0 @@ -// This sets the config file which is loaded at each map change. -mapchangecfgfile server.cfg -motdfile motd.txt - -hostname "Half Life SERVERNAME" - -maxplayers 12 -mp_autocrosshair "0" -mp_falldamage "0" -mp_flashlight "1" -mp_logdetail "0" -mp_logfile "0" -mp_timelimit "15" -pausable "0" -secure "1" -sv_aim "0" -sv_allowupload "0" -sv_contact "https://github.com/artkirienko/hlds-docker-dproto" -sv_proxies "0" -sv_region "3" -sv_skyname "dusk" -sv_minrate "5000" -sv_maxrate "100000" -sv_minupaterate "60" -sv_maxupaterate "101" -sys_ticrate "200" - -//voice -sv_alltalk "1" -sv_voicecodec voice_speex -sv_voiceenable "1" -sv_voicequality "3" - -// player bounding boxes (collisions, not clipping) -sv_clienttrace 3.5 - -// maximum client movement speed -sv_maxspeed 270 - -// set FastDL servers (important, if you want to use custom maps) -// alternative: -// sv_downloadurl "http://files.anitalink.com/gamecache/hl/valve/" -sv_downloadurl "http://files2.hldm.org/hl/" - -// load ban files -exec listip.cfg -exec banned.cfg - -// password -// password 1 -// sv_password YOURPASSWORD diff --git a/valve/mapcycle.txt b/valve/mapcycle.txt deleted file mode 100644 index c34054c..0000000 --- a/valve/mapcycle.txt +++ /dev/null @@ -1,4 +0,0 @@ -crossfire -crossfire -crossfire -crossfire diff --git a/valve/mapcycle_backup.txt b/valve/mapcycle_backup.txt deleted file mode 100644 index 298b1e4..0000000 --- a/valve/mapcycle_backup.txt +++ /dev/null @@ -1,12 +0,0 @@ -crossfire -bounce -datacore -frenzy -gasworks -lambda_bunker -rapidcore -snark_pit -stalkyard -subtransit -undertow -boot_camp diff --git a/valve/motd.txt b/valve/motd.txt deleted file mode 100644 index 707564b..0000000 --- a/valve/motd.txt +++ /dev/null @@ -1,6 +0,0 @@ -Welcome to Half-Life HLDS Docker dproto(47/48) - Crossfire 24/7 - - -This server uses Docker. -For more information visit -https://github.com/jjsalinas/hl-server diff --git a/valve/server.cfg b/valve/server.cfg deleted file mode 100644 index 21552cb..0000000 --- a/valve/server.cfg +++ /dev/null @@ -1,5 +0,0 @@ -// Add server configurations to default.cfg -exec default.cfg - -// The custom config needs to be executed last. -exec config/server.cfg diff --git a/valve/steamcomm.lst b/valve/steamcomm.lst deleted file mode 100644 index bef234a..0000000 --- a/valve/steamcomm.lst +++ /dev/null @@ -1,39 +0,0 @@ -// Server Lists -// - -Auth -{ - 207.173.177.10:7002 -// half-life.east.won.net:7002 -// half-life.west.won.net:7002 -// half-life.central.won.net:7002 -} - -Master -{ - 207.173.177.10:27010 // steam official - 188.40.40.201:27010 - 46.165.194.16:27010 - 46.4.71.67:27010 - 46.165.194.14:27010 - 194.87.101.97:27010 - ms.gs4u.net:27010 - 85.204.49.230:27010 // not - ms.qck.ro:27010 // not - 88.198.47.43:27010 // not - 138.201.120.30:27010 // not - ms.tsarvar.com:27010 // not - ms.tsar.im:27010 // not - zvdk.nl:27010 // not - hl1master.steampowered.com:27010 // not -// half-life.east.won.net:27010 -// half-life.west.won.net:27010 -// half-life.central.won.net:27010 -} - -Secure -{ - half-life.speakeasy-nyc.hlauth.net:27012 - half-life.speakeasy-sea.hlauth.net:27012 - half-life.speakeasy-chi.hlauth.net:27012 -}