SourceMod Radio

About

Adds a radio player to SourceMod that supports direct stations or streaming audio with built in volume control. Also, includes a browse command to navigate a custom website or listen to a personal radio station while gaming.

Server Console Commands

  • sm_radio_enable 1/0 – Enable the radio plugin
  • sm_radio_advert 1/0 – Enable advertising the users radio station choice
  • sm_radio_welcome 1/0 – Enable the welcome message
  • sm_radio_logging 1/0 – Enable logging to the server console and log file
  • sm_radio_autoplay 1/0 – Enable the radio to auto-play on map change. Only works with direct radio station links within the menu (This isn’t a problem using the new volume control option because all the stations are direct stream links)
  • sm_radio_vol_cont 1/0 – Enable volume control under all supported mods (Limited by the mods SourceMod supports)
  • sm_radio_init_conn_vol 0.01/1.0 – When Volume support is active, this sets the initial volume for a user on first connect (0.10 recommended (10%) in CS:GO at least)
  • sm_radio_auto_update 1/0 – Enable the plugin to automatically update (If available updates are found)
  • sm_radio_volume_wrapper_type 0/1 – Which audio player to use in volume control:
    0 = Use the HTML5 audio player
    1 = Use the JPlayer audio player
    If you experience playback issues in your current mod of choice – Try changing this setting first.

Client Console Commands

  • sm_radio – Pop up the radio station menu
  • sm_radiooff – Turns the radio off
  • sm_roff – Turns the radio off
  • sm_browse “www.site.com” – browse www.site.com

Supported Languages

  • English
  • German
  • Russian
  • French
  • Italian
  • Spanish
  • Turkish
  • Polish

Chat Usage

  • !radio or /radio – Pops up a radio stations menu – Stations are configurable through radiostations.ini or radiostations_vol.ini if volume control is enabled
  • !radiooff or /radiooff – Switches off the radio
  • !roff or /roff – Switches off the radio
  • !browse “www.site.com” or /browse “www.site.com” – Browse a website of choice

Installation

    • radio.smx -> addons/sourcemod/plugins
    • motdf.smx -> addons/sourcemod/plugins – Required for CS:GO to fix station loading and possibly other mods down the line (Depending on Valve changes/updates)
    • updater.smx -> addons/sourcemod/plugins – Keeps the plugin auto-updated to the latest release
    • radio.sp -> addons/sourcemod/scripting
    • updater.inc -> addons/sourcemod/scripting – Only if you want to recompile
    • radio.phrases.txt -> addons/sourcemod/translations
    • plugin.radio.cfg -> cfg/sourcemod
    • radiostations.ini -> cfg/sourcemod
    • radiostations_vol.ini -> cfg/sourcemod
    • smjansson.ext.(.dll/.so) -> addons/sourcemod/extensions – Required for MOTD Fixer
    • SteamWorks.ext.(.dll/.so) -> addons/sourcemod/extensions – Required for Updater and MOTD Fixer
    • radio_wrappers.zip -> Your own custom web server (Feel free to use my host with the exception of Google Analytics and AdSense (Supports the plugin and hosting costs).

html_rvw.html/jplayer_rvw.html (Radio Volume Wrapper) – Enables the volume control option to function correctly inside the plugin – Only need this if wanting to self-host the web scripts (Running on my host).

All radio station links can be setup in radiostations.ini and radiostations_vol.ini

Notes

With the new ability to add direct streams into the plugin. Check out ShoutCast.com for a big list of audio stations that can be added directly.

Quick bit of info on how to add your own custom station:

  1. Pick any station you would like to add inside the plugin from the ShoutCast website
  2. Before each station name, they will have a “Play” and “Download” button.
  3. Select Download and choose “Winamp (PLS)” and make sure to save it locally to disk (Don’t “Open With” directly inside your audio player).
  4. Now we open the tunein-station.pls inside notepad or your favourtie text editor, and it will look something along the lines of:

numberofentries=1
File1=http://listen.shoutcast.com:80/RadioBeatsFM
Title1=Radio Beats FM
Length1=-1
Version=2

Where it says “File1=http://listen.shoutcast.com:80/RadioBeatsFM” is the stream URL. Copy everything after the equals sign “http://listen.shoutcast.com:80/RadioBeatsFM” and add it along with a self explanatory title (Station name would be the best choice) to radiostations_vol.ini like:

“Radio Beats FM” http://listen.shoutcast.com:80/RadioBeatsFM/;

Last step we did at the end of the URL was adding “/;” which gives direct access to the stream under ShoutCast hosted servers.

For the auto-update feature to work inside the plugin, you’ll need to install the SourceMod Updater plugin by GoD-Tony which can be found here – Check this list for which files are auto-updated here. This is included in the base package as of v1.0.0.23

Final note, the radistationsX.ini files are parsed after every map change, Make sure to update the one depending on your setup for the old style use radiostatons.ini or the new volume control is done using radiostations_vol.ini. This is all based around the “sm_radio_vol_cont” console variable.

MOTD Fixer – This is required to restore full functionality under CS:GO and potentially other mods later down the line. All the info can be found here on how to install and configure. This is included in the base package as of v1.0.0.23

You need to press play inside the web player for stations to load with Steam autoplay permission changes under Chromium Embedded Framework

If you’re still confused about anything. Give me a shout using “Contact Me” in the top right or over on the SourceMod forums.

Download

Download from my personal host here and extract straight to your game server directory.
radio_wrappers.zip can be downloaded here and put on your own custom webserver – Don’t forget to edit the radiostations.ini and radiostations_vol.ini or use my own webhost – The choice is up to you.
Update radiostations_vol.ini with Sub-Genres included – Download – Much better list to pick and add specific styles as you like.
The Official SourceMod thread is here.

Support

Any support is welcome and much appreciated, especially if you frequently use any of my plugin(s).
Really easy way to support the server and plugin development costs is to keep the html_rvw.html/jplayer_rvw.html hosted at “dubbeh.net” inside the config text files or or sign up for Vultr using my affiliate URL here for $100 credit, available for a limited time (Top 3 rated VPS host with multiple locations).
If you want to donate directly, please send it to the SourceMod project.

Credits

SourceTunes, sessus, gH0sTy, InflatableSoulmate, Calystos, Swagger, jack_wade, Darkthrone, Maxximou5, kin5, MihaAndTema, GoD-Tony, Dr. McKay, chalr, CamerDisco And Bara

Version History

v1.0.0.23

  • Fully fixed CS:GO support with MOTD Fixer
  • Left 4 Dead support added
  • Added a new radiostaions_vol.ini – Thanks to Caaine
  • Included Updater by GoD-Tony and MOTD Fixer in the base package

v1.0.0.22

  • Now using More-Colors by Bara
  • Fixed a small issue with GetClientFromSerial returning 0
  • Updated both radionstations_vol.ini with fixed settings options

v1.0.0.21

  • Fixed another issue in the translation file

v1.0.0.20

  • Fixed issues with Turkish translation and added Polish support, thanks to CamerDisco

v1.0.0.19

    • Move to thread safe (GetClientSerial in the timer function)
    • Added Turkish translations – Thanks to chalr
    • Huge station list inside “radiostations_vol.ini” from the ShoutCast API

Just a little sample before the major overhaul in 1.0.1.0
Feel free to edit them as you like – Each category has “// Name” before each section

v1.0.0.18

  • Plugin now auto-creates the config file, if not found
  • Added support for colors in the translation files (using colors.inc)
  • Fixed the problem with the plugin unable to start when updater wasn’t installed (Thanks Dr. McKay)

v1.0.0.17

  • Volume control is now supported (Thanks to kin5!)
    It has to be a direct radio stream using the wrapper (sm_radio_vol_cont 1/0 to enable or disable and update radionstations_vol.ini accordingly – If using the new feature)
  • Plugin now supports auto-updating with the SourceMod Updater plugin
  • Russian translation updated and other languages (Thanks MihaAndTema!)
  • Cookies are now saved for volume control or direct station linking (so no need to update saved station with volume control on or off)
  • Added checks to make sure the MOTD URL doesn’t exceed 192 bytes
  • More checks added for NULL menu pointers to avoid any potential server crashes
  • Radio can be turned off inside the base menu

v1.0.0.16

  • Added a few more client checks to avoid very rare conditions
  • Removed the deprecated FCAR_PLUGIN from the version console variable
  • Cleaned up the code to use the new decals syntax and not mixed mode (Code was messy!)
  • Whole plugin is now containted inside a zip file for easier updating

v1.0.0.15

  • Switched from my own custom CS:GO check to GetEngineVersion – built into sourcemod function
  • Fix errors on the latest SourcePawn compiler
  • Small change to radiostations.ini – radiofix.php is now hosted on my webspace. Feel free to use it with exception of analytics, purely optional within the config

v1.0.0.14

  • Users radio stations can now be saved and reloaded on map change, but you need to make sure It’s a direct station link. New cVar added to enable it called sm_radio_autoplay – set to 1 to enable
  • Added a work around for the sm_browse/!browse command on CS:GO servers, need to put the radiofix.php (inside radiofix.zip) on your own custom web server for it to work. Thanks to Maxximou5

v1.0.0.13

  • Made a couple of changes that fixes the problems with the menu items – Thanks to InflatableSoulmate
  • Updated radiostations.ini for the latest SourceTunes
  • Hidden the MOTD panel from the !radiooff command – Still shows for !radio – So users will have a choice to switch stations in SourceTunes
  • Fixed the problem with ignoring the plugin.radio.cfg
  • Added a new cVar – sm_radio_logging 1/0 – Enable logging to the server console and log file
  • Added Russian, French, Italian and Spanish translations – Hopefuly got everyone right in the credits

v1.0.0.12

  • Unlimited number of radio stations now supported – Switched to ADT array
  • SetFailState is now ran if the plugin can’t find the radiostations.ini

v1.0.0.11

  • Increased the buffer sizes for storing the radio station URLs – Fixes a bug with the new radiostations.ini and much longer addresses

v1.0.0.10

  • Update the radiostations.ini – Thanks to SourceTunes

v1.0.0.9

  • Added a conVar to enable or disable the welcome message

v1.0.0.8

  • Re-added the tagged coloured chat strings – Forgot to add them back with the translation update

v1.0.0.7

  • Plugin now supports translations
  • Added a welcome message to clients
  • New radiostations.ini – Thanks to bolinux

v1.0.0.6

  • Changed the radiostations.ini file location – Requested by tcviper
  • Added 3 more radio stations to radiostations.ini – Thanks to everyone that recommended new stations

v1.0.0.5

  • Removed sm_radio_off_page was a bit problematic
  • Custom off page can now be setup like – “Off Page” http://www.customwebsite.com – Inside the radiostations.ini file

v1.0.0.4

  • Custom radio off page can now be set using sm_radio_off_page – “about:blank” is set as default

v1.0.0.3

  • New command sm_radiooff – Switches off the radio and displays the user an about:blank MOTD page

v1.0.0.2

  • Changed the format style from “%x” to “%d” to fix the menu problem

v1.0.0.1

  • New commands sm_browse and sm_radio

v1.0.0.0

  • Small update to allow clients to view the users station choice

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.