Exemple #1
0
        public static void ConsoleReceived(ref ConsoleSystem.Arg arg, bool external)
        {
            string clss        = arg.Class.ToLower();
            string func        = arg.Function.ToLower();
            string name        = "RCON_External";
            bool   adminRights = external;

            if (!external)
            {
                //Fougerite.Player player = Fougerite.Player.FindByPlayerClient (arg.argUser.playerClient);
                Fougerite.Player player = Fougerite.Server.Cache[arg.argUser.playerClient.userID];
                if (player.Admin)
                {
                    adminRights = true;
                }
                name = player.Name;
            }
            if (adminRights)
            {
                if (clss == "lua" && func == "reload" && arg.ArgsStr == "")
                {
                    LuaModule.GetInstance().ReloadPlugins();
                    arg.ReplyWith("Lua Reloaded!");
                    Logger.LogDebug("[MoonSharp] " + name + " executed: lua.reload");
                }
                else if (clss == "lua" && func == "load")
                {
                    LuaModule.GetInstance().LoadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Lua.load plugin executed!");
                    Logger.LogDebug("[MoonSharp] " + name + " executed: lua.load " + arg.ArgsStr);
                }
                else if (clss == "lua" && func == "unload")
                {
                    LuaModule.GetInstance().UnloadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Lua.unload plugin executed!");
                    Logger.LogDebug("[MoonSharp] " + name + " executed: lua.unload " + arg.ArgsStr);
                }
                else if (clss == "lua" && func == "reload")
                {
                    LuaModule.GetInstance().ReloadPlugin(arg.ArgsStr);
                    arg.ReplyWith("Lua.reload plugin executed!");
                    Logger.LogDebug("[MoonSharp] " + name + " executed: lua.reload " + arg.ArgsStr);
                }
            }

            if (OnConsoleReceived != null)
            {
                OnConsoleReceived(ref arg, external);
            }
        }