1. Code:
    using System.Collections.Generic;
    using System;
    using System.Reflection;
    using System.Data;
    using UnityEngine;
    using Oxide.Core;
    using Oxide.Core.Configuration;
    using Oxide.Core.Plugins;namespace Oxide.Plugins
    {
        [Info("NameRewards", "Kappasaurus", "1.0.0")]
        [Description("Give players permissions based on phrases in their name.")]    class NameRewards : RustPlugin
        {
            string Perm = Config["PermName"].ToString();
            string Phrase = Config["NamePhrase"].ToString();
            void OnPlayerInit(BasePlayer player)
            {
                if (BasePlayer.displayName.Contains(Phrase))
                {
                    permission.GrantUserPermission(player.UserIDString, Perm, this);
                }
                else
                {
                    permission.RevokeUserPermission(player.UserIDString, Perm, this);
                }
            }        protected override void LoadDefaultConfig()
            {
                PrintWarning("Generating your config file!");
                Config.Clear();
                Config["NamePhrase"] = "";
                Config["PermName"] = "";
                SaveConfig();
            }
        }
    }
    I keep getting this error, along with the one under.
    upload_2016-10-4_22-57-5.png
    upload_2016-10-4_22-57-49.png


    Can anyone spot the cause of the errors?
     
  2. Wulf

    Wulf Community Admin

    Config is not available when you try to set the variables, it is loaded later, and I don't think you can set them like that. The perm error is because you aren't passing a perm, it's null because the config is available.