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

Merge remote-tracking branch 'origin/samp' into feature/gtasamp

Daniel Gibbs 8 лет назад
Родитель
Сommit
96a8b50025

+ 17 - 0
SanAndreasMultiplayer/cfg/lgsm-default.cfg

@@ -0,0 +1,17 @@
+echo Executing Server Config...
+lanmode 0
+rcon_password "<rconpassword>"
+maxplayers 50
+port 7777
+hostname "<hostname>"
+gamemode0 grandlarc 1
+filterscripts base gl_actions gl_property gl_realtime
+announce 0
+query 1
+weburl www.sa-mp.com
+maxnpc 0
+onfoot_rate 40
+incar_rate 40
+weapon_rate 40
+stream_distance 300.0
+stream_rate 1000

+ 145 - 0
SanAndreasMultiplayer/sampserver

@@ -0,0 +1,145 @@
+#!/bin/bash
+# San Andreas Multiplayer 
+# Server Management Script
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+if [ -f ".dev-debug" ]; then
+	exec 5>dev-debug.log
+	BASH_XTRACEFD="5"
+	set -x
+fi
+
+version="210516"
+
+#### Variables ####
+
+# Notification Alerts
+# (on|off)
+
+# Email
+emailalert="off"
+email="email@example.com"
+#emailfrom="email@example.com"
+
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+
+# Start Variables
+ip="0.0.0.0"
+port="7777"
+
+fn_parms(){
+parms=" "
+}
+
+#### Advanced Variables ####
+
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="dgibbs64"
+githubrepo="linuxgsm"
+githubbranch="master"
+
+# Server Details
+servicename="samp-server"
+gamename="San Andreas Multiplayer"
+engine="RenderWare"
+
+# Directories
+rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
+tmpdir="${lgsmdir}/tmp"
+filesdir="${rootdir}/serverfiles"
+systemdir="${filesdir}"
+executabledir="${systemdir}/samp03"
+executable="./samp03svr"
+servercfg="server.cfg"
+servercfgdir="${systemdir}/samp03"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+servercfgdefault="${servercfgdir}/lgsm-default.cfg"
+backupdir="${rootdir}/backups"
+
+# Logging
+logdays="7"
+gamelogdir="${filesdir}/Logs"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+consolelogging="on"
+
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
+
+##### Script #####
+# Do not edit
+
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	echo -e "    fetching ${filename}...\c"
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi
+	else
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh
+core_functions.sh
+
+getopt=$1
+core_getopt.sh

+ 6 - 0
lgsm/functions/install_config.sh

@@ -462,6 +462,12 @@ elif [ "${gamename}" == "Starbound" ]; then
 	fn_fetch_default_config
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_set_config_vars
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	echo -e "downloading server.cfg...\c"
+	wget -N /dev/null  ${githuburl}/SanAndreasMultiplayer/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
+	fn_userinputconfig
 elif [ "${gamename}" == "Sven Co-op" ]; then
 elif [ "${gamename}" == "Sven Co-op" ]; then
 	gamedirname="SvenCoop"
 	gamedirname="SvenCoop"
 	array_configs+=( server.cfg )
 	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"
 		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
 	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"
 		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
+		fileurl="http://files.sa-mp.com/samp037svr_R2-1.tar.gz"; filedir="${tmpdir}"; filename="samp037svr_R2-1.tar.gz";  executecmd="noexecute" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4"
 	fi
 	fi
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"