Jump to content

changing settings mid game and reloading plugin caused cabins to not work

Pending 1.0.3

Covfefe
Covfefe

Posted

i made a change to the json and reloaded the plugin which broke all the buttons to enter the cabin. this is what comes up when you try to enter the cabin by pressing the button and yes, i did a save before reloading the plugin

Quote

Failed to call hook 'OnButtonPress' on plugin 'Barges v1.0.3' (NullReferenceException: ) at (wrapper managed-to-native) UnityEngine.Component.get_transform(UnityEngine.Component) at Oxide.Plugins.Barges+BargePhysics.CreateFakePhysicEntity () [0x00000] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.Barges+BargePhysics.SwitchPlysics (System.Boolean isPlysicsEnable) [0x00011] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.Barges+Barge.StartMoving () [0x0002c] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.Barges+CabineModule.OnButtonPressed (BasePlayer player) [0x00016] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.Barges.OnButtonPress (PressButton button, BasePlayer player) [0x00050] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.Barges.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x002af] in <3e82f4bb636041bf9a080dba0723adc9>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <206a0f2c6ee141f38e2ad549cde44d70>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0

however, if you spawn a new barge, you can get into the cabin and drive it no problem

  • Like 1
Covfefe

Posted

Please confirm it's not safe to reload the plugin during gameplay

Adem

Posted

I don't have that problem. I keep reloading the plugin and everything is ok

Adem

Posted

Could there be a problem with the changes in the config?

Godzilla

Posted

Hello, I have exactly the same problem when I reload the plugin, then the only solution is to restart the server.

Covfefe

Posted (edited)

It just happened again and I found the error

Quote

Unloaded plugin Barges v1.0.3 by Adem

Calling 'OnServerInitialized' on 'Barges v1.0.3' took 132ms

Loaded plugin Barges v1.0.3 by Adem

Failed to call hook 'OnButtonPress' on plugin 'Barges v1.0.3' (NullReferenceException: ) at (wrapper managed-to-native) UnityEngine.Component.get_transform(UnityEngine.Component) at Oxide.Plugins.Barges+BargePhysics.CreateFakePhysicEntity () [0x00000] in :0 at Oxide.Plugins.Barges+BargePhysics.SwitchPlysics (System.Boolean isPlysicsEnable) [0x00011] in :0 at Oxide.Plugins.Barges+Barge.StartMoving () [0x0002c] in :0 at Oxide.Plugins.Barges+CabineModule.OnButtonPressed (BasePlayer player) [0x00016] in :0 at Oxide.Plugins.Barges.OnButtonPress (PressButton button, BasePlayer player) [0x00050] in :0 at Oxide.Plugins.Barges.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x002af] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <206a0f2c6ee141f38e2ad549cde44d70>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0

this is what chatgpt says

Quote

The error you're encountering in the "Barges v1.0.3" plugin seems to be due to a `NullReferenceException` when attempting to access the `transform` property in `CreateFakePhysicEntity()` within the `BargePhysics` class. This error often indicates that the object from which `transform` is being called has not been initialized or is null.

To fix this issue, you can update the `CreateFakePhysicEntity()` method to include a null check before accessing `transform`. Here’s an example of how you might adjust the code:

```csharp
private void CreateFakePhysicEntity()
{
    if (this != null && transform != null)
    {
        // Proceed with accessing transform
    }
    else
    {
        Puts("Error: Failed to access transform in CreateFakePhysicEntity. The object may be uninitialized.");
        return;
    }
}
```

This update will help prevent the `NullReferenceException` by checking if `transform` is available before trying to use it. You can implement similar checks in other methods that interact with objects that might not be initialized.

If additional fixes are required in other parts of the code (e.g., `SwitchPhysics` or `StartMoving`), applying similar null checks should help in avoiding exceptions. Let me know if you need further assistance.

 

Edited by Covfefe
Adem

Posted



Hi. I need one of you to contact me in the discord. There is no such problem on my server, I need to test it on your server

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.1k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.