SRCDS Steam group


[Windows] Start your SRCDS CSS with random map using "SRCDS Guardian 3.0"
#1
Hey all,

I noticed that TF2 has a cvar called 'randommap' that will make your server start with a random map.

I'm using SRCDS for CSS with SRCDS Guardian 3.0 and I added some code in the top of that .bat file so that my server also would start with a random map, chosen from the map directory.

Maybe some of you want to use this also.
This is the code I added at the top of the script:

Code:
:: keep window clean @echo off :: set map directory set mapDir=C:\srcds\css\cstrike\maps :: set mapcount set mapCount=0 :: needed for variable update in for loop setlocal enabledelayedexpansion :: loop the maps for %%g in ("%mapDir%\*.bsp") do ( :: put mapnames in pseudo-array prefixed with "MAP_" set MAP_!mapCount!=%%~ng :: increase mapcounter set /a mapCount+=1 ) :: get random mapId using modulus set /a mapId="%random% %% mapCount" :: get mapName by mapId set mapName=!MAP_%mapId%!

Just make sure that "set mapDir=C:\srcds\css\cstrike\maps" points to your map directory.

Then change the "set runcmd=..." line in the "SRCDS Guardian 3.0"-script: replace the mapname with %mapName% and you are done.
For example, mine became:

Code:
set runcmd=C:\srcds2\css\srcds.exe -console -game cstrike -maxplayers 20 -port 27016 +map %mapName% -autoupdate -verify_all

Lots of thanks to Mooga for his awesome "SRCDS Guardian 3.0" script!

Greetings!
Reply
#2
Nice tip, will take note for some of our CSS guests!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)