Exemplo n.º 1
0
 private static void OnCommand(RCon.Command cmd)
 {
     try
     {
         RCon.responseIdentifier = cmd.Identifier;
         RCon.responseConnection = cmd.ConnectionId;
         RCon.isInput            = true;
         if (RCon.Print)
         {
             Debug.Log(string.Concat(new object[] { "[rcon] ", cmd.Ip, ": ", cmd.Message }));
         }
         RCon.isInput = false;
         ConsoleSystem.Option server = ConsoleSystem.Option.Server;
         string str = ConsoleSystem.Run(server.Quiet(), cmd.Message, Array.Empty <object>());
         if (str != null)
         {
             RCon.OnMessage(str, string.Empty, UnityEngine.LogType.Log);
         }
     }
     finally
     {
         RCon.responseIdentifier = 0;
         RCon.responseConnection = string.Empty;
     }
 }
    internal static void OnClientCommand(Message packet)
    {
        if (packet.read.Unread > ConVar.Server.maxcommandpacketsize)
        {
            Debug.LogWarning("Dropping client command due to size");
            return;
        }
        string str = packet.read.String();

        if (packet.connection == null || !packet.connection.connected)
        {
            Debug.LogWarning(string.Concat("Client without connection tried to run command: ", str));
            return;
        }
        ConsoleSystem.Option server = ConsoleSystem.Option.Server;
        server = server.FromConnection(packet.connection);
        string str1 = ConsoleSystem.Run(server.Quiet(), str, Array.Empty <object>());

        if (!string.IsNullOrEmpty(str1))
        {
            ConsoleNetwork.SendClientReply(packet.connection, str1);
        }
    }