I just wanted to show you how to setup a dedicated tf2 server, configure it as you like and install mods too.
Downloading and installing
Download this dedicated server file:
This file will be used to update and install the server.
Save the file to an easy to access location, like C:\Server\ or D:\TF2\ .
Now you need to download the files that will make the server run(what you currently have is an installer, not files). To do this, in Win7/Vista open install directory(C:\Server) and press Shift + Right mouse button. Select “Open command window here” from the menu. A command window will pop up. Type the following in command prompt:
hldsupdatetool -command update -game tf -dir c:\Server
Change c:\Server with whatever directory you want the installation to be in.
If you are in WinXP, just type the following in notepad, save it as .bat and execute it:
c:\Server\hldsupdatetool -command update -game tf -dir c:\Server
It will start installing the server, but will also show you the following: “No installation found in C:\Server”. Just ignore it, as its not an error but an information for you to tell you “You told me to update, but there isn’t any installation. Wait, I will download all missing files”. In a few minutes the download will start and it will display you the percentage completed. The download is about 4GB and installer may exit randomly for no reason. Just launch it again and it will continue. Once you have all the files, you need to configure the server.
There is no default server configuration file and you will need to make one. To do this, open notepad and copy following in it(Dont forget to edit it as you want to):
rcon_password “” //Set’s remote control password
sv_rcon_banpenalty 15 //Number of minutes to ban users who fail rcon authentication
sv_rcon_log 1 //Enable/disable rcon logging.
sv_rcon_maxfailures 3 //Max number of times a user can fail rcon authentication before being banned
sv_rcon_minfailures 5 //Number of times a user can fail rcon authentication in sv_rcon_minfailuretime before being banned
sv_rcon_minfailuretime 10 //Number of seconds to track failed rcon authentications// Server Password
sv_password “” // Password protects server// Server Cvars
mp_allowspectators 1 //Toggles whether the server allows spectator mode or not
mp_autoteambalance 1 //Toggles server autoteambalance
mp_bonusroundtime 5 //Time in seconds after round win until round restarts
mp_chattime 5 //amount of time in seconds players can chat after the game is over
mp_disable_autokick 1 //Prevents a userid from being auto-kicked
mp_enableroundwaittime 1 //Enable timers to wait between rounds.
mp_fadetoblack 0 //fade a player’s screen to black when he dies
mp_falldamage 5 //Amount of damage players sustains from a fall
mp_flashlight 0 //Toggles flashlight on or off
mp_footsteps 1 //Toggles footsteps on or off
mp_forcecamera 0 //Restricts spectator modes for dead players
mp_forcerespawnplayers 1 //Force all players to respawn.
mp_forcewin 1 //Forces team to win
mp_idledealmethod 2 //Deals with Idle Players. 1 = Sends them into Spectator mode then kicks them if they’re still idle, 2 = Kicks them out of the game
mp_idlemaxtime 10 //Maximum time a player is allowed to be idle (in minutes)
mp_maxrounds 10 //max number of rounds to play before server changes maps
mp_teams_unbalance_limit 2 //Teams are unbalanced when one team has this many more players than the other team. (0 disables check)
mp_teststalemate 0 //Test the stalemate mode. Parameter: <0/1>. If 1, the map will reset at the end.
mp_time_between_capscoring 5 //Delay between scoring of owned capture points.
mp_timelimit 20 //game time per map in minutes
mp_winlimit 10 //Max number of rounds one team can win before server changes maps
sv_allow_color_correction 1 //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_allowdownload 1 //Allow clients to download files
sv_allowupload 1 //Allow clients to upload customizations files
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_autosave 0 //Set to 1 to autosave game on level transition. Does not affect autosave triggers.
sv_bonus_challenge 0 //Set to values other than 0 to select a bonus map challenge type.
sv_cacheencodedents 1 //If set to 1, does an optimization to prevent extra SendTable_Encode calls.
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 “” //Contact email for server sysop
sv_downloadurl “” //Location from which clients can download missing files
sv_enableoldqueries 1 //Enable support for old style (HL1) server queries
sv_pausable 0 //Is the server pausable.
// 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 4 // Region Codes: 0 – US East coast, 1 – US West coast, 2 – South America, 2 – South America, 3 – Europe, 4 – Asia, 5 – Australia, 6 – Middle East, 7 – Africa, 255 – world
sv_log_onefile 0 //Log server information to only one file.
sv_logbans 1 //Log server bans in the server logs.
sv_logblocks 0 //If true when log when a query is blocked (can cause very large log files)
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.
sv_maxcmdrate 0 //(If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate.
sv_maxrate 20000 //Max bandwidth rate allowed on server, 0 == unlimited
sv_maxreplay 2 //Maximum replay time in seconds
sv_maxupdaterate 100 //Maximum updates per second that the server will allow
sv_mincmdrate 0 //This sets the minimum value for cl_cmdrate. 0 == unlimited.
sv_minrate 0 //Min bandwidth rate allowed on server, 0 == unlimited
sv_minupdaterate 30 //Minimum updates per second that the server will allow
The main things you need to change in above configuration are:
- –hostname : This is the server’s name displayed to everyone who connects to it. Plce the name in inverted commas(” “).
- –sv_password : Use it if you want to enable a password on your server. Only people who enter password can play on your server.
- –sv_lan : Is set to 1, only the people on your LAN will be able to play on server.
You can edit other variables[aka cvar] too, but you dont need to do that right now. You can do that once you get server running.
Save it as server.cfg in C:\Server\Orangebox\tf\cfg\ . Remember, save it as .cfg not .txt!
Launching the server.
There are 2 ways to run the server. First is to run from .bat file:
c:\server\orangebox\srcds.exe -console -game tf -hostport 27015 +maxplayers 24 +map cp_dustbowl
The other way is to create shortcut of srcds.exe in orangebox folder. After making shortcut, go to its properties and add following after destination path:
-console -game tf -hostport 27015 +maxplayers 24 +map cp_dustbowl
Just run these files whenever you need to run the server.In above codes, -game tells what game to run(tf means team fortress 2), hostport is the port to use, +maxplayers is number of players allowed on server and +map is the map to start with.
Incase you see something like: “27005 port unavailable, bound to 277002” -or something similar, you need to open ports on your router. Doing this on most routers is easy:
- Go to your router page(192.168.1.1) and enter password.
- Go to Access Management >> NAT >> Virtual Server. There, open the ports from 27005 to 27021.
- Make a google search to see how to open ports on your router.
- If you have already opened the ports and are still getting error, most probably server or the game is already running and using one of the port. Close the game and restart server.
To connect to your own server, start TF2 and go to browse server. Then from LAN tab, select your server and click connect! Call your friends to join to make sure it works on internet too.
In Game Commands & Customization
When the server is running, any changes made in server.cfg will not take effect unless server is restarted. To change cvars or give other commands without turning server off, go to server console and type the name of cvar with value to change it. For example, if you want to enable cheats on your server, type:
or to change map
You can change anything from the console, and can also kick/ban players using kick/ban commands (kick <username>).Note that any changes made from console will not be saved in server.cfg!If you want to enable instant respawn on the server, just add this variable to server.cfg:
Now if you want to change the map cycle on your server or want just one map to run all the time, this can be done by editing mapcycle.txt in \orangebox\tf\. Just enter the name of maps you want to run in cycle and save. An example is this:
cp_mountainlab pl_upward koth_nucleus ctf_2fort cp_degrootkeep
You may also want to edit the welcome page shown to players. This can be done by editing motd.txt in \orangebox\tf\ .
Just type in what you want to display to users and exact text file will be shown on welcome page.
If a new TF2 update has been released, you will need to update your server too, otherwise players won’t be allowed to join your server. To update the server, you just need to run the update command we used above to install server and it will update. Everything else will go same as installing of server, except the file size.
SourceMod is a very useful plugin for a tf2 server. It allows you to specify admins, and make decisions directly from the game. You can also install many useful mods if you have this plugin installed. Some of the great features I like are:
- changing cvars directly from the game.
- kicking/muting/banning players directly.
- Show messages to users in center, top or bottom of screen(useful for ads).
- Call votes from game.
- Change map rotation/map cycle from game.
There are many more useful functions of SourceMod, you can find them on their site: SourceMod: Half-Life 2 Scripting
Installing SourceMod is really very very easy. Just download the following files before starting:
Metamod:Source – News (MetaMod, Download link is in top left)
SourceMod Downloads (SourceMod)
Metamod:Source – Make a VDF File (VDF File, to make MetaMod run. Select TF2 as game and click generate)
Unzip contents of MetaMod to \orangebox\tf\ . After successful extraction you will see an Addon folder there.
Copy the vdf file you generated from above link to this addon folder.
Unzip contents of SourceMod to\orangebox\tf\ . You will see a message asking to overwrite. Select yes, as only folder is common and not the files.
Restart the server and type following in console:
meta version sm version
If in any of commands console says “Unknown command”, then mods aren’t installed properly. Try following detailed guide here: Installing SourceMod – AlliedModders Wiki.
Using admin commands