Browse Source

Merge pull request #1648 from GameServerManagers/feature/gtasamp

Feature/gtasamp
Daniel Gibbs 8 years ago
parent
commit
657e50d83c

+ 107 - 0
lgsm/config-default/config-lgsm/sampserver/_default.cfg

@@ -0,0 +1,107 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either
+# common.cfg - applies settings to every instance
+# [instance].cfg - applies settings to a specific instance
+
+#### Server Settings ####
+
+## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
+ip="0.0.0.0"
+port="7777"
+
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+parms=""
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="San Andreas Multiplayer"
+engine="renderware"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}/samp03"
+executable="./samp03svr"
+servercfg="server.cfg"
+servercfgdir="${systemdir}/samp03"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${serverfiles}/samp03"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -54,6 +54,7 @@ qw,qwserver,Quake World
 ro,roserver,Red Orchestra: Ostfront 41-45
 ricochet,ricochetserver,Ricochet
 rust,rustserver,Rust
+samp,sampserver,San Andreas Multiplayer
 ss3,ss3server,Serious Sam 3: BFE
 sb,sbserver,Starbound
 squad,squadserver,Squad

+ 1 - 1
lgsm/functions/command_install.sh

@@ -19,7 +19,7 @@ installflag=1
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	install_server_files.sh
 	install_ut2k4_key.sh
-elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "Factorio" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Multi Theft Auto" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
+elif [ -z "${appid}" ]; then
 	installer=1
 	install_server_files.sh
 elif [ -n "${appid}" ]; then

+ 1 - 1
lgsm/functions/core_getopt.sh

@@ -56,7 +56,7 @@ currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monit
 currentopt+=( "${cmd_update_linuxgsm[@]}" )
 
 # Exclude noupdate games here
-if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]; then
+if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${gamename}" != "San Andreas Multiplayer" ]; then
 	currentopt+=( "${cmd_update[@]}" )
 	# force update for SteamCMD only or MTA
 	if [ -n "${appid}" ] || [ "${gamename}" == "Multi Theft Auto" ]; then

+ 25 - 0
lgsm/functions/info_config.sh

@@ -523,6 +523,27 @@ fn_info_config_mumble(){
 	fi
 }
 
+fn_info_config_samp(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="unnamed server"
+		serverpassword="${unavailable}"
+		rconpassword="${unavailable}"
+		port="7777"
+		maxplayers="50"
+	else
+		servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		port=$(grep "port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		maxplayers=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		rconpassword=${rconpassword:-"NOT SET"}
+		port=${port:-"8303"}
+		maxplayers=${maxplayers:-"12"}
+	fi
+}
+
 fn_info_config_teeworlds(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="unnamed server"
@@ -897,8 +918,12 @@ elif [ "${engine}" == "starbound" ]; then
 # TeamSpeak 3
 elif [ "${gamename}" == "TeamSpeak 3" ]; then
 	fn_info_config_teamspeak3
+# Mumble
 elif [ "${gamename}" == "Mumble" ]; then
 	fn_info_config_mumble
+# San Andreas Multiplayer
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	fn_info_config_samp
 # Teeworlds
 elif [ "${engine}" == "teeworlds" ]; then
 	fn_info_config_teeworlds

+ 3 - 1
lgsm/functions/info_distro.sh

@@ -135,4 +135,6 @@ if [ -d "${backupdir}" ]; then
 fi
 
 # External IP address
-extip=$(curl -m 3 ifconfig.co 2>/dev/null)
+if [ -z "${extip}" ];then
+	extip=$(curl -m 3 ifconfig.co 2>/dev/null)
+fi

+ 3 - 0
lgsm/functions/info_glibc.sh

@@ -89,6 +89,9 @@ elif [ "${gamename}" == "Quake 3: Arena" ]; then
 elif [ "${gamename}" == "Quake Live" ]; then
 	glibcrequired="2.15"
 	glibcfix="no"
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	glibcrequired="2.3"
+	glibcfix="no"
 elif [ "${gamename}" == "Squad" ]; then
 	glibcrequired="2.17"
 	glibcfix="no"

+ 12 - 0
lgsm/functions/info_messages.sh

@@ -707,6 +707,16 @@ fn_info_message_rust(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_samp(){
+	echo -e "netstat -atunp | grep samp03svr"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
+	} | column -s $'\t' -t
+}
+
+
 fn_info_message_seriousengine35(){
 	echo -e "netstat -atunp | grep Sam3_Dedicate"
 	echo -e ""
@@ -977,6 +987,8 @@ fn_info_message_select_engine(){
 		fn_info_message_quake3
 	elif [ "${gamename}" == "Quake Live" ]; then
 		fn_info_message_quakelive
+	elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+		fn_info_message_samp
 	elif [ "${gamename}" == "Squad" ]; then
 		fn_info_message_squad
 	elif [ "${gamename}" == "TeamSpeak 3" ]; then

+ 6 - 0
lgsm/functions/install_config.sh

@@ -456,6 +456,12 @@ elif [ "${gamename}" == "Starbound" ]; then
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_set_config_vars
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	gamedirname="SanAndreasMultiplayer"
+	array_configs+=( server.cfg )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Sven Co-op" ]; then
 	gamedirname="SvenCoop"
 	array_configs+=( server.cfg )

+ 2 - 0
lgsm/functions/install_server_files.sh

@@ -39,6 +39,8 @@ fn_install_server_files(){
 		remote_fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6"
 	elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
 		remote_fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7"
+	elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+		remote_fileurl="http://files.sa-mp.com/samp037svr_R2-1.tar.gz"; local_filedir="${tmpdir}"; local_filename="samp037svr_R2-1.tar.gz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4"
 	fi
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"