Daniel Gibbs 7 лет назад
Родитель
Сommit
c5b3611171
1 измененных файлов с 33 добавлено и 0 удалено
  1. 33 0
      lgsm/functions/info_config.sh

+ 33 - 0
lgsm/functions/info_config.sh

@@ -589,6 +589,36 @@ fn_info_config_seriousengine35(){
 	fi
 }
 
+#StickyBots
+fn_info_config_sbots(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		maxplayers="${unavailable}"
+		numreservedslots="${unavailable}"
+	else
+		servername="$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=";,:' | sed -e 's/^[ \t]//' -e 's/[ \t]*$//')"
+		maxplayers="$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
+		numreservedslots="$(grep "NumReservedSlots=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
+	fi
+
+	if [ ! -f "${servercfgdir}/Rcon.cfg" ]; then
+		rconport=${unavailable}
+		rconpassword=${unavailable}
+	else
+		rconport=$(grep "Port=" "${servercfgdir}/Rcon.cfg" | tr -cd '[:digit:]')
+		rconpassword=$(grep "Password=" "${servercfgdir}/Rcon.cfg" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+	fi
+
+	rconport=${rconport:-"0"}
+	if [ -z "${rconpassword}" ]||[ ${#rconpassword} == 1 ]; then
+		rconpassword="NOT SET"
+	fi
+	servername=${servername:-"NOT SET"}
+	serverpassword=${serverpassword:-"NOT SET"}
+	maxplayers=${maxplayers:-"0"}
+	numreservedslots=${maxplayers:-"0"}
+}
+
 fn_info_config_source(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
@@ -1178,6 +1208,9 @@ elif [ "${gamename}" == "Mumble" ]; then
 # San Andreas Multiplayer
 elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
 	fn_info_config_samp
+# StickyBots
+elif [ "${shortname}" == "pstbs" ]; then
+	fn_info_config_sbots
 # Teeworlds
 elif [ "${engine}" == "teeworlds" ]; then
 	fn_info_config_teeworlds