#!/bin/sh # # Script for XQF to choose which engine to use. Requires qstat. # # If the server is running PB, use idsoftware's engine. # If the server is running BE, use ioUrbanTerror engine. # If the server is running neither, use my local compile of ioUrbanTerror. # # Note: On debian, qstat has been renamed to quakestat. Replace # that below if you are not using Debian. # # To use this, change the paths to your quake3 locations (idsoftware and ioquake3). # Then setup xqf to execute this instead of quake3. # set -e # Set these paths and executable names for your system. ID_QUAKE=/usr/local/games/quake3/quake3.x86 IO_OFFICIAL=/home/riot777/games/urbanterror/ioUrbanTerror.i386 IO_LOCAL=/home/riot777/games/urbanterror/ioUrbanTerror.i386 QSTAT=qstat # Example command issued by xqf: # /bin/sh /srv/games/engines/quake3/idsoftware/quake3 +connect IP:PORT +set cl_punkbuster 1 +set fs_game q3ut3 +set com_hunkmegs 208 +set com_zonemegs 32 +set com_soundmegs 20 +set cg_precachedmodels 20 # Check the arguments (go until $# = 1 because there must be at least 2 arguments) SERVER=""; SAVED_ARGS="$*"; while (($# > 1)); do if [ X"$1" = X"+connect" ]; then # Right after +connect is the IP:PORT. SERVER="$2"; fi shift; done if [ X"$SERVER" = "X" ]; then echo "Error! You must provide a command with +connect IP:PORT to this script"; echo "Usage: $0 +connect IP:PORT " exit 1; fi # Get the rules from the server echo "Requesting rules from server $SERVER" SETTINGS="`$QSTAT -R -q3s $SERVER | tail -1`"; # Search for the server variable that enables punkbuster PUNKBUSTER="`echo $SETTINGS | sed -e 's/.*,\?sv_punkbuster=\([0-9]\),\?.*/\1/i'`" BATTLEYE="`echo $SETTINGS | sed -e 's/.*,\?sv_battleye=\([0-9]\),\?.*/\1/i'`" # Choose the right engine. if [ X"$PUNKBUSTER" = X"1" ]; then echo "This server runs punkbuster. Executing idsoftware quake3" EXE="$ID_QUAKE"; elif [ X"$BATTLEYE" = X"1" ]; then echo "This server runs battleye. Executing official ioUrbanTerror" EXE="$IO_OFFICIAL"; else echo "This server doesn't run either anti-cheat. Use locally compiled 64-bit version" EXE="$IO_LOCAL"; fi if [ X"$EXE" = "X" ]; then echo "Error! Script must define EXE" exit 1; fi EXE_PATH="`dirname $EXE`"; EXE_NAME="`basename $EXE`"; cd "$EXE_PATH"; ./${EXE_NAME} $SAVED_ARGS; exit $?