MOTD Fixer

About:

SourceMod extension that fixes broken MOTD panels with the last few updates to CS:GO, around June-July 2017. On It’s own, this plugin won’t do much, but It’s used as an extension for other plugins that utilise MOTD panels.

Server Console Commands:

  • motdf_enable 1/0 – Enable the MOTD Fixer plugin
  • motdf_logging 1/0 – Enable the plugin to log data (This is important when trying to debug problems)
  • motdf_validatetype 0/1 – This depends on how you have the PHP/MySQL script hosted. 0 is for IP based authentication and 1 is for server tokens based (Standard is 1)
  • motdf_autoregister 0/1 – Auto-register the server on the first call to MOTDF_ShowMOTDPanel

Client Console Commands:

  • motdf_register – Registers your game server to use the script. This is only if you use token based authentication and hosted by myself or anyone else. Requires ADMFLAG_RCON access to use.
  • motdf_serverip – Returns the server IP reported by the PHP script – This is very handy for IP based authentication to get the real external IP (Some hosts proxy for DDoS protection and have a different IP reported to the script). Requires ADMFLAG_RCON access to use.

Supported Languages:

  • English – Looking to add translation support in the near future

Plugin Installation – Necessary for usage:

  1. First you need to make sure to have SteamWorks and SMJansson installed and running on your server.
  2. Now SteamWorks and SMJansson are setup, download the latest plugin release directly from GitHub here and put inside your CS:GO folder with the correct directory structure.
  3. Now reboot your game server and type in the console motdf_register – If everything was successfull, you should get a message along the lines of “Server Registered Sucessfully. Keep the server token in a safe place.”. Now you’re setup to use MOTD Fixer.
  4. If you would like the plugin to auto-update itself – Install updater by GoD-Tony that can be found here

Web Script Installation – Optional:

  1. Grab the latest package from here
  2. Once the package is downloaded, setup a subdomain to host everything (Best option – Using “public_html” as the base web root).
  3. Modify config.php for your own hosting package, everything should be self explanatory inside the config
  4. Now the config is setup, run init.sql to setup some database defaults and after the last step, the script should be setup and ready to use
  5. Once the web script is setup correcty. Go in to your game server and modify “config/motdf.txt” and point the “Base URL” to your new hosting location.

Developer Usage:

If you want to use MOTD Fixer in your own plugins.

Make sure to grab motdf.inc from GitHub – Latest version can be found here and copy to your “sourcemod/includes” folder.

Once you have that setup, add to the top of your plugin:

#include <motdf>

Then replace every call to ShowMOTDPanel with MOTDF_ShowMOTDPanel and setup the new calling convention.

/*
 * Show an MOTD Panel in CS:GO for the URL
 *
 * @param   iClientIndex = The current server client index to display to
 * @param   szTitle = MOTD panel title
 * @param   szURL = The URL to display
 * @param   bHidden = Display or Hide the panel
 * @param   iPanelWidth = MOTD Panel Width
 * @param   iPanelHeight = MOTD Panel Height
 * @return  1 on success - 0 on failure
 *
 */
native int MOTDF_ShowMOTDPanel (int iClientIndex, const char []szTitle, const char []szURL, bool bHidden = true, int iPanelWidth = 1024, int iPanelHeight = 576);

If you need any more help with development, message me here or over on the SourceMod forums.

Notes:

MOTD panels was completely removed in CS:GO, this plugin is kept here for archival purposes. Could be possible to have uses in other mods over time.

Support:

Plugin support is purely optional but really helps with coding and testing time spent on development. Feel free to white list this website in your adblock software orsign up for Vultr using my affiliate URL here for $100 credit, available for a limited time . If you’re looking for a good reliable VPS.

License:

Everything is licensed under the GPLv3 which can be found here.

Credits:

  • Thrawn (SMJansson)
  • Neuro_Toxin (Couple of ideas)
  • KyleS (SteamWorks)

Version History:

v1.07

  • Added more feedback for errors
  • Added checking for an invalid server token on URL registration
  • Changed logic inside SteamWorks_OnClientURLRegisterComplete and Handling of JSON Responses

v1.06

  • Removed all the unecessary specific URLs and only use “Base URL” in the config now
  • Added a new delete function – That issues delete on a client URL that has disconnected, before the MOTD panel is displayed
  • Added checks for cl_disablehtmlmotd on clients before trying to load an MOTD panel
  • Added initial support for translations
  • Added checks on initialization for missing Updater by GoD-Tony

v1.05

  • Fixed long URL’s not loading correctly (Increased the buffer sizes)
  • Fixed the google search example query URL

v1.04

  • Fixed IP based validation – Was only checking token and not cVar settings
  • Added more logging feedback to help with development
  • Slight change on how server tokens are sent over post
  • Plugin now only sends a LogMessage on incorret mod type – instead of SetFailState
  • Config file is now auto-created and customisable inside cfg/sourcemod/plugin.motdf.cfg
  • Added a new console variable “motdf_autoregister” – Auto-register the server on the first call to MOTDF_ShowMOTDPanel

v1.03

  • Added an extra check for disconnected clients
  • Another stage added to the Native_MOTDF_ShowMOTDPanel for feedback

v1.02

  • Changes to how client IP’s are handled
  • New command added “motdf_serverip” – Get the real server IP

v1.01

  • Fixed a typo in “motdf_validatetype” – Thanks to mlov420
  • Added an example plugin using Google and a search query string

v1.00 FINAL

  • Slightly reduced the base resolution for displayed MOTD panels

v1.00 BETA 5

  • Fixed the SteamWorks unloaded error message
    Was checking a function that wasn’t being called with GetFeatureStatus.
  • More feedback messages added and a few other code changes
  • Small issue fixed with the SMJansson.inc file

v1.00 BETA 4

  • Added support for displayed MOTD panels
  • Set a 10 second timeouts on the SteamWorks HTTP requests
  • Fixed a slight overlook on motdf_register command returning nothing
  • Replaced all instances of SteamWorks_IsLoaded() to use GetFeatureStatus
  • Added a check for SMJansson being available
  • Changed the SetFailState calls OnAllPluginsLoaded to LogMessage in-case of late loading of extensions
  • Web-script was also updated – Make sure to update that too – including the database structure

v1.00 BETA 3

  • Finally fixed the dependency issue from BETA 1-2
  • Added the include file for Updater by GoD-Tony

v1.00 BETA 2

  • Fixed plugin dependencies that was causing other plugins unable to find motdf
  • Added support for auto-updating with Updater

v1.00 BETA 1

  • Initial release