1. ANY CAN HELP ME TO FIX?

    ERROR PLUGIN:
    Code:
    Failed to call hook 'chatCaseKeyBlueprint' on plugin 'CaseKeyBlueprint v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    at Oxide.Plugins.CaseKeyBlueprint.GiveRandomItem (BasePlayer player, System.String level) [0x00041] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CaseKeyBlueprint.chatCaseKeyBlueprint (BasePlayer player, System.String command, System.String[] args) [0x00034] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CaseKeyBlueprint.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00218] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <17b9f46063fe4ac9ae4a1000712647ce>:0
    at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ba44835247a74c58bf6cabef8b441b56>:0
    at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ba44835247a74c58bf6cabef8b441b56>:0
     
    Last edited by a moderator: Jun 21, 2018
  2. Wulf

    Wulf Community Admin

    I'd suggest posting the actual error, not just the portion under it.
     
  3. Sorry now here:

    Code:
    Failed to call hook 'chatCaseKeyBlueprint' on plugin 'CaseKeyBlueprint v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    at Oxide.Plugins.CaseKeyBlueprint.GiveRandomItem (BasePlayer player, System.String level) [0x00041] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CaseKeyBlueprint.chatCaseKeyBlueprint (BasePlayer player, System.String command, System.String[] args) [0x00034] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CaseKeyBlueprint.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00218] in <7e9758ea53a048859e90cb821b7c7811>:0
    at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <17b9f46063fe4ac9ae4a1000712647ce>:0
    at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ba44835247a74c58bf6cabef8b441b56>:0
    at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ba44835247a74c58bf6cabef8b441b56>:0
    Code:
    Failed to call hook 'ccmdCaseKeyBlueprint' on plugin 'CaseKeyBlueprint v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.CaseKeyBlueprint.GiveRandomItem (BasePlayer player, System.String level) [0x00041] in <7e9758ea53a048859e90cb821b7c7811>:0
      at Oxide.Plugins.CaseKeyBlueprint.cmdCaseKeyBlueprint (BasePlayer player, System.String command, System.String[] args) [0x00000] in <7e9758ea53a048859e90cb821b7c7811>:0
      at Oxide.Plugins.CaseKeyBlueprint.ccmdCaseKeyBlueprint (ConsoleSystem+Arg arg) [0x0006b] in <7e9758ea53a048859e90cb821b7c7811>:0
      at Oxide.Plugins.CaseKeyBlueprint.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00253] in <7e9758ea53a048859e90cb821b7c7811>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <17b9f46063fe4ac9ae4a1000712647ce>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ba44835247a74c58bf6cabef8b441b56>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ba44835247a74c58bf6cabef8b441b56>:0
     
    Last edited by a moderator: Jun 21, 2018
  4. Wulf

    Wulf Community Admin

    You aren't checking if the item is null before trying to use/give it.
     
  5. I can not find the error, a few days ago it worked perfect
     
  6. Wulf

    Wulf Community Admin

    You're creating an item and never null checking it, which is why you are seeing a null exception as the item being created is invalid. You should always null check with something like that to prevent these sort of errors, and you'd also want to generally output something to notify you.
     
  7. fixed

    Item item = ItemManager.CreateByItemID(-1887162396);

    Item item = ItemManager.CreateByItemID(-996920608);
    [DOUBLEPOST=1529596022][/DOUBLEPOST]but have new problem

    string global = $"<size=15><color=#C4FF00>W.LVL ALL</color>: </size><size=14><color=lime>{player.displayName}</color></size> ha obtenido | has obtained: <color=cyan>{itemDefinition.displayName.english}</color>";

    no send chat message for all global no work now. any help wulf?
     
  8. Wulf

    Wulf Community Admin

    You are sending an empty message ("") in your BroadcastChat method and sending the message as the prefix.
     
  9. string global = $"<size=15><color=#C4FF00>W.Lvl1</color>: </size><size=14><color=lime>{player.displayName}</color></size> ha obtenido | has obtained: <color=cyan>{itemDefinition.displayName.english}</color>";
    Puts(player.displayName + " ha obtenido un plano de Bronce para: " + itemDefinition.displayName.english);
    BroadcastChat(global);
    SendMessage(player, message);

    where is error? cant see please help me wulf
     
  10. Wulf

    Wulf Community Admin

    Look in your BroadcastChat method where rust.SendChatMessage is used.
     
    Last edited: Jun 21, 2018
  11. #region Messages
    private string GetMsg(string key, object userID = null) => lang.GetMessage(key, this, userID?.ToString());
    private void BroadcastChat(string msg = null) => rust.BroadcastChat("<size=15><color=#00b8ff>BP Aleatorio | Random BP</color></size>\n" + msg, "");
    private void SendMessage(BasePlayer player, string msg = null)
    {
    rust.SendChatMessage(player, "<size=15><color=#00b8ff>BP Aleatorio | Random BP</color></size>\n" + msg, "");
    }
    #endregion

    and cant find error i see everything well could you be more precise?
     
  12. Wulf

    Wulf Community Admin

    rust.SendChatMessage has 3 arguments: BasePlayer, string prefix, and string message; in that order. You're sending the BasePlayer and string prefix, not a message.
     
  13. fixed tnx wulf!