Eggdrop script for controlling HLTV’s

As one of the founders of online gaming community #cs.gather.nl, part of the Gather Network, I’ve had quite some dealings with people cheating in online games, and people calling eachother cheaters.There are various ways to fight cheaters in the game Counter-Strike. First there’s the built-in anti-cheat from the developer, Valve, called Valve Anti-Cheat. Despite it’s name, it does little against most popular cheats.Second there’s a global blacklist of cheaters, called Steambans. This will stop people who have cheated before and have been caught by an alert admin, who submitted a recording of the cheater’s actions to Steambans.

Third, admins of the match can request a player to record his actions to a so called ‘demo’. If the user would be cheating this would show on a demo. However, no sane player would still cheat while recording a demo.
A few years ago Valve released a piece of software that allows you to watch matches. This software was created due to the increasing popularity of Counter-Strike as an “e-Sports’ game.

The software, called HLTV, is basically a proxy server that allows people to watch a match without overloading the gameserver. It has a built-in delay, so that spectating people can’t give vital informatin, like enemy positions, to the players with tools as direct messaging and voice communication.

HLTV is also able to record a demo. The great advantage of demo’s recorded by HLTV is that the single HLTV demo records all the actions of all players, and players don’t have to do anything. If an admin suscpects someone is cheating, he would go into the HLTV console and record a demo. When the match is over he could send this file to him and watch for cheats.

However, with about 30 admins in #cs.gather.nl who normally stay for just a few weeks, it’s not possible to give them shell access to a Debian GNU/Linux machine and control the HLTV consoles. It would be much easier to communicate with the HLTV consoles from IRC and only allow operators from #cs.gather.nl (the admins) to execute commands.

To do this, you need an automated chat client, a bot, and a specially written program for ths bot, a script. I had seen IRC bots that appeared to be controlling HLTV’s, but never found a script that was freely available. It also appeared that most bots depended on so-called “remote console” connections to the HLTV’s.

The remote console, or rcon, is a way of remotely controlling consoles of gameservers. Unfortunately, the developer of Counter-Strike has changed this protocol in the past a few times, leading to non-functional scripts/bots.

I also wanted to try another method of talking to the HTLV consoles. I’ve decided to let the bot talk to the HLTV consoles using the “screen” command. Screen is a GNU tool for running programs in the background. Whenever you want you can bring it back to the foreground and execute commands. It’s also possible to send commands to a screen in the background and get information from a screen running in the background.

The downside of this approache compared to the remote console approach is that all HLTV proxy’s have to run on the same physical computer as the bot controlling them. But at that cost, it is more reliable and faster to talk to the HLTV proxy’s.

To setup your own HLTV’s which you control with a bot:

Prerequisites:

Eggdrop bot

Instructions for installing eggdrop can be found at www.eggheads.org

Screen

On Debian/Ubuntu simply apt-get install screen

Step 1 – Install HLTV

wget http://www.ariekanarie.nl/tutorials/hltv.tar.bz2

tar vfxj hltv.tar.bz2

Set up hltv.cfg and hltv.sh according to your configuration.
Step 2 – Runnng HLTV

You have to run HLTV in a screen. The TCL script will send commands to this screen. If you want to run multiple HLTV’s, simply copy the installation directory and make the hltv run in a different screenname. You have to run HLTV with the same username as the eggdrop bot, else the eggdrop script can’t send commands to the screen sessions.
Step 3 – Installing/Configuring the HLTV TCL script

First download the hltv script here and put it in your eggdrop/scripts directory.
Open hltv.tcl with your favorite text editor and change the following variables to what you need/like.

set hltv_channel “#cs.gather.nl”
set hltv_command “!hltv”

Put the names of the screen sessions in a space seperated list.

For example, my hltv screen names are hltv1, hltv2, hltv3, etc…

set hltv_screens {hltv1 hltv2 hltv3 hltv4 hltv5}

Step 4 – Loading the HLTV TCL script

Open the config file of your eggdrop, and scroll down to the part where all scripts are loaded. Add the following line:

source scripts/hltv.tcl

Save and exit the editor. Rehash the bot to load the script

Commands for the script

!hltv status – Detailed statusreport
!hltv stat – Basic statusreport
!hltv connect ip:port password (optional) – Connect to server, takes optional password argument
!hltv record demoname – Starts demorecord with name
!hltv stop – Disconnects from server
!hltv stoprecord – Stops demorecording on
!hltv status – Detailed statusreport for

14 thoughts on “Eggdrop script for controlling HLTV’s

  1. Well its usefull only for those who can bring bot and hltv to 1 pc, it would be more usefull to be able control hltv when bot is on other pc. Useless for me, anyway GJ!

  2. Use the Rcon mod? That way i should rewrite almost all script exept binds O_O .. Well maby not all, must look inside when i’m free..

  3. [09:58] Tcl error [hltv_main]: No screen session found.
    child process exited abnormally

    Any Ideas on how to fix this? :)

  4. Thanks Arie for making this one the best counter-strike tcl related ever! Thanks to this tcl we already caught a lot of cheaters that without this, it will not be possible to prove they were cheating.

    take care mate!

  5. i get wrong mess

    (10:03:38) (g4u) [10:06:55] Tcl error [hltv_main]: invalid command name “Remove”
    (10:03:53) (g4u) [10:07:10] Tcl error [hltv_main]: invalid command name “Remove”

    (09:04:24) (@G4U|GeT_LosT) !hltv connect 178.73.214.2:27015
    (09:04:24) (@g4u) There is no HLTV server called ‘connect’
    (10:06:41) (@G4U|GeT_LosT) !hltv record testar
    (10:06:41) (@g4u) There is no HLTV server called ‘record’

  6. Sorry, wrote this ages ago. The script has changed a bit since this post. You’ll probably have to do something like:
    !hltv hltv1 connect ip:port

  7. Okej i look.
    Thx man.

    If you want, I have a clear script for linux to book HLTV from.
    I can send it to you if you want this works only on a HLTV right now.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>