Raised This Month: $12 Target: $400
 3% 

[L4D2] How to run and join local dedicated server (Windows)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 07-15-2019 , 15:47   [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #1

Written in the hope to help some people to test their plugins locally* because Valve did it the way required a bottle of Vodka for everything to work properly.

* I didn't try to join my server from Internet (just locally - me is server and me is a client). That is possible, requires port forwarding. Search on your own.

So,

1. Steam => Library => Tools => Double click on "Left 4 Dead 2 Beta - Win32 Dedicated Server".
2. After downloading, right click on it => Properties => Local files => See local files ...
- Copy all files from "common\Left 4 Dead 2 Beta" to "common\Left 4 Dead 2".
- Copy dedicated.dll to "bin" folder.

3. Create batch (runserver.bat) file (in "common\Left 4 Dead 2" folder) with the following code:

Code:
start "" srcds -debug -condebug -usercon -console -insecure -dev -game left4dead2 -port 27000 +hostname "Source Dedicated Server" +map c5m1_waterfront +maxplayers 24 +sv_lan 1
3. Downnload SteamCMD GUI tool and run it: https://github.com/DioJoestar/SteamCMD-GUI
Open "Console" tab. Remember IP in line "Local IP address:"

4. This is important. You must start L4d2 client first (before the server).

5. Run server by double click on "runserver.bat"
Approve srcds.exe access in your firewall. Windows firewall will show you a warning automatically.

6. In L4D2 client enter in console:
Code:
connect IP:27000
where IP are numbers from the step 3. It could be something like 192.168.202.1:27000

Enjoy.

P.S. Instruction can be partially applied for other dedicated servers, like CS:GO.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 12-03-2020 at 14:03.
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 07-15-2019 , 15:53   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #2

Please, correct me, if something could be accomplished in more easy way.

This is my first experience in creating a local server.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 07-20-2019 , 14:32   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #3

Quote:
Originally Posted by Dragokas View Post
Please, correct me, if something could be accomplished in more easy way.

This is my first experience in creating a local server.
You install the game (ex csgo), you put sourcemod in game files, you run your client with -insecure and you join a map (map <map>).
__________________

Last edited by Ilusion9; 07-20-2019 at 14:33.
Ilusion9 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 07-20-2019 , 14:45   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #4

Yea, good option. No server at all.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 07-30-2019 , 09:35   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #5

Those servers created right in the client are called "listen servers" and aren't supported by sourcemod, so crashes might happen. A local dedicated server is the best option for plugin development.
__________________
Peace-Maker is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-23-2019 , 17:43   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #6

I simply install SteamCMD and run this batch to install or update L4D2

PHP Code:
@echo off

set STEAM
="C:\Servers\SteamCMD"
set GAME_DIR=C:\Servers\L4D2\
set APP_ID=222860

set STEAM_USERNAME
=anonymous
set STEAM_PASSWORD
=

cd "%STEAM%"
start "" steamcmd.exe +login "%STEAM_USERNAME%" "%STEAM_PASSWORD%" +force_install_dir %GAME_DIR% +app_update %APP_IDvalidate 
the same for CSGO but using APP_ID 740.


Then this batch to open a map selection when starting the server. Or instead of a selection just load the map, or combine the scripts to select which map and have an option to update.

PHP Code:
ECHO OFF
CLS
SET 
"s_game=srcds.exe -debug -condebug -console -game left4dead2 -netconport 27505 +hostport 27016 +clientport 27006 +exec server.cfg -insecure"
SET s_folder=C:\Servers\L4D2\
SET "s_commands=srcds.exe -command update -game left4dead2 -dir ."

:MENU
ECHO.
ECHO.                  
LEFT 4 DEAD 2  ---  DEDICATED SERVER LAUNCHER                
ECHO. ##############################################################################
ECHO.
ECHO.                                
Dead Center
ECHO.                                Dark Carnival
ECHO.                                Swamp Fever
ECHO.                                Hard Rain
ECHO.                                The Parish
ECHO.                                The Passing
ECHO.                                The Sacrifice
ECHO.                                No Mercy
ECHO.                                Crash Course
ECHO.                                10 Death Toll
ECHO.                                11 Dead Air
ECHO.                                12 Blood Harvest
ECHO.                                13 Cold Stream
ECHO.
ECHO. 
##############################################################################
ECHO.

SET /P M=Select Map or Update
ECHO.

IF %
M%==1 START %s_folder%%s_game% +map c1m1_hotel
IF %M%==2 START %s_folder%%s_game% +map c2m1_highway
IF %M%==3 START %s_folder%%s_game% +map c3m1_plankcountry
IF %M%==4 START %s_folder%%s_game% +map c4m1_milltown_a
IF %M%==5 START %s_folder%%s_game% +map c5m1_waterfront
IF %M%==6 START %s_folder%%s_game% +map c6m1_riverbank
IF %M%==7 START %s_folder%%s_game% +map c7m1_docks
IF %M%==8 START %s_folder%%s_game% +map c8m1_apartment
IF %M%==9 START %s_folder%%s_game% +map c9m1_alleys
IF %M%==10 START %s_folder%%s_game% +map c10m1_caves
IF %M%==11 START %s_folder%%s_game% +map c11m1_greenhouse
IF %M%==12 START %s_folder%%s_game% +map c12m1_hilltop
IF %M%==13 START %s_folder%%s_game% +map c13m1_alpinecreek 
__________________

Last edited by Silvers; 08-23-2019 at 17:44.
Silvers is offline
vikingo12
Member
Join Date: Nov 2018
Old 02-09-2021 , 02:53   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #7

I set up a dedicated coop server but when starting it loads mutations, how do I make it a campaign only?
vikingo12 is offline
jeremyvillanueva
AlliedModders Donor
Join Date: Jan 2021
Location: dcord:Jeremy333#7632
Old 02-09-2021 , 12:13   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #8

Hi, you could use sm_cvar mp_gamemode coop
in the listenserver.cfg
jeremyvillanueva is offline
WhatsAnName
Member
Join Date: Jun 2018
Old 03-23-2021 , 19:50   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #9

could this be done via dedicated server from the tools? that l4d2 gives u when u buy the game?
WhatsAnName is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 03-23-2021 , 20:47   Re: [L4D2] How to run and join local dedicated server (Windows)
Reply With Quote #10

WhatsAnName, read the 1st post. It is directly saying exactly what you are asking about.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode