Jump to content

failed to call hook

Pending 1.0.3

Theswingingturtle

Posted

(11:58:31) | Failed to call hook 'OnEntitySpawned' on plugin 'BuildingHealthManager v1.0.3' (ArgumentOutOfRangeException: Length cannot be less than zero.

Parameter name: length)

at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x00031] in <8ce0bd04a7a04b4b9395538239d3fdd8>:0

at Oxide.Plugins.BuildingHealthManager.GetCleanPrefabName (System.String prefabName) [0x00015] in <975dd02a55db4f3987caacd87dc8a66a>:0

at Oxide.Plugins.BuildingHealthManager.Spawnhp (BaseNetworkable entity) [0x00007] in <975dd02a55db4f3987caacd87dc8a66a>:0

at Oxide.Plugins.BuildingHealthManager.OnEntitySpawned (BaseNetworkable entity) [0x00009] in <975dd02a55db4f3987caacd87dc8a66a>:0

at Oxide.Plugins.BuildingHealthManager.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00b98] in <975dd02a55db4f3987caacd87dc8a66a>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <42f9bedc659b4f4786eb778d3cd58968>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in <112d89ea5d3348c8b949af0ab1a866d2>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <112d89ea5d3348c8b949af0ab1a866d2>:0


Getting this when spawning in a custom vehicle from Karuza's plugins.

I made a temporary fix, but would love to see a update for this if you can
 

private string GetCleanPrefabName(string prefabName)
{
    if (string.IsNullOrEmpty(prefabName))
        return null;

    int lastSlash = prefabName.LastIndexOf('/');
    int dotPrefab = prefabName.IndexOf(".prefab", StringComparison.OrdinalIgnoreCase);

    if (dotPrefab == -1)
        return null;

    int startIndex = lastSlash + 1;
    int length = dotPrefab - startIndex;

    if (length <= 0)
        return null;

    return prefabName.Substring(startIndex, length);
}

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.3m
Total downloads
Customers
10.7k
Customers served
Files Sold
154.8k
Marketplace sales
Payments
3.3m
Processed total
×
×
  • 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.