From 1bf79cd8a4fba9a3bfcb6a70563d3dc4ad2b7975 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 15 Jan 2015 16:47:55 +0000 Subject: [PATCH] fn_servername fn_servername get the game server name from from config file. --- functions/fn_servername | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 functions/fn_servername diff --git a/functions/fn_servername b/functions/fn_servername new file mode 100644 index 000000000..4ad258ff6 --- /dev/null +++ b/functions/fn_servername @@ -0,0 +1,23 @@ +#!/bin/bash +# LGSM fn_servername function +# Author: Daniel Gibbs +# Website: http://danielgibbs.co.uk +# Version: 150115 + +# Description: Gets the server name. + +if [ "${engine}" == "avalanche" ]; then + servername=$(grep -s Name "${servercfgfullpath}"|sed 's/Name//g' | tr -d '=\"; '|sed 's/,//g') +elif [ "${engine}" == "realvirtuality" ]; then + servername=$(grep -s hostname "${servercfgfullpath}"| grep -v //|sed -e 's/\//g'| tr -d '=\"; ') +elif [ "${engine}" == "seriousengine35" ]; then + fn_seriousengine35details +elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then + servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g') +elif [ "${engine}" == "spark" ]; then + : # Not in config file +elif [ "${engine}" == "unity3d" ]; then + servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"") +elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then + servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g') +fi \ No newline at end of file