forked from artem-panchenko/counter-strike-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hlds_run.sh
executable file
·80 lines (61 loc) · 2.5 KB
/
hlds_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
set -axe
HLDS="/opt/hlds"
CONFIG_FILE="${HLDS}/startup.cfg"
if [ -r "${CONFIG_FILE}" ]; then
# TODO: make config save/restore mechanism more solid
set +e
# shellcheck source=/dev/null
source "${CONFIG_FILE}"
set -e
fi
EXTRA_OPTIONS=( "$@" )
EXECUTABLE="${HLDS}/hlds_run"
GAME="${GAME:-cstrike}"
MAXPLAYERS="${MAXPLAYERS:-32}"
START_MAP="${START_MAP:-de_dust2}"
SERVER_NAME="${SERVER_NAME:-Counter-Strike 1.6 Server}"
OPTIONS=( "-game" "${GAME}" "+maxplayers" "${MAXPLAYERS}" "+map" "${START_MAP}" "+hostname" "\"${SERVER_NAME}\"")
if [ -z "${RESTART_ON_FAIL}" ]; then
OPTIONS+=('-norestart')
fi
# AMX Admin Steam Users
if [ -n "${ADMIN_STEAM}" ]; then
for steam_user in ${ADMIN_STEAM//,/ }
do
echo "\"${steam_user}\" \"\" \"abcdefghijklmnopqrstu\" \"ce\"" >> "${HLDS}/cstrike/addons/amxmodx/configs/users.ini"
done
fi
# AMX Admin Users by IP
if [ -n "${ADMIN_IP}" ]; then
for ip in ${ADMIN_IP//,/ }
do
echo "\"${ip}\" \"\" \"abcdefghijklmnopqrstu\" \"de\"" >> "${HLDS}/cstrike/addons/amxmodx/configs/users.ini"
done
fi
# AMX Admin Users by Name
if [ -n "${ADMIN_NAME}" ] && [ -n "${ADMIN_PASSWORD}" ]; then
for name in ${ADMIN_NAME//,/ }
do
echo "\"${name}\" \"${ADMIN_PASSWORD}\" \"abcdefghijklmnopqrstu\" \"a\"" >> "${HLDS}/cstrike/addons/amxmodx/configs/users.ini"
done
fi
# Set Server Password
if [ -n ${SERVER_PASSWORD} ]; then
echo "sv_password \"${SERVER_PASSWORD}\"" >> "/opt/hlds/cstrike/server.cfg"
fi
# Enable AMX Plugins
echo "restmenu.amxx ; Restrict Weapons" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
echo "ultimate_sounds.amxx ; Ultimate Sounds" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
echo "deathbeams.amxx ; Death Beams" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
echo "resetscore.amxx ; Reset Score" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
echo "hsonly.amxx ; HeadShot Only" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
# Enable YaPB Bots
if [ "${YAPB_ENABLED}" -eq 1 ];then
YAPB_PASSWORD="${YAPB_PASSWORD:-yapb}"
echo "linux addons/yapb/bin/yapb.so" >> "${HLDS}/cstrike/addons/metamod/plugins.ini"
echo "yb_password \"${YAPB_PASSWORD}\"" >> "${HLDS}/cstrike/addons/yapb/conf/yapb.cfg"
echo "amxx_yapbmenu.amxx ; YAPB Menu" >> "${HLDS}/cstrike/addons/amxmodx/configs/plugins.ini"
fi
set > "${CONFIG_FILE}"
exec "${EXECUTABLE}" "${OPTIONS[@]}" "${EXTRA_OPTIONS[@]}"