using Newtonsoft.Json;
using System.Collections.Generic;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Default Radio Station", "marcuzz", "1.1.1")]
[Description("Set default radio station for spawned, created or placed boomboxes.")]
public class DefaultRadioStation : RustPlugin
{
private static PluginConfig _config;
void OnEntitySpawned(DeployableBoomBox boombox)
{
if (!_config.SetDefaultHeld)
return;
if (boombox != null)
SetBoomboxRadioIP(boombox.BoxController);
}
void OnEntitySpawned(HeldBoomBox boombox)
{
if (!_config.SetDefaultHeld)
return;
if (boombox != null)
SetBoomboxRadioIP(boombox.BoxController);
}
void Unload()
{
_config = null;
Config.Clear();
}
private void SetBoomboxRadioIP(BoomBox box)
{
int index = 0;
if (_config.DefaultRadioStationUrlList.Count > 1)
index = Random.Range(0, _config.DefaultRadioStationUrlList.Count);
box.CurrentRadioIp = _config.DefaultRadioStationUrlList[index];
// Fixed for the July 2026 Rust update
box.baseEntity.ClientRPC(RpcTarget.NetworkGroup("OnRadioIPChanged"), box.CurrentRadioIp);
}
private static PluginConfig GetDefaultConfig()
{
return new PluginConfig
{
DefaultRadioStationUrlList = new List<string> { "rustradio.facepunch.com" },
SetDefaultDeployed = true,
SetDefaultHeld = true,
};
}
private class PluginConfig
{
[JsonProperty("Default radio station URL list (mp3 streams): ")] public List<string> DefaultRadioStationUrlList { get; set; }
[JsonProperty("Set for deployed: ")] public bool SetDefaultDeployed { get; set; }
[JsonProperty("Set for held: ")] public bool SetDefaultHeld { get; set; }
}
protected override void LoadDefaultConfig()
{
Config.Clear();
Config.WriteObject(GetDefaultConfig(), true);
}
protected override void LoadConfig()
{
base.LoadConfig();
_config = Config.ReadObject<PluginConfig>();
}
}
} [1.1.1] fixed -> "Failed to compile DefaultRadioStation.cs - The non-generic method 'BaseEntity.ClientRPC(RpcTarget)' cannot be used with type arguments (L: 45 | P: 18) | Removing from project""
The compilation error you are experiencing is due to a recent Rust game update (July 2026), which completely removed all obsolete and generic versions of BaseEntity.ClientRPC.
The method is now strictly non-generic and requires an RpcTarget to specify where the network call is being sent (e.g., to the entity's network group or a specific player).
The Fix
To resolve the compilation error, replace line 45:
box.baseEntity
.ClientRPC<string>(null, "OnRadioIPChanged", box.CurrentRadioIp);
with the updated RpcTarget syntax:
box.baseEntity
.ClientRPC(RpcTarget.NetworkGroup("OnRadioIPChanged"), box.CurrentRadioIp);