MCLawl.PlayerBot.Find C# (CSharp) Method

Find() public static method

public static Find ( string name ) : PlayerBot
name string
return PlayerBot
        public static PlayerBot Find(string name)
        {
            PlayerBot tempPlayer = null; bool returnNull = false;

            foreach (PlayerBot pB in PlayerBot.playerbots)
            {
                if (pB.name.ToLower() == name.ToLower()) return pB;
                if (pB.name.ToLower().IndexOf(name.ToLower()) != -1)
                {
                    if (tempPlayer == null) tempPlayer = pB;
                    else returnNull = true;
                }
            }

            if (returnNull == true) return null;
            if (tempPlayer != null) return tempPlayer;
            return null;
        }

Usage Example

Beispiel #1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            PlayerBot who = PlayerBot.Find(message);

            if (who == null)
            {
                Player.SendMessage(p, "There is no bot " + message + "!"); return;
            }
            if (p.level != who.level)
            {
                Player.SendMessage(p, who.name + " is in a different level."); return;
            }
            who.SetPos(p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
            //who.SendMessage("You were summoned by " + p.color + p.name + "&e.");
        }
All Usage Examples Of MCLawl.PlayerBot::Find