1. So I have the code below and it seems to produce a error upon granting a group a permission. However I cannot figure out why!
    Code:
            void OnGroupPermissionGranted(string name, string perm)
            {
                try{
                    foreach(var entry in groupData.perms)
                    {
                        if(entry == perm)
                        {
                            grabPermG(perm, name);
                        }
                    }
                }
                catch(System.Exception){ return; }
            }        void grabPermG(string perma, string name)
            {
                var newperm = perma.Replace("igather.", "");
                if(groupData.groupD.ContainsKey(newcount))
                {
                    if(groupData.groupD[newcount].groupName == newperm)
                    {    
                        List<string> players = new List<string>();
                        foreach(var sleeper in BasePlayer.sleepingPlayerList)
                        {
                            players.Add(sleeper.displayName);
                        }
                        foreach(var playera in BasePlayer.activePlayerList)
                        {
                            players.Add(playera.displayName);
                        }
                            foreach(var entry in permission.GetUsersInGroup(name))
                            {
                                foreach(var key in players)
                                {
                                    if(entry.Contains(key))
                                    {
                                        object addPlayer = FindPlayerU(key);      
                                        BasePlayer target = (BasePlayer)addPlayer;                  
                                        GrantPermission(newcount, target);
                                        Puts(key+" added.");
                                    }
                                }
                            }
                        return;
                    }
                    newcount++;
                    grabPerm(perma, name);     
                    return;   
                }
                else
                {
                    if(newcount < groupData.groupD.Count)
                    {
                        newcount++;
                        grabPerm(perma, name); 
                        return;
                    }
                    else
                    {
                        newcount = 0;
                        return;
                    }
                }        
            }
    Code:
    [Oxide] 02:57 [Error] Failed to call hook 'OnGroupPermissionGranted' on plugin 'IGather v1.0.8' (NullReferenceException: Object reference not set to an instance of an object)
    [Oxide] 02:57 [Debug]   at Oxide.Plugins.IGather.GrantPermission (Int32 newid, .BasePlayer target) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.IGather.grabPerm (System.String perma, System.String name) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.IGather.grabPermG (System.String perma, System.String name) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.IGather.OnGroupPermissionGranted (System.String name, System.String perm) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.IGather.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
    [Oxide] 02:57 [Info] Group 'admin' granted permission 'igather.Regular'
     
  2. It's breaking at the method GrantPermission(Int32 newid, .BasePlayer target)
     
  3. Nevermind got it working. Just gotta debug void(GrantPermission) now :p