Update: this functionality has been incorporated into my Killing Floor 2 Linux Server Installer. I recommend you use that instead.

Table of Contents Preamble

Installation System Steam

Usage

Preamble

With the Killing Floor 2 Treacherous Skies patch things got considerably harder, especially on HoE difficulty. So, more than ever, it’s critical to have good players and good perks, otherwise your wipe is guaranteed.

On top of that, now we have the prestige system which resets your perks to zero. Unfortunately, a good number of vets are under the impression that their gaming skills can somehow make up for the perk skills they lack, such as:

explosives immune to the siren’s scream

+500% shotgun penetration

+200% syringe recharge rate and +50% syringe potency

+500% call out range

+100% mag size

no damage reduction from shooting through ZEDs

40% reduced damage by parry

The list goes on, you get the idea. While that’s definitely not the case, there’s just no end to arguing with such vets, both on reddit and in game chat. They refuse to go suicidal, let alone hard, because that’s just so degrading, you know. That’s for kiddies, I’m a grown up KF vet with awesome gaming skills, so I have a free pass to HoE!

Anyhow, the good news is, there’s a solution, that won’t even derank your server: kf2_autokick for the rescue! This awesome bot will allow you to automatically kick/ban players based on the minimum perk level requirements you set. No more level 3 survivalists ruining wave 7.

Let’s do it!

Installation

This guide assumes you’ve fully completed the Dedicated Killing Floor 2 Server on Linux tutorial, so everything here will be explained as such.

System

First you need to do some administration, so do these as your regular user (i.e. not the steam user):

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo sudo yum install nodejs yarn dos2unix

Now create a system service file to run the bot:

sudo mcedit /etc/systemd/system/kf2autokick.service

Then paste the following (Shift + Insert):

[Unit] Description=KF2 Auto-Kick Bot After=syslog.target network.target [Service] Type=simple User=steam Group=steam ExecStart=/bin/node /home/steam/kf2autokick/lib/index.js --config=/home/steam/Config/autokick.json Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target

Save with F2, then exit with F10. Now also apply the changes, and make autokick start automatically:

sudo systemctl daemon-reload sudo systemctl enable kf2autokick.service

Create a new sudoers file so that the steam user will be able to control the autokick service:

sudo mcedit /etc/sudoers.d/kf2autokick-sudo

Paste the following:

%steam ALL=NOPASSWD: /bin/systemctl start kf2autokick.service %steam ALL=NOPASSWD: /bin/systemctl stop kf2autokick.service %steam ALL=NOPASSWD: /bin/systemctl restart kf2autokick.service %steam ALL=NOPASSWD: /bin/systemctl status kf2autokick.service %steam ALL=NOPASSWD: /bin/journalctl --system --unit=kf2autokick.service --follow

Steam

Now switch to the steam user:

sudo -iu steam

Now install kf2_autokick:

git clone https://github.com/Sinewyk/kf2_autokick.git ~/kf2autokick cd ~/kf2autokick yarn --frozen-lockfile

Fix the line ending format of the current_player_row.inc file, then open it for editing:

dos2unix ~/Steam/KF2Server/KFGame/Web/ServerAdmin/current_player_row.inc mcedit ~/Steam/KF2Server/KFGame/Web/ServerAdmin/current_player_row.inc

Find the following line:

<td><%player.perk.name%></td>

Replace it with this:

<td class="foo-bar"><%player.perk.name%>;<%player.perk.level%>;<%player.playerkey%></td>

Save and exit. Now create the config file for your autokick script:

mcedit ~/Config/autokick.json

Paste the following:

{ "servers": ["http://127.0.0.1:8080"], "basicAuthorization": "Admin:YOURADMINPASSWORD", "intervalCheck": 5000, "action": "kick", "minLevel": 20, "warnings": true, "warningPeriod": 20000, "warningMessage": "Minimum level is 20. Please switch perk or you'll be auto-kicked in 20 seconds." }

This checks the user list every 5 seconds, and kicks if the user doesn’t change to a level 20+ perk within 20 seconds. Change the Admin password to yours, and change the other parameters according to your needs, then save.

Create kf2autokick.sh :

mcedit ~/bin/kf2autokick.sh

Edit it like so:

#!/bin/sh set -Eeu function errorexit () { case $? in 1) echo "Usage: $0 {start|stop|restart|status|log" ;; 2) echo 'error!' ;; esac } trap errorexit EXIT if [ "$#" -ne 1 ] then exit 1 fi case $1 in start) sudo /bin/systemctl start kf2autokick.service ;; stop) sudo /bin/systemctl stop kf2autokick.service ;; restart) sudo /bin/systemctl restart kf2autokick.service ;; status) sudo /bin/systemctl status kf2autokick.service ;; log) sudo /bin/journalctl --system --unit=kf2autokick.service --follow ;; *) exit 1 esac

Now you also need to change webadmin authentication to basic auth, since that’s what the auto-kick bot will use. Open My-KFWebAdmin.ini :

mcedit ~/Config/My-KFWebAdmin.ini

Then make sure it contains the following lines:

[WebAdmin.WebAdmin] bHttpAuth=True

Also open My-KFWeb.ini

mcedit ~/Config/My-KFWeb.ini

It needs to have these lines added:

[IpDrv.WebServer] MaxConnections=64 bEnabled=true

Now apply the changes:

kf2.sh stop kf2.sh config kf2.sh start

Usage

Now, still as the steam user, you can finally start the autokick bot:

kf2autokick.sh start

If you make changes to autokick.json , make sure to restart it to apply the changes:

kf2autokick.sh restart

If you want to see this bot in action, feel free to join my Killing Floor 2 servers!

Welp, I think that’s pretty much it. Enjoy, folks!