Browse Source

quakec

pull/4200/head
Daniel Gibbs 3 years ago
parent
commit
003f5ec482
No known key found for this signature in database GPG Key ID: 7CA38B43F78F12FE
  1. 36
      lgsm/modules/info_game.sh

36
lgsm/modules/info_game.sh

@ -40,6 +40,15 @@ fn_info_game_json() {
eval "${1}"="jq -r '${2}' ${servercfgfullpath}" > /dev/null 2>&1 || echo "Unable to parse ${2}" eval "${1}"="jq -r '${2}' ${servercfgfullpath}" > /dev/null 2>&1 || echo "Unable to parse ${2}"
} }
# Config Type: QuakeC
# Comment: // or /* */
fn_info_game_quakec() {
if [ -n "${3}" ]; then
servercfgfullpath="${3}"
fi
eval "${1}"="awk -F '[=\";:]' '/^set sv_hostname /{print $2}' '${servercfgfullpath}'" > /dev/null 2>&1 || echo "Unable to parse ${2}"
}
# Config Type: SQF # Config Type: SQF
# Comment: // or /* */ # Comment: // or /* */
fn_info_game_sqf() { fn_info_game_sqf() {
@ -776,23 +785,16 @@ fn_info_game_ck() {
# Example: set sv_hostname "SERVERNAME" # Example: set sv_hostname "SERVERNAME"
# Filetype: cfg # Filetype: cfg
fn_info_game_cod() { fn_info_game_cod() {
# Config if [ -f "${servercfgfullpath}" ]; then
if [ ! -f "${servercfgfullpath}" ]; then fn_info_game_quakec "rconpassword" "rconpassword"
servername="${unavailable}" fn_info_game_quakec "servername" "sv_hostname"
rconpassword="${unavailable}"
else
servername=$(grep "sv_hostname " "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | xargs)
rconpassword=$(grep "rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not set
servername=${servername:-"NOT SET"}
rconpassword=${rconpassword=:-"NOT SET"}
fi fi
defaultmap="${defaultmap:-"NOT SET"}"
# Parameters maxplayers="${maxplayers:-"0"}"
defaultmap=${defaultmap:-"NOT SET"} port="${port:-"0"}"
maxplayers=${maxplayers:-"0"} queryport="${port}"
port=${port:-"0"} rconpassword="${rconpassword:-"NOT SET"}"
servername="${servername:-"NOT SET"}"
} }
# Config Type: QuakeC # Config Type: QuakeC
@ -2082,7 +2084,7 @@ fn_info_game_terraria() {
fi fi
} }
# Config Type: QuakeC # Config Type: QuakeC (custom)
# Comment: // or /* */ # Comment: // or /* */
# Example: set sv_hostname "SERVERNAME" # Example: set sv_hostname "SERVERNAME"
# Filetype: cfg # Filetype: cfg

Loading…
Cancel
Save