Esempio n. 1
0
 public static void BroadcastToAllClients(string strCommand, params object[] args)
 {
     if (Network.Net.sv.IsConnected())
     {
         Interface.CallHook("OnBroadcastCommand", strCommand, args);
         Network.Net.sv.write.Start();
         Network.Net.sv.write.PacketID(Message.Type.ConsoleCommand);
         Network.Net.sv.write.String(ConsoleSystem.BuildCommand(strCommand, args));
         Network.Net.sv.write.Send(new SendInfo(Network.Net.sv.connections));
     }
 }
Esempio n. 2
0
 public static void SendClientCommand(List <Connection> cn, string strCommand, params object[] args)
 {
     if (Network.Net.sv.IsConnected())
     {
         Interface.CallHook("OnSendCommand", cn, strCommand, args);
         Network.Net.sv.write.Start();
         Network.Net.sv.write.PacketID(Message.Type.ConsoleCommand);
         Network.Net.sv.write.String(ConsoleSystem.BuildCommand(strCommand, args));
         Network.Net.sv.write.Send(new SendInfo(cn));
     }
 }
 public static void BroadcastToAllClients(string strCommand, params object[] args)
 {
     if (!((Server)Net.sv).IsConnected())
     {
         return;
     }
     ((Write)((NetworkPeer)Net.sv).write).Start();
     ((Write)((NetworkPeer)Net.sv).write).PacketID((Message.Type) 12);
     ((Write)((NetworkPeer)Net.sv).write).String(ConsoleSystem.BuildCommand(strCommand, args));
     ((Write)((NetworkPeer)Net.sv).write).Send(new SendInfo((IEnumerable <Connection>)((Server)Net.sv).connections));
 }
 public static void SendClientCommand(Connection cn, string strCommand, params object[] args)
 {
     if (!((Server)Net.sv).IsConnected())
     {
         return;
     }
     ((Write)((NetworkPeer)Net.sv).write).Start();
     ((Write)((NetworkPeer)Net.sv).write).PacketID((Message.Type) 12);
     ((Write)((NetworkPeer)Net.sv).write).String(ConsoleSystem.BuildCommand(strCommand, args));
     ((Write)((NetworkPeer)Net.sv).write).Send(new SendInfo(cn));
 }
        private static void QueueDDrawCommand(BasePlayer player, string command, params object[] args)
        {
            List <string> list;

            if (!DDrawCommandQueue.TryGetValue(player, out list))
            {
                list = new List <string>();
                DDrawCommandQueue.Add(player, list);
            }
            list.Add(ConsoleSystem.BuildCommand(command, args));
        }
 public static void SendClientCommand(Connection cn, string strCommand, params object[] args)
 {
     if (!Network.Net.sv.IsConnected())
     {
         return;
     }
     Network.Net.sv.write.Start();
     Network.Net.sv.write.PacketID(Message.Type.ConsoleCommand);
     Network.Net.sv.write.String(ConsoleSystem.BuildCommand(strCommand, args));
     Network.Net.sv.write.Send(new SendInfo(cn));
 }
 private void ValueChanged()
 {
     if (this.Saved)
     {
         ConsoleSystem.HasChanges = true;
     }
     if (this.ClientInfo)
     {
         ConsoleSystem.SendToServer(ConsoleSystem.BuildCommand("setinfo", new object[] { this.FullName, this.String }));
     }
     if (this.OnValueChanged != null)
     {
         this.OnValueChanged(this);
     }
 }
    public static string Run(ConsoleSystem.Option options, string strCommand, params object[] args)
    {
        ConsoleSystem.LastError = null;
        string str = ConsoleSystem.BuildCommand(strCommand, args);

        ConsoleSystem.Arg arg = new ConsoleSystem.Arg(options, str);
        bool flag             = arg.HasPermission();

        if (!arg.Invalid & flag)
        {
            ConsoleSystem.Arg currentArgs = ConsoleSystem.CurrentArgs;
            ConsoleSystem.CurrentArgs = arg;
            bool flag1 = ConsoleSystem.Internal(arg);
            ConsoleSystem.CurrentArgs = currentArgs;
            if (options.PrintOutput & flag1 && arg.Reply != null && arg.Reply.Length > 0)
            {
                DebugEx.Log(arg.Reply, StackTraceLogType.None);
            }
            return(arg.Reply);
        }
        ConsoleSystem.LastError = "Command not found";
        if (!flag)
        {
            ConsoleSystem.LastError = "Permission denied";
        }
        if (options.IsServer || options.ForwardtoServerOnMissing && ConsoleSystem.SendToServer(str))
        {
            if (options.IsServer && options.PrintOutput)
            {
                ConsoleSystem.LastError = string.Concat("Command '", strCommand, "' not found");
                DebugEx.Log(ConsoleSystem.LastError, StackTraceLogType.None);
            }
            return(null);
        }
        ConsoleSystem.LastError = string.Concat("Command '", strCommand, "' not found");
        if (options.PrintOutput)
        {
            DebugEx.Log(ConsoleSystem.LastError, StackTraceLogType.None);
        }
        return(null);
    }