Skip to content
RustPluginGenerator

OnBoomboxStationUpdate

OnBoomboxStationUpdate is called when a player sends a station change to a BoomBox, before the server validates the station and assigns the player as owner. Returning true cancels the change.

Signature
object OnBoomboxStationUpdate(BoomBox boomBox, string text, BasePlayer player)

Parameters

Hook parameters
ParameterTypeDescription
boomBoxBoomBoxThe BoomBox entity whose radio station is being changed. Use it to read the entity position, owner or net ID.
textstringThe station identifier the client sent in the RPC, e.g. 'rustradio' or a custom stream key. Check it against IsStationValid or your own allowlist.
playerBasePlayerThe player who requested the station change. Can be null, so always null-check before using it.

Return value

Returning a non-null object (the usual choice is true) stops the original method, so the station is never validated and AssignedRadioBy is not set. Returning null lets the game continue: it runs IsStationValid(text) and, if the player is non-null, records them as AssignedRadioBy.

How it works

The hook fires inside BoomBox.Server_UpdateRadioIP, the server-side handler for the RPC a client sends when it picks a radio station on a boombox. It runs after the raw string is read from the message and before IsStationValid is checked, so text is unvalidated client input. Use it to block or inspect station changes: filter banned stream keys, restrict boomboxes to their owner or to a team, log what players tune into, or block changes while a raid is ongoing.

boomBox is the entity being tuned, player is msg.player and may be null (for example a malformed or spoofed RPC), and text is the station identifier. The hook fires for every station request, including garbage strings that would fail validation anyway, so keep the body cheap and avoid printing there.

Declaring the third parameter as BasePlayer matches the dispatch here; there is no useful narrower type to declare for this hook.

Example plugin: Restrict boombox stations to an allowlist

BoomboxStationAllowlist.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Boombox Station Allowlist", "RustPluginGenerator", "1.0.0")]
    [Description("Restricts boombox radio stations to a configurable allowlist")]
    public class BoomboxStationAllowlist : RustPlugin
    {
        private const string PermBypass = "boomboxstationallowlist.bypass";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Allowed stations")]
            public List<string> AllowedStations = new List<string> { "rustradio" };

            [JsonProperty("Show allowed stations in chat")]
            public bool ShowAllowed = true;
        }

        protected override void LoadDefaultConfig() => config = new PluginConfig();

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null) throw new Exception();
            }
            catch
            {
                PrintWarning("Configuration file is invalid, using defaults");
                LoadDefaultConfig();
            }
            SaveConfig();
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["StationBlocked"] = "That radio station is not allowed. Available: {0}",
                ["NoStations"] = "Radio stations are disabled on this server."
            }, this);
        }

        private string Msg(string key, string userId = null, params object[] args) =>
            string.Format(lang.GetMessage(key, this, userId), args);

        private void Init()
        {
            permission.RegisterPermission(PermBypass, this);
        }

        private object OnBoomboxStationUpdate(BoomBox boomBox, string text, BasePlayer player)
        {
            if (config.AllowedStations == null || config.AllowedStations.Count == 0)
                return null;

            if (player != null && permission.UserHasPermission(player.UserIDString, PermBypass))
                return null;

            foreach (string allowed in config.AllowedStations)
            {
                if (string.Equals(allowed, text, StringComparison.OrdinalIgnoreCase))
                    return null;
            }

            if (player != null)
            {
                if (config.ShowAllowed)
                    player.ChatMessage(Msg("StationBlocked", player.UserIDString, string.Join(", ", config.AllowedStations)));
                else
                    player.ChatMessage(Msg("NoStations", player.UserIDString));
            }

            return true;
        }
    }
}

The plugin defines a config list of permitted station keys (defaulting to rustradio) and a permission that bypasses the filter. In OnBoomboxStationUpdate it returns null when the config list is empty so nothing changes, returns null for players holding the bypass permission, and otherwise compares text case-insensitively against the allowlist. Any other request returns true, which cancels the server-side station change, and the player gets a localized chat message with the allowed stations. The config is loaded with a safe fallback and the permission is registered in Init.

Common use cases

  • Block unapproved radio streams

    Only allow stations from a config list so players cannot point boomboxes at stream URLs or keys you do not want on your server.

  • Owner-only station control

    Compare boomBox.OwnerID with player.userID.Get() and cancel the change when the player does not own the boombox.

  • Log tuning activity

    Record which player set which station and when, returning null so the change still happens, for moderation of abusive stream keys.

Pitfalls

  • player can be null

    The RPC player is passed straight through and is not guaranteed to exist. Null-check player before reading UserIDString or sending chat.

  • text is unvalidated input

    The hook runs before IsStationValid, so text can be any string. Treat it as untrusted and compare exact values rather than trusting its length or format.

  • Cancelling leaves the client out of sync

    Returning a non-null value stops the server from recording AssignedRadioBy, but the client already sent the change. Send a chat reply so the player knows why the station did not stick.

Build a plugin with OnBoomboxStationUpdate

Describe what should happen and get a compiled plugin that uses this hook.

Prompt: Block unapproved radio streams using the OnBoomboxStationUpdate hook, with a config file and a permission
Generate this plugin

Edit the prompt on the next screen. 2 free plugins a month, no card.

Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.

Build a plugin with OnBoomboxStationUpdate

Generate