1. Post #1
    Arkaniad's Avatar
    January 2009
    37 Posts
    Disclaimer: Not responsible for any confusion induced by this tutorial. If you don't understand the basics underlined from here on out, you don't deserve to have a server of your own.

    SECOND more important disclaimer: Make sure to edit the files posted to your needs. I'm not going to help you if you come to me saying: ohmagawd i kant kunnekt to ip 192.168.2.5! zomg u quack!

    I'm going to keep this moderately concise. Feel free to post / pm if you need help.

    Requirements

    [LIST=1][*]A dedicated server computer. I don't care if you have multiple cores and dual LAN cards. It's the stupidest idea EVER to host the server on your local machine. I don't even think it works.
    [*]A good internet connection (512k if it's a dedicated connection, many more if not. Dedicated as in, nobody uses it but your server.)
    [*]A Windows OS. Anything Win2K up should work just fine. Windows Server Edition == Bonus points (Less bloat, when you get down to it. You're not running accelerated graphics or media daemons. Vista and Seven are no-no's unless you're using classic theme.)
    [*]A brain. This takes a bit of tweaking to get right.
    [*]Some patience. Actually, lots of patience.[/LIST]
    Installing the base

    Go here and download the Windows version of SRCDS. Ignore everything else.

    Access your server, copy the install file, and install to C:\srcds for easy access.

    Now, open up Notepad, and copy and paste these lines.

    Code:
    @echo off
    cd .\
    echo Updating/installing CS:S
    hldsupdatetool -command update -game "Counter-Strike Source" -dir .
    echo Updating/installing dods
    hldsupdatetool -command update -game "dods" -dir .
    echo Updating/installing hl2mp
    hldsupdatetool -command update -game "hl2mp" -dir .
    echo Updating/installing tf
    hldsupdatetool -command update -game "tf" -dir .
    echo Installing Episodic Content
    hldsupdatetool -command update -game "episode1" -dir .
    echo Updating/installing Garrysmod
    hldsupdatetool -command update -game garrysmod -verify_all -retry -dir .
    echo Update/installation Complete
    pause
    Here's the tricky part.

    [LIST=1][*]Click File > Save As...[*]In the file name box, type hldsupdater.bat[*]In the box that says "Text documents (.txt)", change it to All Files (*.*)
    [*]Leave encoding set to whatever it is. It doesn't matter.
    [*]Save it to C:\srcds[/LIST]
    Volia. If there are game content files that you don't want, remove the two lines for it from the batch file.

    For example, lets say I don't want DOD:S on my server. I remove this:

    Code:
    echo Updating/installing dods
    hldsupdatetool -command update -game "dods" -dir .
    Anyways. Let that sucker run, It will take a while.

    Customizing

    You have to do some tweaking now.

    Your server's garrysmod folder is C:\srcds\orangebox\garrysmod now, so you can install addons that you like. Remember this, though. The more addons you have, the more likely it is that you will get join crashes when people join. This is even more true on weaker serving machines. Trust me, I've spent hours picking out addons that I simply don't need because they just joincrash so much.

    Add maps too, you can never have too many maps.

    So, now you have addons and maps. This is good, but we still need to configure some server settings.
    Rule of thumb: It is an addon, when, if you go inside the folder it has a file called "info.txt"
    If it's an addon, go out of the folder and drag the entire folder into the addons folder.

    Open up the cfg folder inside your server's garrysmod folder. Create a file called "server.cfg" if it doesn't already exist (Use the method we did earlier, saving a file as All Files (*.*) except instead of hldsupdate.bat, use server.cfg)

    Here is an example, taken from my server.

    Code:
    "ServerSettings"
    {
    	"hostname"				"Ark's 24/7 Spacebuild of WIN"
          "rcon_password" 			"nottherealpassword" 
          "sv_password" 			""
    	"sv_region" 			"0" // eastcoast: 0 - westcoast: 1 - south america: 2 - europe: 3 - asia: 4 - australia: 5 - middle east: 6 - africa: 7 - world: 255
    	"sv_lan"				"0"
    fps_max 700
    // Sandbox server settings
    	"sbox_allownpcs"			"1"
    	"sbox_godmode"			"0"
    	"sbox_plpldamage"			"0"  // set this to 1 to disable player vs player damage.
    	"sbox_playergod"			"0"
    	"sbox_noclip"			"1"
    
    // Sandbox limits
    	"sbox_maxprops"			"150"
    	"sbox_maxragdolls"		"5"
    	"sbox_maxnpcs"			"10"
    	"sbox_maxballoons"		"10"
    	"sbox_maxeffects"			"50"
    	"sbox_maxdynamite"		"10"
    	"sbox_maxlamps"			"20"
    	"sbox_maxthrusters"		"30"
    	"sbox_maxwheels"			"20"
    	"sbox_maxhoverballs"		"20"
    	"sbox_maxvehicles"		"6"
    	"sbox_maxbuttons"			"20"
    	"sbox_maxsents"			"20"
    	"sbox_maxemitters"		"5"
    	"sbox_maxspawners"		"3"
    	"sbox_maxturrets"			"2"
    
    	"sbox_maxwire_wheels"			"20"
    	"sbox_maxwire_waypoints"		"30"
    	"sbox_maxwire_values"			"20"
    	"sbox_maxwire_twoway_radioes"		"30"
    	"sbox_maxwire_turret"			"10"
    	"sbox_maxwire_thrusters"		"30"
    	"sbox_maxwire_target_finders"		"10"
    	"sbox_maxwire_speedometers"		"14"
    	"sbox_maxwire_emitters"			"25"
    	"sbox_maxwire_simple_explosive"	"30"
    	"sbox_maxwire_sensors"			"30"
    	"sbox_maxwire_screens"			"20"
    	"sbox_maxwire_relays"			"20"
    	"sbox_maxwire_rangers"			"20"
    	"sbox_maxwire_radioes"			"30"
    	"sbox_maxwire_sockets"			"20"
    	"sbox_maxwire_plugs"			"20"
    	"sbox_maxwire_pixels"			"20"
    	"sbox_maxwire_panels"			"20"
    	"sbox_maxwire_outputs"			"20"
    	"sbox_maxwire_oscilloscopes"		"20"
    	"sbox_maxwire_locators"			"30"
    	"sbox_maxwire_lights"			"16"
    	"sbox_maxwire_inputs"			"20"
    	"sbox_maxwire_indicators"		"21"
    	"sbox_maxwire_hoverballs"		"20"
    	"sbox_maxwire_gyroscopes"		"10"
    	"sbox_maxwire_gpss"			"10"
    	"sbox_maxwire_gate_trigs"		"30"
    	"sbox_maxwire_gate_times"		"30"
    	"sbox_maxwire_gate_selections"	"30"
    	"sbox_maxwire_gate_memorys"		"30"
    	"sbox_maxwire_gate_logics"		"30"
    	"sbox_maxwire_gate_comparisons"	"30"
    	"sbox_maxwire_gates"			"50"
    	"sbox_maxwire_explosive"		"30"
    	"sbox_maxwire_dual_inputs"		"20"
    	"sbox_maxwire_detonators"		"20"
    	"sbox_maxwire_buttons"			"25"
    	"sbox_maxwire_adv_inputs"		"20" 
    
    }
    Adjust to your needs. If you want to use less system resources set the limits lower. I just wing it and change the limits in-game by admin mod (Which, we'll get to later.)

    Now, go to your server desktop or somewhere easy to access, and create this .bat file:

    Code:
    @echo off
    cls
    echo Protecting srcds from crashes...
    echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
    title srcds.com Watchdog
    :srcds
    echo (%time%) srcds started
    start /wait c:\srcds\orangebox\srcds.exe -console -game garrysmod -hostname  -ip 192.168.2.5 -port 27015 +sv_lan 0  +map sb_gooniverse -gamemode sandbox +sv_gamemode SB3 +sv_defaultgamemode sandbox +maxplayers 24 +sv_maxfps 512 -maxfps 512 
    echo (%time%) WARNING: srcds closed or crashed, restarting.
    goto srcds
    Name it whatever you want, as long as it ends with .bat

    Let's examine the main line.

    Code:
    start /wait c:\srcds\orangebox\srcds.exe -console -game garrysmod -ip 192.168.2.5 -port 27015 +sv_lan 0  +map gm_construct -gamemode sandbox  +maxplayers 24 +sv_maxfps 512 -maxfps 512
    Basically, here's what it's saying.

    Launch the orangebox engine in console mode, run the game Garry's Mod, set IP to the network adapter's assigned IP (You don't need this unless you have multiple network adapters connected and only want it to listen on one, in which case you can find the IP of the desired adapter by opening a command prompt and typing "ipconfig", where you will be able to find the adapters and their corresponding IP addresses.)
    Set listening port to 27015 (Default, but you have to change it if you have multiple servers on one machine.)
    Make sure it's not a LAN server but an internet server
    Start with map gm_construct
    Set gamemode to sandbox (default)
    Set maximum player slots (Usually want to set this lower.)
    Set maximum frames per second.
    (Frames per second is how many physics frames the server calculates a second. It's nice to have this at a high level, but by default it runs at 64 maximum, even with sv_maxfps set, but i will add the workaround later.)

    Edit the BAT file for your specific situation

    So now you have a server with addons and maps.

    Installing Goodies


    Now you can go ahead and grab your favorite admin mod real quick. I prefer ULX or Evolve.
    Just drop it in the addons folder. Nothing else needs to be done with that for now.



    Run your server,
    Currently, it's a basic sandbox gamemode with addons and no admin mod. You can connect by LAN, but not by internet yet.

    So go ahead, launch GMOD, open console and type "connect ip"

    Where "ip" is the LAN address of your server (Usually 192.168.(0,1,2).x)

    Like, some possible addresses:

    192.168.2.5
    192.168.0.6
    192.168.1.2

    You get the picture.
    The lan IP address rarely ends with 1 unless the server is the computer everyone on your network connects to to get internet.
    192.168.x.1 is, for the most part, the router's address.

    So now you're in your server, hopefully.

    Finalizing

    But now you want Owner or Super Admin to make the server truly yours.

    So, remember that RCON password we set earlier in server.cfg? (Forgot? Look back up and make sure you edit that file!)

    Make sure you're still in the server and do this.

    Hit the console key
    Type "rcon_password <password here>" Without quotes, and replace <password here> with the actual password.

    Now, if you type "rcon <command>", that command will be run on the server's console. (Or you could always remote desktop to the server and run the commands, but.)

    Now, for specific mods:

    ASSMod:
    ASS_GiveOwnership (part of name, player ID) (Player ID is the number before the player's name when you type Status in console)
    Exmaple: ASS_GiveOwnership arche

    ULX:

    ulx_setrank (pname, pid) (rank) (immunity)
    (Example: Superadmin Immunity for me: ulx_setrank arche SuperAdmin Immunity) (Haven't used ULX for a while, don't kill me.

    Evolve:

    ev_SetRank <name> Owner

    Now you have to bind a key to the admin menu (My favorite is X)

    bind x +ASS_Menu
    or
    bind x +ev_menu
    or
    bind x ulx_menu

    Now you can go abuse those admin powers.

    Opening up to internet


    Now we have to get it out on the internet.

    Protip: If your router has an option for it, set your server in the DMZ. But only if it is a windows OS with Windows Firewall built in, or a third party firewall. DMZ makes it so that the router's firewall has no effect on the targeted computer. To set the DMZ you usually just put in the server's LAN IP.

    Now, port forwarding was really hit or miss for me. Not going to lie. Lots of people say different things about port forwarding. This is what usually works.

    Ports 27000-27030 TCP and UDP
    Port 4380 UDP

    Should work from internet now.

    Go to www.whatismyip.net
    Copy the IP to clipboard (This is your external IP, the one that you want to give to friends to connect to your server)

    Go into GMOD console and type "connect ip" but this time, press ctrl and V to paste the IP into console.

    Connect.

    Volia, server.


    Optional: Gamemodes

    Gamemodes seem overcomplicated to me.
    Basically, here's what I would do for DarkRP.

    Put the darkrp gamemode in to gamemodes/

    Edit the server batch file and add
    Code:
    -gamemode DarkRP +sv_gamemode DarkRP +sv_defaultgamemode DarkRP
    Go into game.cfg and add

    Code:
    sv_gamemode DarkRP 
    sv_defaultgamemode DarkRP
    Make sure that the DarkRP gamemode's folder is named DarkRP. The gamemode corresponds with the folder name when it comes to loading the gamemode.

    __________________________________________________ ________________________________________
    Anyways.
    Did I miss something?
    Want images?
    More detail about something?

    This is still pretty much a draft. Feedback and criticism much appreciated.

    Parts borrowed from the Garry's Mod Wiki article on dedicated server setup (Good reading!)

    Article here

    I hope I can help at least five souls.
    Reply With Quote Edit / Delete Reply United States Show Events Useful Useful x 3Informative Informative x 2Dumb Dumb x 1 (list)

  2. Post #2
    BOP
    BOP's Avatar
    January 2009
    401 Posts
    Great tutorial.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  3. Post #3
    Fuze's Avatar
    June 2007
    53 Posts
    Great tutorial man! Really helpful, better than any other guide i've used!:woop:

  4. Post #4
    Facepunch Resident Alcoholic!
    sphinxa279's Avatar
    July 2007
    8,094 Posts
    Good job mate, submit it to Interlopers.

  5. Post #5
    Observer12425's Avatar
    September 2010
    8 Posts
    Fantastic thread; geared toward the less computer-savvy but it allows those of us that already know approximately what we're doing to flesh it out completely and thoroughly with a lot less pain involved.

    Providing direct links to the files mentioned would be a nice addition, though I'm uncertain of FP's policy regarding that. Also, for those who really just want a rough-and-ready server and haven't got the slightest clue how to use a computer, you might consider adding the files for which you give the code (i.e. the batch file near the beginning) to avoid the people who go "OMG MY FILE SAVES AS *.txt.bat OMGGGGGG!!!!"

    Anyhow, excellent work.

  6. Post #6
    Fight until death, shoot until empty.

    November 2009
    15,884 Posts
    A dedicated server computer. I don't care if you have multiple cores and dual LAN cards. It's the stupidest idea EVER to host the server on your local machine. I don't even think it works.
    It Works. Its Stupid. but it Works.

  7. Post #7
    tristanguy2's Avatar
    July 2009
    690 Posts
    I do that because my local machine is the only machine capable of doing so, and I leave it on all the time anyway.


    I bumped an old thread, I'm retarded.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Late Late x 3 (list)