The RPC Utilities, reworked

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

Post Reply
Xymph
Pit Crew
Pit Crew
Posts: 5653
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

The RPC Utilities, reworked

Post by Xymph » 29 Jul 2012 12:29

With the advent of varying API versions for the ManiaPlanet dedicated server, the RPC Utilities were in need of a update to support this. I've now completed a serious overhaul of all utilities, handling not only ManiaPlanet API versions but also improving the scripts in many other ways. Here is an overview of all the changes:
  • central config file for all scripts
  • one set of scripts can be set up to handle multiple servers (each with its own config)
  • ManiaPlanet API version handling in all scripts
  • improved handling of method parameters (double, array) in sendcmd.php
  • expanded getinfos.php depending on available methods
  • enhanced callbacks filtering via command-line options, as announced before
  • improved formatting & validated XHTML for listmethods/getinfos output
  • improved error handling
  • many little coding enhancements
As always, the RPC Utilities can be downloaded from my Scripts & Tools page.

Here is the included README text:

Code: Select all

These scripts are RPC command-line utilities for TrackMania and
ManiaPlanet dedicated servers.

You must edit rpcconfig.inc.php to adjust $rpc_ip & $rpc_port (if
necessary) and $rpc_pass!  Do not change $rpc_user.


Running on Linux

  The Usage examples below are for Linux and assume your PHP5 executable
  is named 'php' and is in your $PATH.
  The scripts have mode +x, so they can also be invoked directly without
  the 'php' command, e.g.:  ./callbacks.php -h

  To set up the utilities for use with more than one dedicated, e.g.
  TMN and TMF, install them for the first server as usual.  On the
  second (and subsequent) server, create a rpc_utilities/ directory and
  inside it, make symlinks for GbxRemote.inc.php / GbxRemote.bem.php,
  rpcutils.inc.php and the four command scripts to the actual files
  in the first server's rpc_utilities/ directory.  Lastly, copy and
  adjust rpcconfig.inc.php.


Running on Windows

  PHP 5.3+ is required for the getopt() function.  If it's not yet
  installed, download the zip file from:
    http://windows.php.net/download/#php-5.3-nts-VC9-x86
  and install it (assuming the RPC utilities were unzipped to C:\ ):
    mkdir C:\rpc_utilities\php5
    cd C:\rpc_utilities\php5
    unzip <path-to>\php-5.3.##-nts-Win32-VC9-x86.zip
    copy php.ini-production php.ini
  See the included install.txt for details.  Now the scripts can
  be invoked via the corresponding .bat files instead of the 'php'
  command.  If you already had PHP 5.3+ installed, edit INSTPHP in
  the .bat files to use the correct path.


API version option

  All four scripts can handle a specific API version for the
  ManiaPlanet dedicated.  Defining this for a TrackMania dedicated
  results in an error.  Versions can be specified by number or date,
  adjacent to the '-a' option or separated by space or '=':

  Usage: php <script.php> -a0  // default or no API
         php <script.php> -a1
         php <script.php> -a 2011-10-06
         php <script.php> -a=3
         php <script.php> -a?  // list available APIs


listmethods.php:
  Make an XHTML page showing the list of supported commands / methods.
  The page title shows the game name and optional API version.

  Usage: php listmethods.php [-a#] > ListMethods.html


getinfos.php:
  Make an XHTML page showing a lot of info about the current server
  state and the list of commands / methods (just like listmethods.php).

  Usage: php getinfos.php [-a#] > state.html


sendcmd.php:
  Send an RPC command to the server. The commands / methods list can
  be found in the result of listmethods.php & getinfos.php scripts.
  If more than two arguments are required, use 'array' as the first
  parameter.

  Usage examples:
         php sendcmd.php GetServerOptions
         php sendcmd.php GetPlayerList 10 0
         php sendcmd.php SetMaxPlayers 12
         php sendcmd.php Kick bad_login
         php sendcmd.php AddGuest good_login
         php sendcmd.php SetServerName "My Server Name"
         php sendcmd.php SetServerPassword newpass
         php sendcmd.php -a0 NextChallenge
         php sendcmd.php -a2 NextMap
         php sendcmd.php SendNoticeToLogin array friend_login "message" my_login


callbacks.php:
  Monitor TrackMania / ManiaPlanet server callbacks continuously.
  Allows filtering out specific (portions of) callbacks so they don't
  obfuscate the particular callbacks you're interested in.
  The script starts by showing the output of the GetServerName,
  GetVersion, GetSystemInfo (TMF+) and GetStatus methods, and then
  shows each callback result as issued by the dedicated server.

  Usage: php callbacks.php
         php callbacks.php [-a#] [-crpmkfitw]
         php callbacks.php -h // list help info


Slig & Xymph
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Post Reply