Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Half-Life Dedicated Server Batch File  (Read 7346 times)

0 Members and 1 Guest are viewing this topic.

Promostarr

  • Guest
Half-Life Dedicated Server Batch File
« on: June 04, 2010, 07:29:35 AM »
I decided to make an all-in-one batch file for server hosting for Valve.

but its missing a few things i dont know how to do.

Primarly HLDS required a program to be downloaded http://www.steampowered.com/download/hldsupdatetool.exe this program adds in a file called hldsupdatetool.exe into the directory C:\srcds
I would like Batch to look in that directory for hldsupdatetool.exe and if its not there to download the installer from the link above.

second of all, in the Left4Dead installation (Which i dont have below) it requires you to make a  sever.cfg file in the directory C:\srcds\l4d\left4dead\cfg with the content

Code: [Select]
hostname Server Name Here
// Rcon Cvars
rcon_password “your recon password” //Set’s remote control password
// Server Cvars
mp_disable_autokick 1 //Prevents a userid from being auto-kicked
sv_allow_color_correction 0 //Allow or disallow clients to use color correction on this server.
sv_allow_wait_command 0 //Allow or disallow the wait command on clients connected to this server.
sv_alltalk 0 //Players can hear all other players, no team restrictions
sv_alternateticks 0 //If set, server only simulates entities on even numbered ticks.
sv_cheats 0 //Allow cheats on server
sv_clearhinthistory 0 //Clear memory of server side hints displayed to the player.
sv_consistency 1 //Whether the server enforces file consistency for critical files
sv_contact “[email protected]” //Contact email for server sysop
sv_downloadurl “” //Location from which clients can download missing files

// Lan or internet play, Server region cvars
//sv_lan 0 //Server is a lan server ( no heartbeat, no authentication, no non-class C addresses )
sv_region 255 // Region Codes: 0 - US East coast, 1 - US West coast, 2 - South America, 3 - Europe, 4 - Asia, 5 - Australia, 6 - Middle East, 7 - Africa, 255 - world

// Server Logging
sv_log_onefile 0 //Log server information to only one file.
sv_logbans 1 //Log server bans in the server logs.
sv_logecho 0 //Echo log information to the console.
sv_logfile 1 //Log server information in the log file.
sv_logflush 0 //Flush the log file to disk on each write (slow).
sv_logsdir “logs” //Folder in the game directory where server logs will be stored.

//Server Rates
sv_maxcmdrate 100 //(If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate.
sv_unlag 1
sv_maxunlag .5
//Fix to get your server onto the master lists
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.189:27011
sv_steamgroup //this is your group’s steam group id.. allows members to join from main menu add
//sv_steamgroup_exclusive 1 //to make it exclusive and private
z_difficulty “Impossible” “//this is the difficulty setting

Again i want batch to go look for this file and if its not present and to add in that file in the right location.

I would like these to be extra options on the main menu. I really dont have a clue on how to make it do these things :/




What ive got so far...

Code: [Select]
@echo off
title start server or update
:start
cls
echo Hi, do you want to start the server or update?
echo.
echo 1. Start server
echo 2. Update menu
echo 3. Quit
set /p choice=enter your choice..:
if %choice%==1 goto startserver
if %choice%==2 goto update
if %choice%==3 exit

:startserver
cls
c:\srcds\orangebox\srcds.exe -game garrysmod +map gm_flatpromob27 -maxplayers 16 -autoupdate
exit

:update
cls
echo What game do you want to update?
echo.
echo 1. Garrysmod
echo 2. Team Fortress 2
echo 3. Counter-Strike Source
echo 4. Go back
echo 5. Quit
set /p choice=enter your choice..:
if %choice%==1 goto gupdate
if %choice%==2 goto tfupdate
if %choice%==3 goto cssupdate
if %choice%==4 goto start
if %choice%==5 exit

:gupdate
cls
echo finding dir
cd C:\srcds
echo launching updater
hldsupdatetool
echo updating garrysmod
hldsupdatetool -command update -game garrysmod -dir C:/srcds
echo update complete
pause
goto start

:tfupdate
cls
echo finding dir
cd C:\srcds
echo launching updater
hldsupdatetool
echo updating Team Fortress 2
hldsupdatetool -command update -game tf -dir C:/srcds
echo update complete
pause

Lemonilla



    Apprentice

  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: Half-Life Dedicated Server Batch File
« Reply #1 on: May 06, 2013, 04:26:32 AM »
I don't have time to write out the whole installation thing, but here's how you do it.
Code: [Select]
if not exist C:\srcds\l4d\left4dead\cfg\sever.cfg (
echo hostname Server Name Here >>C:\srcds\l4d\left4dead\cfg\sever.cfg
echo // Rcon Cvars >>C:\srcds\l4d\left4dead\cfg\sever.cfg
echo rcon_password “your recon password” //Set’s remote control password >>C:\srcds\l4d\left4dead\cfg\sever.cfg
echo // Server Cvars >>C:\srcds\l4d\left4dead\cfg\sever.cfg
...
)
If the pathways have spaces in them, you need to put them in quotations.
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

Salmon Trout

  • Guest
Re: Half-Life Dedicated Server Batch File
« Reply #2 on: May 06, 2013, 06:46:41 AM »
Quote
I would like Batch to look in that directory for hldsupdatetool.exe and if its not there to download the installer from the link above.

Download wget.exe and put it in the same folder as the batch then put this line in the batch

if not exist "c:\srcds\hldsupdatetool.exe" wget.exe "http://www.steampowered.com/download/hldsupdatetool.exe" -o "c:\srcds\hldsupdatetool.exe"


foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Half-Life Dedicated Server Batch File
« Reply #3 on: May 06, 2013, 06:52:46 AM »
Old post alert.  The spammer (now deleted) bumped a post from 2010.