View unanswered posts | View active topics It is currently Tue Oct 08, 2024 5:26 pm



Reply to topic  [ 1 post ] 
 toonrun1 
Author Message
★★★★

Joined: Thu Mar 12, 2015 2:50 pm
Posts: 2
Has thanked: 0 time
Been thanked: 0 time
I am wondering if you could either change the start level whenever the server crashes, or use an auto-restart script that selects a random map from a list. It is unfortunate when there are 6 or so players on the server and it goes to toonrun1, almost always everyone leaves because everyone has played it many times. It isn't that bad of a map, it has just been played too many times.
I had created this script a while ago that allows for auto-restart and random map (generated via mapcycle.txt). I am sure there are better scripts or programs out there, but it would be nice to not have to play toonrun1 everytime.
This script was used on an Ubuntu server.

Code:
#!/bin/bash

steamhldsvalve=/steam/valve
steamcmddir=/steam

a=()
for k in $( cat $steamhldsvalve/svencoop/mapcycle.txt ); do
   k=${k//" "}
   k=${k//"-HL_OpFor_SP_Portal"/"sc_tetris1"}
   k=${k//"-blueshift"/"sc_royals1"}
   k=${k//"-They_Hunger_Ep1"/"svencoop1"}
   a+=("$k")
done

cd $steamhldsvalve
i=1

libchecker ()
{
if [ 'uname -m' == 'x86_64' ]
   then
      libarchitecture=/lib/&&updater
   else
      libarchitecture=/lib32/&&updater
fi
}

updater ()
{
echo "($(date +"%T")) ($(date +"%m-%d-%y")) Updating/installing HLDS" >> ./autoscript.log
   $steamcmddir/steamcmd.sh +login anonymous +force_install_dir "$steamhldsvalve" +app_update 90 validate +quit
echo "($(date +"%T")) ($(date +"%m-%d-%y")) Update/installation Complete" >> ./autoscript.log
reds
}

reds ()
{
b=${a[$RANDOM % ${#a[@]} ]}
echo "($(date +"%T")) ($(date +"%m-%d-%y")) Starting on $b" >> ./autoscript.log
   LD_LIBRARY=$libarchitecture ./hlds_run -game svencoop +map $b +maxplayers 10 +sv_lan 0 -adminsfile=notdeladmins.txt -port 27016 -heapsize 512000 -num_edicts 8192 +sys_ticrate 64 -insecure -norestart
echo "($(date +"%T")) ($(date +"%m-%d-%y")) Crashed $i times, restarting..." >> ./autoscript.log
let "i+=1"
reds
}

libchecker

exit $?


The variable "$steamhldsvalve" must point to where hlds_run is, and the variable "$steamcmddir" must point to where steamcmd.sh is.
Maps that start with "-" do not work correctly in the script, so I have replaced them with other default maps. If you have any custom maps that start with "-", I suggest adding:
k=${k//"-custommap"/"adifferentmap"}


Sat Mar 14, 2015 7:28 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.
[ Time : 0.084s | 19 Queries | GZIP : On ]