Absurd Minds

More than 100 years without a motto.
It is currently 28 Mar 2024 12:41

All times are UTC-04:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: Set up HLTV in Linux
PostPosted: 30 Jun 2010 19:26 
Offline
User avatar

Joined: 25 Mar 2010 19:07
Posts: 8392
Well, I just recently tried setting up an HLTV server in Linux, and I was PLAGUED with problems. But the worst problem was the fact that there are absolutely no quality resources for setting up HLTV servers. The only resources are really basic HLTV-in-Winows-with-no-errors tutorials, and those didn't help at all. So hopefully this thread will be more in depth and better for people to see how to set up HLTV.

First off, HLTV is an extension of your basic HLDS server - that is, when you install any type of HLDS server, you'll install the HLTV files as well. So I started out by installing a Condition Zero HLDS server. I installed a CZero server because I was planning on connecting my HLTV to a CZero server.

Once I had my CZero server installed, I had to go to the base directory, the directory that actually contains the czero folder and the cstrike folder. For me, that meant /home/hltv2
Code:
cd /home/hltv2
Inside /home/hltv2, there are things like /home/hltv2/cstrike, and /home/hltv2/czero.

In /home/hltv2, I need to create hltv.cfg (or whatever) - hltv.cfg is the default cfg file name, so it's the one that will automatically run if you don't specify a file in your command line, but I also created one called hltv_pub.cfg for when I want to connect to my pub server, etc.

Create a config file that looks something like this:
Code:
nano hltv.cfg

// set HLTV proxy name as shown in score board
name "Absurd Minds' HLTV"

// set HLTV name, how it should appear in game server browsers
hostname "Absurd Minds' HLTV"

//HLTV player slots - the number of people who can connect to HLTV
maxclients "20"

// set offline info text clients will see as reject reason if HLTV isn't broadcasting yet
offlinetext "Sorry, game is delayed. Please try again later."

// Delay between actual server play and HLTV broadcast
delay 120.0

// allow 3.5 KByte/sec as client rate. This is good a value
// for internet broadcasts. On LAN you may set this value to 10000
maxrate 3500

// log HLTV console in proxy.log 
// logfile 1		

// local chatting for HLTV spectators enabled
chatmode 1

// if the server the HLTV is connecting to has a password, enter it here
serverpassword	"xxx"

// proxy's adim password for rcon, commentator etc.
adminpassword	"xxxx"

// show message for 5 seconds each 60 seconds in center of X axis (-1) and
// above help text bar (0.85). Color given as hexadecimal RGBA .
loopcmd 1 60 localmsg "You're watching HLTV. Visit www.valvesoftware.com" 5 -1 0.85 FFA000FF

// hltv.tga will be shown instead of the default HLTV logo in spectator GUI
// bannerfile "hltv.tga"

// these commands will be executed on connecting spectator client and may be used
// to adjust settings for HLTV (for example voice parameters)
signoncommands "voice_scale 2; voice_overdrive 16; volume 0.5; echo Voice adjusted for HLTV"

echo hltv.cfg loaded.

//Game Server Connection Info - enter the game server ip and port in the following
// format by adding a new line below the example shown. Then start your HLTV server
connect xxx.xxx.xxx.xxx:xxxx
That's the easy part. My HLTV is pretty much set up now. The hard part was getting it to run.

Running it is very similar to running a cstrike server. You use a command line to execute the server.

The most basic execution would just be
Code:
./hltv
You can also specify a port or a certain config file upon execution:
Code:
./hltv +exec hltv.cfg -port 27021
I did the most basic execution my first time, and failed miserably:
Code:
./hltv

Console initialized.
FileSystem initialized.
Error:libsteam_api_c.so: cannot open shared object file: No such file or directory
Type 'help' for a list of commands.
Well crap. That sucks. So I thought, maybe I just didn't specify enough.
Code:
./hltv +exec hltv.cfg -port 27021

Console initialized.
FileSystem initialized.
Error:libsteam_api_c.so: cannot open shared object file: No such file or directory
Executing file hltv.cfg.
WARNING! System::DispatchCOmmand: command "name "Absurd Minds HLTV" " not registered.
WARNING! System::DispatchCOmmand: command "hostname "Absurd Minds HLTV" " not registered.
WARNING! System::DispatchCOmmand: command "maxclients "20" " not registered.
WARNING! System::DispatchCOmmand: command "offlinetext "Sorry, game is delayed. Please try again later." " not registered.
WARNING! System::DispatchCOmmand: command "delay 120.0 " not registered.
WARNING! System::DispatchCOmmand: command "maxrate 3500 " not registered.
WARNING! System::DispatchCOmmand: command "chatmode 1 " not registered.
WARNING! System::DispatchCOmmand: command "serverpassword "" " not registered.
WARNING! System::DispatchCOmmand: command "adminpassword "xxx" " not registered.
WARNING! System::DispatchCOmmand: command "loopcmd 1 60 "You're watching Absurd Minds HLTV. www.absurdminds.net" 5 -1 0.85 FFA000FF " not registered.
WARNING! System::DispatchCOmmand: command "signoncommands "voice_scale 2; voice_overdrive 16; volume 0.5; echo Voice adjusted for HLTV" " not registered.
WARNING! System::DispatchCOmmand: command "connect 216.6.229.165:27015 " not registered.
Well, that didn't work. That was an even bigger error message.

The fix was to enter in this one little line before trying to execute the server (and this is something that will have to be done if you reboot, too):
Code:
export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
Now, when I executed the server, it at least started up, but I still had another problem - my server would continuously challenge the game server, but wouldn't connect:
Code:
Challenging 72.51.60.29:27015 (1/3)
Challenging 72.51.60.29:27015 (2/3)
Challenging 72.51.60.29:27015 (3/3)
WARNING! Server::Challenge: Timeout after 3 retries
Automatic connection rety...
Challenging 72.51.60.29:27015 (1/3)
Challenging 72.51.60.29:27015 (2/3)
Challenging 72.51.60.29:27015 (3/3)
I spent FOREVER trying to figure this one out. The solution was simple enough though - I changed the port from the default HLTV port (27021) to a different port.
Code:
./hltv +exec hltv.cfg -port 27016
Now I get a continously scrolling message
Code:
>
No challenge for your address.

>
No challenge for your address.

>
No challenge for your address.
I have absolutely no idea what this means, but the server is running, connected to the game server, and I can connect to the HLTV with no problems at all.

If it really really bothers you, though, you can add nomaster 1 to your hltv.cfg file. nomaster 1 means that the master server list (the spectate tab in your servers list) won't display your HLTV server, but it also solves the problem of the continuously scrolling messages.


Now, I thought to record a HLTV demo. This uses two commands. "record filename" starts recording the demo, and "stoprecording" stops the recording. I like to do this through HLSW.
Code:
record test
Recording initialized.
stoprecording
Completed demo test-1006301920-de_chateau_cz.dem.
HLTV always appends the date (YYMMDDHHMM) and the map name to the file name. You'll know that your recording was a success because it will give you the "Completed demo" output in your console.

These files will be saved in the czero folder located in the directory of your HLTV.

At first, my recordings weren't working. When I typed record, it told me that recording was initialized, but when I put stoprecording, it didn't tell me anything at all. If I typed "stoprecording" again, it would output "Not recording." So it seemed that my HLTV just wasn't saving files.

I discovered that it was because HLTV didn't have permission to write files to /home/hltv2/czero. So it was recording, but had nowhere to put the files it recorded. I fixed this by changing the mode of the directory. I did this as root, but you might be able to do it if you're the owner of the directory without having to su to root.
Code:
chmod -R 777 /home/hltv2
This changes the directory hltv2 and all subdirectories to mode 777, which is read-write-execute for all users. Once I did this, my HLTV recordings starting appearing as normal.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC-04:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited