1. Hello guys i have problem
    Code:
    [Error] Failed to call hook 'conscmd' on plugin 'DeployBlock v1.0.0' (NullReferenceException: Object reference not set to an instance of an object)
    (17:57:14) | [Oxide] 12:57 [Debug]   at Oxide.Plugins.DeployBlock.conscmd (.Arg arg) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.DeployBlock.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
    I dont know, what me do, please help me.
     
  2. Wulf

    Wulf Community Admin

    I'd need to add some null checks to figure out what is null.
     
  3. Code:
     [ConsoleCommand("deployblock")]
            void conscmd(ConsoleSystem.Arg arg)
            {
                var player = arg.connection?.player as BasePlayer;
                if (!player.IsAdmin()) return;
                if (arg.Args==null) return;
                if (arg.Args.Length == 2 && arg.Args[0] == "start")
                {
                    int min;
                    if(!Int32.TryParse(arg.Args[1], out min)) return;
                    data.minutes = min;
                    data.blocked = true;
                    timingFile.WriteObject(data);
                }
                if (arg.Args.Length ==1 && arg.Args[0] == "stop")
                {
                    data.blocked = false;
                    timingFile.WriteObject(data);
     
  4. Wulf

    Wulf Community Admin

    I'd suggest adding a null check to player before you try checking if it is admin.
     
  5. Code:
    if (!player==null)return;
    It will be so?
     
  6. Wulf

    Wulf Community Admin

    if (player == null) return;
     
  7. I dont see message of eror, but plugin dont work, how do it? Please help me.
     
  8. Wulf

    Wulf Community Admin

    Are you trying to use the command in the server console or RCON? A player will not exist in those cases, so you'd need to not use player checks.
     
  9. If i in game that it's work, if i use rcon console and i out of game it's dont work
    [DOUBLEPOST=1477583215][/DOUBLEPOST]Thanks your Wolf for your Attention and help.