Exemplo n.º 1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p);
                return;
            }
            string[] name = message.Split(' ');


            if (name.Length == 1)
            {
                if (File.Exists("extra/commands/source/Cmd" + message + ".cs"))
                {
                    p.SendMessage("File Cmd" + message + ".cs already exists.  Choose another name."); return;
                }
                try
                {
                    Scripting.CreateNew(message);
                }
                catch (Exception e)
                {
                    Server.ErrorLog(e);
                    Player.SendMessage(p, "An error occurred creating the class file.");
                    return;
                }
                Player.SendMessage(p, "Successfully created a new command class.");
                return;
            }

            if (name[1] == "vb")
            {
                if (File.Exists("extra/commands/source/Cmd" + name[0] + ".vb"))
                {
                    p.SendMessage("File Cmd" + name[0] + ".vb already exists.  Choose another name."); return;
                }
                try
                {
                    ScriptingVB.CreateNew(name[0]);
                }
                catch (Exception e)
                {
                    Server.ErrorLog(e);
                    Player.SendMessage(p, "An error occurred creating the class file.");
                    return;
                }
                Player.SendMessage(p, "Successfully created a new vb command class.");
                return;
            }
            // else if (name.Length > 2) { Help(p); return; }
        }
Exemplo n.º 2
0
        public override void Use(Player p, string message)
        {
            if (Command.all.Contains(message.Split(' ')[0]))
            {
                Player.SendMessage(p, "That command is already loaded!");
                return;
            }

            string[] param = message.Split(' ');
            string   name  = "Cmd" + param[0];


            if (param.Length == 1)
            {
                string error = Scripting.Load(name);
                if (error != null)
                {
                    Player.SendMessage(p, error);
                    return;
                }
                GrpCommands.fillRanks();
                Player.SendMessage(p, "Command was successfully loaded.");
                return;
            }
            if (param[1] == "vb")
            {
                string error = ScriptingVB.Load(name);
                if (error != null)
                {
                    Player.SendMessage(p, error);
                    return;
                }
                GrpCommands.fillRanks();
                Player.SendMessage(p, "Command was successfully loaded.");
                return;
            }
        }
Exemplo n.º 3
0
 public static void Autoload()
 {
     if (!File.Exists("text/cmdautoloadVB.txt"))
     {
         File.Create("text/cmdautoloadVB.txt");
         return;
     }
     string[] autocmds = File.ReadAllLines("text/cmdautoloadVB.txt");
     foreach (string cmd in autocmds)
     {
         if (cmd == "")
         {
             continue;
         }
         string error = ScriptingVB.Load("Cmd" + cmd.ToLower());
         if (error != null)
         {
             Server.s.Log(error);
             error = null;
             continue;
         }
         Server.s.Log("AUTOLOAD: Loaded [VB] " + cmd.ToLower() + ".dll");
     }
 }
Exemplo n.º 4
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            bool success = false;

            string[] param = message.Split(' ');
            string   name  = param[0];

            if (param.Length == 1)
            {
                if (File.Exists("extra/commands/source/Cmd" + message + ".cs"))
                {
                    try
                    {
                        success = Scripting.Compile(message);
                    }
                    catch (Exception e)
                    {
                        Server.ErrorLog(e);
                        Player.SendMessage(p, "An exception was thrown during compilation.");
                        return;
                    }
                    if (success)
                    {
                        Player.SendMessage(p, "Compiled successfully.");
                    }
                    else
                    {
                        Player.SendMessage(p, "Compilation error.  Please check compile.log for more information.");
                    }
                    return;
                }
                else
                {
                    Player.SendMessage(p, "file &9Cmd" + message + ".cs " + Server.DefaultColor + "not found!");
                }
            }
            if (param[1] == "vb")
            {
                message = message.Remove(message.Length - 3, 3);
                if (File.Exists("extra/commands/source/Cmd" + message + ".vb"))
                {
                    try
                    {
                        success = ScriptingVB.Compile(name);
                    }
                    catch (Exception e)
                    {
                        Server.ErrorLog(e);
                        Player.SendMessage(p, "An exception was thrown during compilation.");
                        return;
                    }
                    if (success)
                    {
                        Player.SendMessage(p, "Compiled successfully.");
                    }
                    else
                    {
                        Player.SendMessage(p, "Compilation error.  Please check compile.log for more information.");
                    }
                    return;
                }
                else
                {
                    Player.SendMessage(p, "file &9Cmd" + message + ".vb " + Server.DefaultColor + "not found!");
                }
            }
        }