GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.25k stars 813 forks source link

[Server Request] Multi Theft Auto #1221

Closed braunsonm closed 7 years ago

braunsonm commented 7 years ago

Would be nice to have MTA implemented if SAMP is being considered. MTA is another popular modification for Grand Theft Auto San Andreas.

I run a popular server on there and would be willing to help test or contribute. I am not good enough in bash to maybe be that much help. This is a bash script I made to deploy a MTA server using the default resources or use your own Git repository as the source. Not sure if it would be any help to you. (For Debian)

#!/bin/bash

HELP="Usage:

\t[-g GIT_REPO]
\t[-p DB_PASS]
\t[-h HELP]\n"

BINARY="https://linux.mtasa.com/dl/152/multitheftauto_linux_x64-1.5.2.tar.gz"
CONFIG="https://linux.mtasa.com/dl/152/baseconfig-1.5.2.tar.gz"
RESOURCES="https://github.com/multitheftauto/mtasa-resources/archive/master.tar.gz"

while getopts ":a:g:p:h" arg; do
  case $arg in
    g) #g allows the user to initiate a git repository in the deathmatch folder
        GIT_REPO="$OPTARG"
        ;;
    h) #h indicates that the user requests to see this script's usage
        printf "$HELP"
        exit
        ;;
        p) #p allows the setting of the mysql root password
        DB_PASS="$OPTARG"
        ;;
    *)
        printf "$HELP"
        exit -1
        ;;
  esac
done

# make sure server is up to date
apt-get -y update && apt-get -y upgrade

# gather binaries
wget -O mta.tar.gz $BINARY
# extract mta server into mta directory
mkdir /opt/mta/
tar xzvf mta.tar.gz -C /opt/mta/ --strip-components=1

# load in the mysql module
wget https://nightly.mtasa.com/files/modules/64/mta_mysql.so
mkdir /opt/mta/x64/modules
mv mta_mysql.so /opt/mta/x64/modules

# fix mysql error
wget https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16
mv libmysqlclient.so.16 /usr/lib

# cleanup
rm -f mta.tar.gz

# install MariaDB
apt-get -y install software-properties-common
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/debian jessie main'
apt-get update

export DEBIAN_FRONTEND=noninteractive
debconf-set-selections <<< "mariadb-server-10.1 mysql-server/root_password password $DB_PASS"
debconf-set-selections <<< "mariadb-server-10.1 mysql-server/root_password_again password $DB_PASS"
apt-get -y install mariadb-server

SQL="CREATE DATABASE IF NOT EXISTS mta;"
mysql -u root -p$DB_PASS -e "$SQL"

# GIT!
if [[ -n "$GIT_REPO" ]]; then

    # install git
  PKG_OK=$(dpkg-query -W --showformat='${Status}\n' git|grep "install ok installed")
  echo Checking for git: $PKG_OK
  if [ "" == "$PKG_OK" ]; then
    echo "git Package not installed. Setting up git."
    apt-get -y install git
  fi

    # generate a ssh key
    ssh-keygen -t rsa -N "" -b 4096 -C "system@owlgaming.net" -f ~/.ssh/id_rsa

    # output the SSH key to the user
    cat ~/.ssh/id_rsa.pub

    # pause while the user adds the key to github
    read -p "You must add the above SSH key to your repository authentication. Press [Enter] key to continue..."

    # install our repository
    git clone $GIT_REPO /opt/mta/mods/deathmatch

else # if no git then initiate some config files to use
  wget -O config.tar.gz $CONFIG
  wget -O deathmatch.tar.gz $RESOURCES

    # extract config files, resources and move into deathmatch directory
    tar xzvf deathmatch.tar.gz
  tar xzvf config.tar.gz
    mv baseconfig/* /opt/mta/mods/deathmatch
  mkdir /opt/mta/mods/deathmatch/resources
  mv mtasa-resources-master/* /opt/mta/mods/deathmatch/resources

    # clean up unnecessary files
    rm -rf baseconfig
  rm -rf mtasa-resources-master
    rm -f deathmatch.tar.gz
  rm -f config.tar.gz
fi

Documentation on deploying a server on linux: https://wiki.multitheftauto.com/wiki/Installing_and_Running_MTASA_Server_on_GNU_Linux

If I can be any help let me know.

UltimateByte commented 7 years ago

Hey there. I had this idea already, seems not very easy to add support for this game, but could be very cool. You seem to know a bit of bash, probably enough to make the step into developing LGSM. You know, that's how i really learned myself :p

I wrote this recently, to help people wanting to get into LGSM development. If you feel like so, you can step in ! https://github.com/GameServerManagers/LinuxGSM/wiki/Developing-LGSM Ultimately, you'll need this: https://github.com/GameServerManagers/LinuxGSM/wiki/Branching

Otherwise, it might take a while for us to get into it, depending on our availabilities.

braunsonm commented 7 years ago

Pull request made. @UltimateByte

https://github.com/GameServerManagers/LinuxGSM/pull/1224

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.