Hey, the plugin dont work anymore for me (my server)... i dont hear anything since update. Before update it has worked fine... Anybody know why? No Errors or something...
Dont hear anything since update. Before update it has worked
I'm also not able to hear any music from mine. I believe the last update has broken the mod.
@TCM420G
Hello.I confirm that the latest rust update no longer works the sound of the car radio.
Hello.I confirm that the latest rust update no longer works the sound of the car radio.
For some reason it seems that it isn't finding the controller with the way it currently gets the vehicle in the button press code.
If you add a line in the code (per below example) that gets the mounted vehicle directly, the buttons now work. Please note this means the button will only work if mounted, regardless of the config setting - but it's a good enough workaround for me at the moment.
private object OnButtonPress(PressButton aButton, BasePlayer aPlayer)
{
BaseVehicle theVehicle = aButton.GetComponentInParent<BaseVehicle>()?.VehicleParent();
theVehicle = theVehicle ? theVehicle : aButton.GetComponentInParent<BaseVehicle>();
// ******************* add this line below ********************
theVehicle = aPlayer?.GetMountedVehicle();
// ************************************************************
if (theVehicle)
{
RadioController theController = theVehicle.GetComponent<RadioController>();
if (theController)
{
if ((config.MountNeeded && aPlayer.GetMountedVehicle() != theVehicle) || !theController.NetIDs.Contains(aButton.net.ID))
{
return false;
}
theController.ChangeState();
}
}
return null;
}
I tried this and got this error but maybe I put it in the wrong place
Failed to call hook 'Unload' on plugin 'CarRadio v1.0.5' (NullReferenceException: Object reference not set to an instance of an object.) at Oxide.Plugins.CarRadio.DetachRadios (BaseVehicle aVehicle) [0x0002a] in <7d424d29d33347b39b02983aa5065f4e>:0
at Oxide.Plugins.CarRadio.Unload () [0x00022] in <7d424d29d33347b39b02983aa5065f4e>:0
at Oxide.Plugins.CarRadio.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00358] in <7d424d29d33347b39b02983aa5065f4e>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <23ba99f131254889867c71f0bd137b1d>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <157a94ee66ab4a7991faecd1eb84be3b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <157a94ee66ab4a7991faecd1eb84be3b>:0
Unloaded plugin Car Radio v1.0.5 by TCM420G
CarRadio v1.0.5: Failed to load config file (is the config file corrupt?) (Additional text encountered after finished reading JSON content: ,. Path '', line 13, position 1.)
[Car Radio] Configuration file CarRadio.json is invalid; using defaults