Rcon Overview and Commands

From Pavlov VR Wiki
Jump to navigation Jump to search

RCON (Remote CONnection) is the method pavlov servers can be controlled from outside of VR. When a server is brought online, an email is sent to the owner with the RCON credentials to connect remotely. RCON can be accessed at: http://pavlovrcon.com/


Rcon Overview and Commands

Ban/Unban

If you want Ban/Unban to work file /home/steam/pavlovserver/Pavlov/Saved/Config/blacklist.txt needs to be writable by user running server. (If you followed the instructions on the wiki, username steam is running the server and creates the file).


Commands:

Help                                -Returns the full list of commands
Ban {UniqueID}                      -Bans the player from the server (adds them to blacklist.txt)
Kick {UniqueID}                     -Kicks the player from the server
Kill {UniqueID}                     -Kills the player 
Unban {UniqueID}                    -Unbans the player from the server (tries to remove the unique id from blacklist.txt)'
Banlist                             -Shows the current list of banned players
AddMod {UniqueID}                   -Adds a mod ID to the mods.txt file 
RemoveMod {UniqueID}                -Removes a mod ID to the mods.txt file
ItemList                            -Shows available items for GiveItem command
RotateMap                           -Rotates to the next map in the game.ini
SwitchMap {MapName/ID} {GameMode}   -Switches to the map/gamemode specified, ex "SwitchMap DataCenter TDM" or "SwitchMap UGC1080326389 DM"
SwitchTeam {UniqueID} {TeamId}      -Switches the specified players team
GiveItem {UniqueID} {ItemId}        -Give the specified player the Item
GiveCash {UniqueID} {CashAmt}       -Give the specified player cash
GiveTeamCash {TeamId} {CashAmt}     -Gives all members of the teamId cash
GiveVehicle {UniqueID} {VehicleID}  -Spawns Vehicle on top of player, see below for vehicle IDs
InspectPlayer {UniqueID}            -Returns information about the player specified (PlayerName, Cash, KDA, TeamId etc)
RefreshList                         -Returns a list of players on the server (unique/steamId)
Slap {UniqueID} {damage amt}        -Inflicts damage amount on player.  From zero to 100.
ServerInfo                          -Returns information about the server (ServerName, CurrentMap, PlayerCount/MaxPlayerCount etc)
Disconnect                          -Disconnects the player from Rcon
ResetSND                            -Resets the match back to round 1 keeping the same teams
SetPlayerSkin {UniqueID} {SkinId}   -Sets the skin for the specified player, see below for IDs
SetLimitedAmmoType {0-5}            -Sets the limited ammo type for the duration of the match. See below for the different ammo types available
SetPin {####}                       -Sets the password on your server, must be 4 digits e.g. "SetPin 0000". Running SetPin without a number will remove the pin from the server.
Shownametags {True/False}           -Toggles if nametags are visible or not. Useful for tactical/realistic servers, or making trailers and taking screenshots for your maps.
Shutdown                            -Shuts down the server (Shack RC only, currently untested).

TTT-only commands:

tttflushkarma {UniqueID}            -Resets a player's karma
tttsetkarma {UniqueID} {####}       -Sets the karma of a player to a value
tttsetrole {UniqueID}               -Currently broken
tttendround                         -Ends the round
tttpausetimer                       -Pauses the timer
TTTAlwaysEnableSkinMenu             -Enables the skin menu mid-round

{UniqueID} is a player's Steam ID 64. It's the 17-digit number that appears next to their names in most Rcon tools. Alternatively, if you have a player's profile URL, you can find their ID at: https://steamid.xyz/

Limited ammo types:

0 = Unlimited
1 = Limited Generic
2 = Limited Specific
3 = Custom (for modders)
4 = Limited Special
5 = Boxless Mode

Item, skin, and vehicle IDs:

A full list of all items, vehicles, and skin can be found here.

You can also run the ItemList command through Rcon to receive the most recent and up to date list of all items.

Game Modes:
DM - Death Match
KOTH - King Of The Hill
GUN - Gun Game
OITC - One In The Chamber
SND - Search and Destroy
TANKTDM - WW2 Team Death Match
TDM - Team Death Match
TTT - Trouble in Terrorist Town
WW2GUN - WW2 Gun Game
ZWV - Zombie Wave Survival
HIDE - The Hidden
INFECTION - Hidden Infection
PUSH - Push
PH - Prophunt


Connecting to RCON

Make sure whatever port you used is open in your firewall for TCP connections. Connections are simple TCP port/telnet style connections.

To test connecting to the rcon port and issuing simple commands use netcat or telnet:

nc {ip address} {port}
telnet {ip address} {port}

For the password use the md5 hash of the password in the file (this may change in the future). You can get this using

echo -n password | md5sum

If successful you should get an Authenticated=1 reply


Tools available to access Rcon interface

A good first place to start is the RCON web interface run by ArcticVR. You do this at http://pavlovrcon.com/.

If you want private control of your server, you will need to do a bit more work for it. At the simplest, using netcat (nc) or telnet as described above will give you basic access to all commands

If you want to batch commands (i.e. for moving players on to teams and triggering ResetSnd) the following script can be useful to call a pre-written batch files of commands. Call with your batch file as the first argument to the script. The file should have one command per line with first line being the hashed password as above.

 
#!/bin/bash
function slowcat(){ while read; do sleep .05; echo "$REPLY"; done; }
cat  $1 | slowcat | nc {ip address} {port}

Example batchfile:

8b96753b29612d8c98d6b696140b5d9f
ResetSnd
Disconnect




There is a very brief example above but it was not very detailed so i wanted to add a more detailed explanation

be aware that connecting and disconnecting a lot can hurt server performance

first you need to make a shell script

nano /home/steam/test.sh
#!/bin/bash
function slowcat(){ while read; do sleep .15; echo "$REPLY"; done; }
cat $1 | slowcat | nc {SERVER IP} {SERVER RCON PORT}

now exit and save the test.sh

here will will make a batch file that will just hold the rcon password and cmds we want to issue

nano /home/steam/batch
{RCON PASSWORD CONVERTED TO MD5 HASH}
{RCON CMD}
{RCON CMD}
Disconnect

here the first line has to be the rcon password converted to MD5 HASH https://www.md5hashgenerator.com/ then each line after that u can use any rcon commands the last line must be disconnect

now we need to give the sh permissions to run

sudo chmod +x /home/steam/test.sh

to run the bash script

./home/steam/test.sh /home/steam/batch

so to run the script we need to ./ the .sh then after a space we need to pass the batch

Rcon access from within VR

PavlovRconWebserver, pavlov-vr-rcon and pavlov_rcon_tcl have been designed to be accessible within VR using virtual desktop view.


pavlov_rcon_tcl: This is a tool designed to run on your desktop for access within VR

https://github.com/Oakraven79/pavlov_rcon_tcl


PavlovRconWebserver is an interface designed to be usable from everywhere all the time. (also in VR over desktop view)

Features: 
Manage multiple Linux servers with multiple pavlov servers.
Start / Stop / Update
Public player lists
Do almost all rcon commands
Change the map rotation
Determine which users can do what via roles
Manage whitelists and blacklists
Integrate the player lists on all other websites
Requirements:
Good Linux knowledge
SSH access to a linux server

https://github.com/devinSpitz/PavlovRconWebserver

While functional, the PavlovRconWebserver is still in development.

If you do plan on using this tool, we recommend asking for help on the official Discord or http://discord.spitzen.solutions, or contacting the creator on the Github page (devinspitz) for the latest info on how to use it. Failing to do so will likely result in you breaking your servers.


pavlov-vr-rcon: This is tool designed to run on your desktop for access from within VR with SND team setup

https://github.com/Krzychu81/pavlov-vr-rcon

RCON access from Discord

For the ultimate in both control and complexity of setup, use the open-source pavlov-bot. This is a discord bot that will listen for commands in your discord and execute them. Supports all RCON commands with handy features such as discord role based authentication and authorisation, player, map and team aliases (No more SteamIDs or UGC####) and enhanced "all" and team based commands. Has support for flushing non-registered players from server. Advanced features to include alerting when servers are kicking off, team killing player kick/ban and large server (PUSH/RUSH/TankTDM) player balance (count) control.

For shack users it has been updated to support Oculus ids and map aliases, so is fully functional for both server versions. See Readme.md for shack specific tweaks.

https://github.com/makupi/pavlov-bot

Horde also offers a Discord Bot to grant RCON permissions to friends in Discord, and run commands from specific channels. Invite the Horde Bot to your Discord server with this link: https://discord.com/oauth2/authorize?client_id=780880728992383077&scope=bot&permissions=199744

Tips on developing apps to use RCON

What is important if you are issuing commands using a program at high frequency is that you open one connection and put all of the commands through that open connection with a small (.1 sec is fine) delay. What you don't want to do is open a new connection for each command or shove all of the commands through super fast. First causes performance issues and the second dropped commands.