FrederikP / csgo-ts-mover

Moves players to teamspeak channels according to the team they are on. Especially fun for retake and similar game modes.
MIT License
14 stars 5 forks source link

Build Status

csgo-ts-mover

Moves players to teamspeak channels according to the team they are on. Especially fun for retake and similar game modes.

Overview

The provided functionality is realized using two components. The first component is a sourcemod plugin. This plugin is only responsible for communicating team changes. The other component is a web service that talks with the teamspeak server and reacts to the change information received by the sourcemod plugin. Basically the information flow for team changes looks like this:

[CSGO] -> [ts-mover SourceMod Plugin] -> [ts-mover Service] -> [Teamspeak]

Setup

Requirements

Essential Files

Tutorial

Intro

This tutorial is supposed to be a simple entry point for admins who don't really know where to start. I wouldn't recommend setting everything up like this forever. In this tutorial we won't use docker for example even though I recommend to use it, especially when running many different game servers or other services on your server. I try to keep this tutorial as simple as possible. Everything will happen on the command line and no web admin frontend (like plesk) will be required. This should give everyone the same chance to get the csgo-ts-mover setup going.

I will use Ubuntu/Debian as an example linux distro, because it is often used in the game server world. If you are running a different distro you'll need to adjust some of the commands to your needs (for example when installing dependencies.)

Requirements

Steps

  1. Download package requirements for this tutorial

    sudo apt update
    
    ### Run this to upgrade existing packages on your system (often a good idea..., but not really part of this tutorial):
    # sudo apt upgrade
    
    sudo apt install wget screen python3-pip python3-virtualenv
  2. Change directories to your csgo sourcemod plugins directory and download the plugin from the releases page. Replace [...] with your actual path prefix

    cd [...]/csgo/csgo/addons/sourcemod/plugins/
    wget https://github.com/FrederikP/csgo-ts-mover/releases/download/0.1.0/ts-mover.smx
  3. Run your csgo server to generate the config file at [...]/csgo/csgo/cfg/sourcemod/ts-mover.cfg. If you follow this tutorial, you shouldn't need to edit the file for now.

  4. Create a new empty directory somewhere on your server (e.g. your home dir). It should not be part of the csgo installation.

    mkdir ~/csgo-ts-mover
    cd ~/csgo-ts-mover
  5. Download the server code and the example config from github

    wget https://raw.githubusercontent.com/FrederikP/csgo-ts-mover/master/ts-mover-service.py
    wget https://raw.githubusercontent.com/FrederikP/csgo-ts-mover/master/ts-mover-service-config.yaml
  6. Adjust the ts-mover-service-config.yaml to your needs. The configuration values are explained in the example file.

    edit ts-mover-service-config.yaml
  7. Initialize and activate a python3 virtualenv to keep the python dependencies separated from other stuff on your system

    ### From here on out we'll use a screen session, so we can later detach it and keep it running. We can then also re-attach to it later to read logs, etc.
    screen -S csgo-ts-mover
    ### Your terminal will be cleared at this point
    
    ### Create virtualenv in venv subfolder
    virtualenv -p python3 venv
    
    ### Activate virtualenv (the dot is important)
    . venv/bin/activate
  8. Install python dependencies

    pip install flask ts3 PyYAML
  9. Start the server (at the end of this step, the csgo plugin has someone to talk to)

    export FLASK_APP=ts-mover-service.py
    ### Note: If you want need the service to listen on other interfaces (default is localhost) use --host 0.0.0.0 or --host <IP> .
    ### For this simple tutorial, the following should suffice
    flask run --port 6666
    ### You should now see logs of the csgo-ts-mover server
  10. Try out your setup by playing csgo

    • You should see log entries when connecting to the server
    • You can detach and keep the ts-mover-service running using CTRL-A + D (see screen manual)
    • You can reattach using screen -r csgo-ts-mover
    • When attached you can stop the server with CTRL-C. Do that and start again when you changes the config file
    • When you encounter issues please provide logs from the csgo-ts-mover and logs from your csgo server

Things to note

Future ideas

Contributing