Exemplo n.º 1
0
    public static void Send(string command, string data)
    {
        if (CoopPeerStarter.Dedicated)
        {
            if (CoopSteamClientStarter.IsAdmin)
            {
                switch (command)
                {
                case "kick":
                case "kickbycid":
                case "ban":
                case "banbycid":
                case "unban":
                case "save":
                case "restart":
                case "shutdown":
                case "openlogs":
                case "closelogs":
                case "treeregrowmode":
                case "allowbuildingdestruction":
                case "allowenemiescreative":
                case "allowcheats":
                case "allowdebugconsole":
                {
                    AdminCommand adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);
                    adminCommand.Command = command;
                    adminCommand.Data    = data;
                    adminCommand.Send();
                    goto IL_193;
                }

                case "help":
                    CoopAdminCommand.SendLocalMessage("Help 1/3:\r\n/kick <steamId>, /ban <steamId>, /save <slotNum>, /restart, /shutdown");
                    CoopAdminCommand.SendLocalMessage("Help 2/3:\r\n/openlogs /closelogs");
                    CoopAdminCommand.SendLocalMessage("Help 3/3:\r\n/treeregrowmode <on|off>, /allowbuildingdestruction <on|off>, /allowenemiescreative <on|off>");
                    goto IL_193;
                }
                CoopAdminCommand.SendLocalMessage(string.Concat(new string[]
                {
                    "Unknow command: '",
                    command,
                    " ",
                    data,
                    "'"
                }));
                IL_193 :;
            }
            else
            {
                CoopAdminCommand.SendLocalMessage(string.Concat(new string[]
                {
                    "Cannot execute command '",
                    command,
                    " ",
                    data,
                    "' (not connected as administrator)"
                }));
            }
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Runs the specified console command on the player
        /// </summary>
        /// <param name="command"></param>
        /// <param name="args"></param>
        public void Command(string command, params object[] args)
        {
            var adminCommand = AdminCommand.Create(entity.source);

            adminCommand.Command = command;
            adminCommand.Data    = string.Concat(args.Select(o => o.ToString()).ToArray());
            adminCommand.Send();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Runs the specified server command
        /// </summary>
        /// <param name="command"></param>
        /// <param name="args"></param>
        public void Command(string command, params object[] args)
        {
            var adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);

            adminCommand.Command = command;
            adminCommand.Data    = string.Concat(args.Select(o => o.ToString()).ToArray());
            adminCommand.Send();
        }
Exemplo n.º 4
0
        private static void ServerConsoleOnInput(string input)
        {
            var inputArray   = input.Split();
            var adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);

            adminCommand.Command = inputArray[0];
            adminCommand.Data    = string.Concat(inputArray.Skip(1).Select(s => s));
            adminCommand.Send();
        }
Exemplo n.º 5
0
 public static void Send(string command, string data)
 {
     if (CoopPeerStarter.Dedicated)
     {
         AdminCommand adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);
         adminCommand.Command = command;
         adminCommand.Data    = data;
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Runs the specified server command
        /// </summary>
        /// <param name="command"></param>
        /// <param name="args"></param>
        public void Command(string command, params object[] args)
        {
            var adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);

            adminCommand.Command = command;
            adminCommand.Data    = string.Concat(args.Select(o => o.ToString()));
            adminCommand.Send();
            //CoopServerInfo.Instance.ExecuteCommand
        }
Exemplo n.º 7
0
 private static void ServerConsoleOnInput(string input)
 {
     input = input.Trim();
     if (!string.IsNullOrEmpty(input))
     {
         var inputArray   = input.Split();
         var adminCommand = AdminCommand.Create(GlobalTargets.OnlyServer);
         adminCommand.Command = inputArray[0];
         adminCommand.Data    = string.Concat(inputArray.Skip(1).Select(s => s).ToArray());
         adminCommand.Send();
     }
 }