Просмотр исходного кода

move rcon info reading for squad, add read of server name & max players

Scarsz 9 лет назад
Родитель
Сommit
a67300eb9e
2 измененных файлов с 23 добавлено и 1 удалено
  1. 0 1
      lgsm/functions/command_details.sh
  2. 23 0
      lgsm/functions/info_config.sh

+ 0 - 1
lgsm/functions/command_details.sh

@@ -662,7 +662,6 @@ fn_details_spark(){
 }
 
 fn_details_squad(){
-	rconport=$(cat ${servercfgdir}/Rcon.cfg | grep "Port=" | cut -c6-) # obtain rcon port from file
 	echo -e "netstat -atunp | grep SquadServer"
 	echo -e ""
 	{

+ 23 - 0
lgsm/functions/info_config.sh

@@ -703,6 +703,27 @@ fn_info_config_wolfensteinenemyterritory(){
 	fi
 }
 
+fn_info_config_squad(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		maxplayers="${unavailable}"
+	else
+		servername="$(cat ${servercfgfullpath} | grep "ServerName=" | cut -c13- | rev | cut -c3- | rev)"
+		maxplayers="$(cat ${servercfgfullpath} | grep "MaxPlayers=" | cut -c12-)"
+	fi
+
+	if [ ! -f "${servercfgdir}/Rcon.cfg" ]; then
+		rconport=${unavailable}
+		rconpassword=${unavailable}
+	else
+		rconport=$(cat ${servercfgdir}/Rcon.cfg | grep "Port=" | cut -c6-)
+		rconpassword=$(cat ${servercfgdir}/Rcon.cfg | grep "Password=" | cut -c6-)
+		if [ -z "${rconpassword}" ]; then
+			rconpassword="${cyan}DISABLED${default}"
+		fi
+	fi
+}
+
 # Just Cause 2
 if [ "${engine}" == "avalanche" ]; then
 	fn_info_config_avalanche
@@ -787,4 +808,6 @@ elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
 	fn_info_config_wolfensteinenemyterritory
 elif [ "${gamename}" == "Multi Theft Auto" ]; then
 	fn_info_config_mta
+elif [ "${gamename}" == "Squad"]; then
+	fn_info_config_squad
 fi