SendChat() public method

public SendChat ( Player p, string message ) : void
p Player
message string
return void
Example #1
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null || (target.hidden && p.Rank < target.Rank))
         {
             if (Player.left.ContainsKey(message.ToLower()))
             {
                 string playerName = message.ToLower();
                 string ip         = Player.left[playerName];
                 message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
                 if (p.Rank >= GroupEnum.Operator)
                 {
                     message += " IP: " + ip + ".";
                 }
                 p.SendChat(p, message);
             }
             else
             {
                 p.SendMessage("No entry found for \"" + message + "\".");
             }
         }
         else
         {
             p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
         }
     }
     else
     {
         Help(p);
     }
 }
Example #2
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null || (target.hidden && p.Rank < target.Rank))
         {
             if (Player.left.ContainsKey(message.ToLower()))
             {
                 string playerName = message.ToLower();
                 string ip = Player.left[playerName];
                 message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
                 if (p.Rank >= GroupEnum.Operator)
                 {
                     message += " IP: " + ip + ".";
                 }
                 p.SendChat(p, message);
             }
             else
             {
                 p.SendMessage("No entry found for \"" + message + "\".");
             }
         }
         else
         {
             p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
         }
     }
     else
     {
         Help(p);
     }
 }
Example #3
0
        /// <summary>
        /// Handles private chat between players
        /// </summary>
        /// <param name="to">The player name we are sending a message to</param>
        /// <param name="message">The message to send to the player</param>
        void HandleQuery(string to, string message)
        {
            // Find the player to send it too
            Player p = Find(to);

            // Make sure we're not trying to send to ourselves
            if (p != this)
            {
                // Make sure we actually found the player and that the player isn't hiding from the world
                if (p != null && !p.hidden)
                {
                    Logger.Log(name + " @" + p.name + ": " + message, LogType.PrivateChat);
                    p.SendChat(this, "&e[<] " + color + name + ": &f" + message);
                    SendChat(this, "&9[>] " + p.color + p.name + ": &f" + message);
                }
                else
                {
                    SendMessage("Player \"" + to + "\" doesn't exist!");
                }
            }
            else
            {
                SendMessage("Trying to talk to yourself, huh?");
            }
        }
Example #4
0
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/color [player] <color> - Changes the nick color.");
     p.SendChat(p, "&0black &1navy &2green &3teal &4maroon &5purple &6gold &7silver");
     p.SendChat(p, "&8gray &9blue &alime &baqua &cred &dpink &eyellow &fwhite");
 }
Example #5
0
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/color [player] <color> - Changes the nick color.");
     p.SendChat(p, "&0black &1navy &2green &3teal &4maroon &5purple &6gold &7silver");
     p.SendChat(p, "&8gray &9blue &alime &baqua &cred &dpink &eyellow &fwhite");
 }