commit 6a23db18b91b5361a8aa44021b529a3ea6d678ea Author: Jose Jimenez <90982925+jjsalinas@users.noreply.github.com> Date: Thu Jan 16 23:01:08 2025 +0100 Initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8fa7b1a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +/lib/dproto/bin/Windows/* +/lib/dproto/Readme.txt +README.md +banner.png +.github diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..a325cb6 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,11 @@ +name: Docker Image CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag hlds:$(date +%s) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ea0bee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# MacOS filesystem +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27383fb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,105 @@ +FROM debian:buster-slim + +ARG hlds_build=7882 +ARG metamod_version=1.21p38 +ARG amxmod_version=1.8.2 +ARG jk_botti_version=1.43 +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" +ARG jk_botti_url="http://koti.kapsi.fi/jukivili/web/jk_botti/jk_botti-$jk_botti_version-release.tar.xz" + +# Fix warning: +# WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. +# International characters may not work. +RUN apt-get update && apt-get install -y --no-install-recommends \ + locales=2.28-10 \ + && rm -rf /var/lib/apt/lists/* \ + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LANG en_US.utf8 +ENV LC_ALL en_US.UTF-8 + +# Fix error: +# Unable to determine CPU Frequency. Try defining CPU_MHZ. +# Exiting on SPEW_ABORT +ENV CPU_MHZ=2300 + +RUN groupadd -r steam && useradd -r -g steam -m -d /opt/steam steam + +RUN apt-get -y update && apt-get install -y --no-install-recommends \ + ca-certificates=20190110 \ + curl=7.64.0-4+deb10u1 \ + lib32gcc1=1:8.3.0-6 \ + unzip=6.0-23+deb10u1 \ + xz-utils=5.2.4-1 \ + zip=3.0-11+b1 \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* + +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 + +# 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 + +# 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 +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/ + +# 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 + +# Install jk_botti +RUN curl -sqL "$jk_botti_url" | tar -C /opt/steam/hlds/valve/ -xJ \ + && echo 'linux addons/jk_botti/dlls/jk_botti_mm_i386.so' >> /opt/steam/hlds/valve/addons/metamod/plugins.ini + +WORKDIR /opt/steam/hlds + +# Copy default config +COPY valve valve + +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"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..fed378c --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +[![GitHub Actions Docker Image CI](https://github.com/artkirienko/hlds-docker-dproto/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/artkirienko/hlds-docker-dproto/actions) +[![HitCount](http://hits.dwyl.com/artkirienko/hlds-docker-dproto.svg)](http://hits.dwyl.com/artkirienko/hlds-docker-dproto) + +![banner](banner.png) + +# HLDS Docker dproto(47/48 Steam+noSteam) + +## 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. + +## Quick Start + +Start a new server by running: + +```bash +docker run -it --rm -d -p27015:27015 -p27015:27015/udp artkirienko/hlds +``` + +Change the player slot size, map or `rcon_password` by running: + +``` +docker run -it --rm -d --name hlds -p27015:27015 -p27015:27015/udp artkirienko/hlds +map crossfire +maxplayers 12 +rcon_password SECRET_PASSWORD +``` + +> **Note:** Any [server config command](http://sr-team.clan.su/K_stat/hlcommandsfull.html) + can be passed by using `+`. But it has to follow after the image name `artkirienko/hlds`. + +## 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` + + ``` + Protocol version 47/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` + +* [AMX Mod X](https://github.com/alliedmodders/amxmodx) version `1.8.2` + +* **dproto** version `0.9.582`. This is the last version of **dproto**, + the project is abandoned. + +* [jk_botti](https://github.com/Bots-United/jk_botti) version `1.43` + +* 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 + +## Default mapcycle + +* crossfire +* bounce +* datacore +* frenzy +* gasworks +* lambda_bunker +* rapidcore +* snark_pit +* stalkyard +* subtransit +* undertow +* boot_camp + +## 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: + +```bash +docker run -it --rm -d -p27015:27015 -p27015:27015/udp -v $(pwd)/valve/config:/opt/steam/hlds/valve/config artkirienko/hlds +``` diff --git a/banner.png b/banner.png new file mode 100644 index 0000000..618e335 Binary files /dev/null and b/banner.png differ diff --git a/lib/bind_key/amxx/bind_key.amxx b/lib/bind_key/amxx/bind_key.amxx new file mode 100644 index 0000000..23f2417 Binary files /dev/null and b/lib/bind_key/amxx/bind_key.amxx differ diff --git a/lib/bind_key/amxx/bind_key.sma b/lib/bind_key/amxx/bind_key.sma new file mode 100644 index 0000000..1f0d1cf --- /dev/null +++ b/lib/bind_key/amxx/bind_key.sma @@ -0,0 +1,35 @@ +#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 new file mode 100644 index 0000000..5a8a5ce --- /dev/null +++ b/lib/dproto/Readme.txt @@ -0,0 +1,107 @@ +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 new file mode 100644 index 0000000..ce02ba4 --- /dev/null +++ b/lib/dproto/amxx/dp_test.sma @@ -0,0 +1,116 @@ +/* + 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 new file mode 100644 index 0000000..2db1005 --- /dev/null +++ b/lib/dproto/amxx/updatehint.sma @@ -0,0 +1,206 @@ +/* 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 new file mode 100644 index 0000000..9841c65 --- /dev/null +++ b/lib/dproto/amxx/updatehint.txt @@ -0,0 +1,7 @@ +[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 new file mode 100644 index 0000000..0861c61 Binary files /dev/null and b/lib/dproto/bin/Linux/dproto_i386.so differ diff --git a/lib/dproto/bin/Windows/dproto.dll b/lib/dproto/bin/Windows/dproto.dll new file mode 100644 index 0000000..7082200 Binary files /dev/null and b/lib/dproto/bin/Windows/dproto.dll differ diff --git a/lib/dproto/dproto.cfg b/lib/dproto/dproto.cfg new file mode 100644 index 0000000..2a36da6 --- /dev/null +++ b/lib/dproto/dproto.cfg @@ -0,0 +1,252 @@ +# ======================================================== +# 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 new file mode 100644 index 0000000..a56ccfd --- /dev/null +++ b/lib/hlds.install @@ -0,0 +1,8 @@ +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/valve/addons/amxmodx/configs/maps.ini b/valve/addons/amxmodx/configs/maps.ini new file mode 100644 index 0000000..fe81ab5 --- /dev/null +++ b/valve/addons/amxmodx/configs/maps.ini @@ -0,0 +1,19 @@ +; 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 new file mode 100644 index 0000000..a5bd3f5 --- /dev/null +++ b/valve/config/server.cfg @@ -0,0 +1,12 @@ +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 "########################################################################" diff --git a/valve/default.cfg b/valve/default.cfg new file mode 100644 index 0000000..556e9c5 --- /dev/null +++ b/valve/default.cfg @@ -0,0 +1,47 @@ +// This sets the config file which is loaded at each map change. +mapchangecfgfile server.cfg +motdfile motd.txt + +hostname "HLDS Docker dproto(47/48)" + +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 diff --git a/valve/mapcycle.txt b/valve/mapcycle.txt new file mode 100644 index 0000000..298b1e4 --- /dev/null +++ b/valve/mapcycle.txt @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..7cc622a --- /dev/null +++ b/valve/motd.txt @@ -0,0 +1,12 @@ +Welcome to HLDS Docker dproto(47/48) + + +This server uses Docker. +For more information visit +https://github.com/artkirienko/hlds-docker-dproto + + + + +Love old-school gaming and Half-Life? +Join us on Discord: https://discord.com/invite/halflife diff --git a/valve/server.cfg b/valve/server.cfg new file mode 100644 index 0000000..21552cb --- /dev/null +++ b/valve/server.cfg @@ -0,0 +1,5 @@ +// 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 new file mode 100644 index 0000000..bef234a --- /dev/null +++ b/valve/steamcomm.lst @@ -0,0 +1,39 @@ +// 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 +}