当前位置: 首页>>代码示例>>C#>>正文


C# Player.SendPos方法代码示例

本文整理汇总了C#中MCDawn.Player.SendPos方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendPos方法的具体用法?C# Player.SendPos怎么用?C# Player.SendPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCDawn.Player的用法示例。


在下文中一共展示了Player.SendPos方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Use

        public override void Use(Player p, string message)
        {
            if (p == null) { p.SendMessage("Command not usable in Console."); return; }
            Player who = Player.Find(p.summonRequest);
            if (p.summonRequest == "") { Player.SendMessage(p, "No summon requests have been recieved."); return; }
            if (who == null) { Player.SendMessage(p, "Player is no longer online!"); p.tpRequest = ""; return; }
            if (who == p) { Player.SendMessage(p, "Cannot accept summon request from yourself."); p.summonRequest = ""; return; }
            if (who.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "They can't leave an Infection game!"); return; }
            if (p.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "Infection is active on this map, they can't come here!"); return; }
            if (who.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "They can't leave a Spleef game!"); return; }
            if (p.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "Spleef is active on this map, they can't come here!"); return; }

            if (p.level != who.level)
            {
                if (who.level.name.Contains("cMuseum")) { Player.SendMessage(p, "Player \"" + who.name + "\" is in a museum!"); return; }
                else
                {
                    Command.all.Find("goto").Use(p, who.level.name);
                    while (p.Loading) { }
                    unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); }
                    //Command.all.Find("summon").Use(who, p.name);
                }
            }
            if (p.level == who.level)
            {
                if (who.Loading)
                {
                    Player.SendMessage(p, "Waiting for " + who.color + who.name + Server.DefaultColor + " to spawn...");
                    while (who.Loading) { }
                }
                while (p.Loading) { }  //Wait for player to spawn in new map
                unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); }
            }
        }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:34,代码来源:CmdSummonAccept.cs

示例2: Use

 public override void Use(Player p, string message)
 {
     if (message != "") { Help(p); return; }
     ushort x = (ushort)((0.5 + p.level.spawnx) * 32);
     ushort y = (ushort)((1 + p.level.spawny) * 32);
     ushort z = (ushort)((0.5 + p.level.spawnz) * 32);
     unchecked
     {
         p.SendPos((byte)-1, x, y, z,
                     p.level.rotx,
                     p.level.roty);
     }
 }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:13,代码来源:CmdSpawn.cs

示例3: Use

 public override void Use(Player p, string message)
 {
     if (message == "")
     {
         Command.all.Find("spawn");
         return;
     }
     Player who = Player.Find(message);
     if (who == null || (who.hidden && p.group.Permission < LevelPermission.Admin)) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; }
     if (p.group.Permission < LevelPermission.Operator && who.level.name != Server.HomePrefix + p.name.ToLower() && p.level.name != Server.HomePrefix + p.name.ToLower()) { if (p.level.locked || who.level.locked) { p.SendMessage("This map is currently locked!"); return; } }
     if (p.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "You can't leave an Infection game!"); return; }
     if (who.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "Infection is active on that map, you can't go to it!"); return; }
     if (p.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "You can't leave a Spleef game!"); return; }
     if (who.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "Spleef is active on that map, you can't go to it!"); return; }
     if (p.level != who.level)
     {
         if (Server.tpToHigher == false && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "You can't teleport to someone of a higher rank!"); return; }
         if (who.level.name.Contains("cMuseum")) { Player.SendMessage(p, "Player \"" + message + "\" is in a museum!"); return; }
         else
         {
             Command.all.Find("goto").Use(p, who.level.name);
             while (p.Loading) { }
             unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); }
             Command.all.Find("tp").Use(p, who.name);
         }
     }
     if (p.level == who.level)
     {
         if (Server.tpToHigher == false && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "You can't teleport to someone of a higher rank!"); }
         else
         {
             if (who.Loading)
             {
                 Player.SendMessage(p, "Waiting for " + who.color + who.name + Server.DefaultColor + " to spawn...");
                 while (who.Loading) { }
             }
             while (p.Loading) { }  //Wait for player to spawn in new map
             unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); }
         }
     }
 }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:41,代码来源:CmdTp.cs

示例4: Blockchange1

 public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
 {
     p.ClearBlockchange();
     byte b = p.level.GetTile(x, y, z);
     p.SendBlockchange(x, y, z, b);
     bool there = false;
     while (!there )
     {
         y++;
         if (Block.Walkthrough(p.level.GetTile(x, y, z)))
             if (Block.Walkthrough(p.level.GetTile(x, (ushort)(y + 1), z)))
                 if (!Block.Walkthrough(p.level.GetTile(x, (ushort)(y - 1), z)))
                 {
                     Player.SendMessage(p, "Teleported up.");
                     unchecked { p.SendPos((byte)-1, (ushort)(x * 32), (ushort)((y + 1) * 32), (ushort)(z * 32), p.rot[0], p.rot[1]); }
                     there = true;
                 }
     }
     if (!there) { Player.SendMessage(p, "No free spaces available."); }
     if (p.staticCommands) { p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); }
 }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:21,代码来源:CmdTop.cs

示例5: Use

        public override void Use(Player p, string message)
        {
            Player who = Player.Find(message);
            if (who.group.Permission > p.group.Permission)
            {
                Player.SendMessage(p, "Cannot rotate someone with equal or higher rank.");
                return;
            }
            if (!onGround(who))
            {
                Player.SendMessage(p, "Player is not on ground! Cannot rotate!");
                return;
            }

            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " rotated " + who.color + who.name + Server.DefaultColor + ".");
            for (int i = 0; i < 8; i++)
            {
                if (who == null || !who.loggedIn) { Player.SendMessage(p, "Rotating stopped; player logged out during rotation");  return; }
                unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2],(byte)(p.rot[0] * 20), p.rot[1]); }
                Thread.Sleep(10);
            }
        }
开发者ID:sillyboyization,项目名称:OpenNet,代码行数:22,代码来源:CmdRotate.cs

示例6: Use

        public override void Use(Player p, string message)
        {
            p.onTrain = !p.onTrain;

            if (!p.onTrain) return;

            Thread trainThread = new Thread(new ThreadStart(delegate
            {
                while (p.onTrain)
                {
                    Thread.Sleep(3);

                    ushort x = (ushort)(p.pos[0] / 32);
                    ushort y = (ushort)(p.pos[1] / 32);
                    ushort z = (ushort)(p.pos[2] / 32);

                    for (ushort xx = (ushort)(x - 1); xx <= x + 1; xx++)
                    {
                        for (ushort yy = (ushort)(y - 1); yy <= y + 1; yy++)
                        {
                            for (ushort zz = (ushort)(z - 1); zz <= z + 1; zz++)
                            {
                                if (p.level.GetTile(xx, yy, zz) == Block.train)
                                {
                                    p.invincible = true; p.trainGrab = true;
                                    byte newY = 0;

                                    if (y - yy == -1) newY = 240;
                                    else if (y - yy == 0) newY = 0;
                                    else newY = 8;

                                    unchecked
                                    {
                                        if (x - xx == -1)
                                            if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)96, newY);
                                            else if (z - zz == 0) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)64, newY);
                                            else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)32, newY);
                                        else if (x - xx == 0)
                                            if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)128, newY);
                                            else if (z - zz == 0) { }
                                            else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)0, newY);
                                        else
                                            if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)160, newY);
                                            else if (z - zz == 0) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)192, newY);
                                            else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)224, newY);
                                    }
                                    goto skip;
                                }
                            }
                        }
                    }

                    Thread.Sleep(3);
                    p.invincible = false;
                    p.trainGrab = false;
            skip:   ;
                }

                Player.SendMessage(p, "Dismounted");
                Thread.Sleep(1000);
                p.invincible = false;
                p.trainGrab = false;
            }));
            trainThread.Start();
            Player.SendMessage(p, "Stand near a train to mount it");
        }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:66,代码来源:CmdRide.cs

示例7: Use

 public override void Use(Player p, string message)
 {
     if (p == null) { Player.SendMessage(p, "Command not usable in Console."); return; }
     try
     {
         int i = getDirection(p.rot[0]);
         ushort xx = (ushort)(p.pos[0] / 32), yy = (ushort)(p.pos[1] / 32), zz = (ushort)(p.pos[2] / 32);
         bool there = false;
         if (i == 0)
         {
             while (!there && xx < p.level.width)
             {
                 xx++;
                 if (Block.Walkthrough(p.level.GetTile(xx, yy, zz)))
                 {
                     if (Block.Walkthrough(p.level.GetTile((ushort)(xx + 1), yy, zz)))
                     {
                         if (!Block.Walkthrough(p.level.GetTile((ushort)(xx - 1), yy, zz)))
                         {
                             Player.SendMessage(p, "Passed through wall.");
                             unchecked { p.SendPos((byte)-1, (ushort)((xx + 1) * 32), p.pos[1], p.pos[2], p.rot[0], p.rot[1]); }
                             there = true;
                         }
                     }
                 }
             }
             if (!there) { Player.SendMessage(p, "No free spaces available."); }
         }
         else if (i == 1)
         {
             while (!there && zz < p.level.depth)
             {
                 zz++;
                 if (Block.Walkthrough(p.level.GetTile(xx, yy, zz)))
                 {
                     if (Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz + 1))))
                     {
                         if (!Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz - 1))))
                         {
                             Player.SendMessage(p, "Passed through wall.");
                             unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], (ushort)((zz + 1) * 32), p.rot[0], p.rot[1]); }
                             there = true;
                         }
                     }
                 }
             }
             if (!there) { Player.SendMessage(p, "No free spaces available."); }
         }
         else if (i == 2)
         {
             while (!there && xx > 0)
             {
                 xx--;
                 if (Block.Walkthrough(p.level.GetTile(xx, yy, zz)))
                 {
                     if (Block.Walkthrough(p.level.GetTile((ushort)(xx - 1), yy, zz)))
                     {
                         if (!Block.Walkthrough(p.level.GetTile((ushort)(xx + 1), yy, zz)))
                         {
                             Player.SendMessage(p, "Passed through wall.");
                             unchecked { p.SendPos((byte)-1, (ushort)((xx - 1) * 32), p.pos[1], p.pos[2], p.rot[0], p.rot[1]); }
                             there = true;
                         }
                     }
                 }
             }
             if (!there) { Player.SendMessage(p, "No free spaces available."); }
         }
         else if (i == 3)
         {
             while (!there && zz > 0)
             {
                 zz--;
                 if (Block.Walkthrough(p.level.GetTile(xx, yy, zz)))
                 {
                     if (Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz - 1))))
                     {
                         if (!Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz + 1))))
                         {
                             Player.SendMessage(p, "Passed through wall.");
                             unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], (ushort)((zz - 1) * 32), p.rot[0], p.rot[1]); }
                             there = true;
                         }
                     }
                 }
             }
             if (!there) { Player.SendMessage(p, "No free spaces available."); }
         }
         else { Player.SendMessage(p, "Could not pass through wall."); }
     }
     catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Could not pass through wall."); }
 }
开发者ID:727021,项目名称:MCDawn,代码行数:92,代码来源:CmdThrough.cs

示例8: Use

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            try
            {
                Level foundLevel = Level.Find(message);
                if (foundLevel != null)
                {
                    Level startLevel = p.level;

                    GC.Collect();

                    if (p.activeCuboids > 0) { startLevel.unload = false; }

                    if (p.group.Permission < LevelPermission.Operator && foundLevel.name != Server.HomePrefix + p.name.ToLower() && p.level.name != Server.HomePrefix + p.name.ToLower())
                    {
                        if (foundLevel.locked == true && p.level != foundLevel) { Player.SendMessage(p, "This map is currently locked!"); return; }
                        if (p.level.locked == true && p.level != foundLevel) { Player.SendMessage(p, "This map is currently locked!"); return; }
                    }
                    if (p.level.zombiegame == true && p.level != foundLevel) { Player.SendMessage(p, "You can't leave an Infection game!"); return; }
                    if (foundLevel.zombiegame == true && p.level != foundLevel) { Player.SendMessage(p, "Infection is active on that map, you can't go to it!"); return; }
                    if (p.level.spleefstarted == true && p.level != foundLevel) { Player.SendMessage(p, "You can't leave a Spleef game!"); return; }
                    if (foundLevel.spleefstarted == true && p.level != foundLevel) { Player.SendMessage(p, "Spleef is active on that map, you can't go to it!"); return; }
                    if (p.level == foundLevel) { Player.SendMessage(p, "You are already in \"" + foundLevel.name + "\"."); return; }
                    if (!p.ignorePermission)
                        if (p.group.Permission < foundLevel.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + foundLevel.name + "."); return; }

                    p.Loading = true;
                    foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id);
                    foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id);

                    Player.GlobalDie(p, true);
                    p.level = foundLevel; p.SendUserMOTD(); p.SendMap();

                    GC.Collect();

                    ushort x = (ushort)((0.5 + foundLevel.spawnx) * 32);
                    ushort y = (ushort)((1 + foundLevel.spawny) * 32);
                    ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32);

                    if (!p.hidden) Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true);
                    else unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); }

                    foreach (Player pl in Player.players)
                        if (pl.level == p.level && p != pl && !pl.hidden)
                            p.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]);

                    foreach (PlayerBot b in PlayerBot.playerbots)
                        if (b.level == p.level)
                            p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);

                    if (!p.hidden)
                    {
                        Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " went to &b" + foundLevel.name, false);
                        if (Server.womText) { Player.WomGlobalMessage(p.color + p.name + Server.DefaultColor + " went to &b" + foundLevel.name); }
                    }

                    p.Loading = false;

                    bool skipUnload = false;
                    if (startLevel.unload && !startLevel.name.Contains("&cMuseum "))
                    {
                        foreach (Player pl in Player.players) if (pl.level == startLevel) skipUnload = true;
                        if (!skipUnload && Server.AutoLoad)
                        {
                            if (p.hidden) { startLevel.Unload(true); }
                            else { startLevel.Unload(); }
                        }
                    }
                }
                else if (Server.AutoLoad)
                {
                    Command.all.Find("load").Use(p, message);
                    foundLevel = Level.Find(message);
                    if (foundLevel != null) Use(p, message);
                }
                else Player.SendMessage(p, "There is no level \"" + message + "\" loaded.");

                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:84,代码来源:CmdGoto.cs

示例9: Use

 public override void Use(Player p, string message)
 {
     if (p == null) { Player.SendMessage(p, "Command not usable in Console."); return; }
     if (message.ToLower() != "now")
     {
         Player.SendMessage(p, "Click a block to go on top of.");
         p.ClearBlockchange();
         p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
     }
     else
     {
         ushort xx = (ushort)(p.pos[0] / 32), yy = (ushort)(p.pos[1] / 32), zz = (ushort)(p.pos[2] / 32);
         bool there = false;
         while (!there && yy < p.level.height)
         {
             yy++;
             if (Block.Walkthrough(p.level.GetTile(xx, yy, zz)))
             {
                 if (Block.Walkthrough(p.level.GetTile(xx, (ushort)(yy + 1), zz)))
                 {
                     if (!Block.Walkthrough(p.level.GetTile(xx, (ushort)(yy - 1), zz)))
                     {
                         Player.SendMessage(p, "Teleported up.");
                         unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)((yy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); }
                         there = true;
                     }
                 }
             }
         }
         if (!there) { Player.SendMessage(p, "No free spaces available."); }
     }
 }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:32,代码来源:CmdTop.cs

示例10: Warn

        //public static List<string> swearWords = new List<string>();
        public static void Warn(Player p)
        {
            if (Server.swearWarnPlayer && p != null) p.swearWordsUsed++;
            if (p.swearWordsUsed >= Server.swearWordsRequired && p != null)
                if (Server.profanityFilterOp || (!Server.profanityFilterOp && p.group.Permission < LevelPermission.Operator))
                    switch (Server.profanityFilterStyle)
                    {
                        case "Kick":
                            p.Kick("You were kicked for excessive use of swear words!");
                            return;
                        case "TempBan":
                             Command.all.Find("tempban").Use(null, p.name + " " + Server.antiSpamTempBanTime.ToString());
                             return;
                        case "Mute":
                             Command.all.Find("mute").Use(null, p.name);
                             break;
                         case "Slap":
                             ushort currentX = (ushort)(p.pos[0] / 32);
                             ushort currentY = (ushort)(p.pos[1] / 32);
                             ushort currentZ = (ushort)(p.pos[2] / 32);
                             ushort foundHeight = 0;

                             for (ushort yy = currentY; yy <= 1000; yy++)
                             {
                                 if (!Block.Walkthrough(p.level.GetTile(currentX, yy, currentZ)) && p.level.GetTile(currentX, yy, currentZ) != Block.Zero)
                                 {
                                    foundHeight = (ushort)(yy - 1);
                                     p.level.ChatLevel(p.color + p.name + "&g was slapped into the roof for excessive use of swear words!");
                                     break;
                                 }
                             }

                             if (foundHeight == 0)
                             {
                                p.level.ChatLevel(p.color + p.name + "&g was slapped sky high for excessive use of swear words!");
                                foundHeight = 1000;
                             }

                             unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)(foundHeight * 32), p.pos[2], p.rot[0], p.rot[1]); }
                             break;
                         default: goto case "Kick";
                    }

            if (Server.swearWarnPlayer && p != null)
            {
                Player.SendMessage(p, "&cYou have been warned for using a swear word!");
                Player.GlobalMessageOps("To Ops: Warned " + p.color + p.name + "&g for using a swear word!");
                Server.s.Log("Warned " + p.name + " for using a swear word!");
            }
        }
开发者ID:Willfeetman99,项目名称:MCDawn,代码行数:51,代码来源:ProfanityFilter.cs

示例11: Use

 public override void Use(Player p, string message)
 {
     if (p == null) { Player.SendMessage(p, "Command not usable from Console."); return; }
     if (!Directory.Exists("extra/waypoints")) Directory.CreateDirectory("extra/waypoints");
     if (!File.Exists("extra/waypoints/" + p.name.ToLower() + ".txt")) File.Create("extra/waypoints/" + p.name.ToLower() + ".txt").Close();
     var wpFile = new List<string>(File.ReadAllLines("extra/waypoints/" + p.name.ToLower() + ".txt")).Where(s => !String.IsNullOrEmpty(s)).Distinct().ToList();
     var wpNames = new List<string>();
     foreach (string s in wpFile)
         if (!String.IsNullOrEmpty(s.Split('|')[0]))
             wpNames.Add(s.Split('|')[0]);
     // Waypoint format:
     // one line per waypoint, stored in extra/waypoints/<name>.txt
     // name|level|x|y|z|rotx|roty
     switch (message.Split(' ')[0].ToLower())
     {
         case "":
         case "list":
             if (wpFile.Count <= 0) { Player.SendMessage(p, "No waypoints saved yet."); Help(p); return; }
             Player.SendMessage(p, "Your waypoints:");
             for (int i = 0; i < wpFile.Count; i++)
             {
                 string[] wp = wpFile[i].Split('|');
                 Player.SendMessage(p, (i + 1) + ". &9" + wp[0] + "&g - &c" + wp[1] + "/" + wp[2] + "/" + wp[3] + "/" + wp[4]);
             }
             break;
         case "tp":
         case "teleport":
         case "go":
         case "goto":
             if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; }
             if (wpFile.Count <= 0) { Player.SendMessage(p, "No waypoints saved yet."); Help(p); return; }
             if (!wpNames.Contains(message.Split(' ')[1].ToLower())) { Player.SendMessage(p, "Waypoint could not be found."); return; }
             string[] values = wpFile[wpNames.IndexOf(message.Split(' ')[1])].Split('|');
             if (!File.Exists("levels/" + values[1] + ".lvl")) { Player.SendMessage(p, "Level does not exist."); return; }
             Level endLevel = Level.Find(values[1]);
             if (endLevel == null || p.level != endLevel)
             {
                 if (!Server.AutoLoad) Command.all.Find("load").Use(p, values[1]);
                 Command.all.Find("goto").Use(p, values[1]);
             }
             unchecked { p.SendPos((byte)-1, (ushort)(ushort.Parse(values[2]) * 32), (ushort)(ushort.Parse(values[3]) * 32), (ushort)(ushort.Parse(values[4]) * 32), byte.Parse(values[5]), byte.Parse(values[6])); }
             Player.SendMessage(p, "Sent you to waypoint: &9" + values[0] + "&g.");
             break;
         case "add":
         case "save":
             if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; }
             bool existing = false;
             if (wpNames.Contains(message.Split(' ')[1].ToLower().Trim())) { existing = true; wpFile.RemoveAt(wpNames.IndexOf(message.Split(' ')[1].ToLower().Trim())); }
             var toAdd = new List<string>();
             toAdd.Add(message.Split(' ')[1].ToLower().Trim().Replace("|", ""));
             toAdd.Add(p.level.name.ToLower());
             toAdd.Add(((ushort)(p.pos[0] / 32)).ToString());
             toAdd.Add(((ushort)(p.pos[1] / 32)).ToString());
             toAdd.Add(((ushort)(p.pos[2] / 32)).ToString());
             toAdd.Add(p.rot[0].ToString());
             toAdd.Add(p.rot[1].ToString());
             wpFile.Add(String.Join("|", toAdd.ToArray()));
             File.WriteAllLines("extra/waypoints/" + p.name.ToLower() + ".txt", wpFile.ToArray());
             Player.SendMessage(p, "Waypoint &9" + message.Split(' ')[1].ToLower().Trim() + "&g " + (existing ? "saved" : "added") + ".");
             break;
         case "del":
         case "remove":
             if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; }
             if (!wpNames.Contains(message.Split(' ')[1].ToLower())) { Player.SendMessage(p, "That waypoint does not exist."); return; }
             wpFile.RemoveAt(wpNames.IndexOf(message.Split(' ')[1].ToLower()));
             File.WriteAllLines("extra/waypoints/" + p.name.ToLower() + ".txt", wpFile.ToArray());
             Player.SendMessage(p, "Waypoint deleted.");
             break;
         default: Help(p); return;
     }
 }
开发者ID:jonnyli1125,项目名称:MCDawn,代码行数:71,代码来源:CmdWayPoint.cs

示例12: Blockchange1


//.........这里部分代码省略.........
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the botgun.", false);
                                                    Command.all.Find("botadd").Use(pl, p.name);
                                                }
                                                else if (bp.ending == 7)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the maingun.", false);
                                                    Command.all.Find("main").Use(pl, "");
                                                }
                                                else if (bp.ending == 8)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the demotegun.", false);
                                                    Command.all.Find("demote").Use(p, pl.name);
                                                }
                                                else if (bp.ending == 9)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the promotegun.", false);
                                                    Command.all.Find("promote").Use(p, pl.name);
                                                }
                                                else if (bp.ending == 10)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the jokergun.", false);
                                                    Command.all.Find("joker").Use(p, pl.name);
                                                }
                                                else if (bp.ending == 11)
                                                {
                                                    try
                                                    {
                                                        Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the kickgun.", false);
                                                        Command.all.Find("kick").Use(p, pl.name);
                                                        break;
                                                    }
                                                    catch { }
                                                }
                                                else if (bp.ending == 12)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the undogun.", false);
                                                    Command.all.Find("undo").Use(pl, "");
                                                }
                                                else if (bp.ending == 13)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the redogun.", false);
                                                    Command.all.Find("redo").Use(pl, "");
                                                }
                                                else if (bp.ending == 14)
                                                {
                                                    try
                                                    {
                                                        Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the xbangun.", false);
                                                        Command.all.Find("xban").Use(p, pl.name);
                                                        break;
                                                    }
                                                    catch { }
                                                }
                                                else if (bp.ending == 15)
                                                {
                                                    Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the rulesgun.", false);
                                                    Command.all.Find("rules").Use(p, pl.name);
                                                }
                                                else { pl.HandleDeath(Block.stone, " was shot by " + p.color + p.name); }
                                                comeOut = true;

                                                // freeze, cage, bot, main, demote, promote, joker, kick, undo, redo, xban, rules");

                                            }
                                        }
                                    }
                                }
                            }
                            if (comeOut) break;

                            if (t > 12 && bp.ending != 3)
                            {
                                pos = previous[0];
                                p.level.Blockchange(pos.x, pos.y, pos.z, Block.air);
                                previous.Remove(pos);
                            }

                            if (bp.ending != 3) Thread.Sleep(20);
                        }

                        if (bp.ending == -1)
                            try
                            {
                                unchecked { p.SendPos((byte)-1, (ushort)(previous[previous.Count - 3].x * 32), (ushort)(previous[previous.Count - 3].y * 32 + 32), (ushort)(previous[previous.Count - 3].z * 32), p.rot[0], p.rot[1]); }
                            }
                            catch { }
                        if (bp.ending == 3) Thread.Sleep(400);

                        foreach (CatchPos pos1 in previous)
                        {
                            p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air);
                            if (bp.ending != 3) Thread.Sleep(20);
                        }
                    }
                    catch (Exception e) { Server.ErrorLog(e); }
                }));
                gunThread.Start();
            }
            catch { }
        }
开发者ID:ddeckys,项目名称:MCDawn,代码行数:101,代码来源:CmdGun.cs

示例13: Use

        public override void Use(Player p, string message)
        {
            if (message == "") message = "list";

            string[] parameters = message.Split(' ');

            if (parameters[0].ToLower() == "list")
            {
                if (parameters.Length > 1)
                {
                    int pageNum, currentNum;
                    try
                    {
                        pageNum = int.Parse(parameters[1]) * 10; currentNum = pageNum - 10;
                    }
                    catch { Help(p); return; }

                    if (currentNum < 0) { Player.SendMessage(p, "Must be greater than 0"); return; }
                    if (pageNum > p.level.ZoneList.Count) pageNum = p.level.ZoneList.Count;
                    if (currentNum > p.level.ZoneList.Count) { Player.SendMessage(p, "No Zones beyond number " + (p.level.ZoneList.Count - 1)); return; }

                    Player.SendMessage(p, "Zones (" + currentNum + " to " + (pageNum - 1) + "):");
                    for (int i = currentNum; i < pageNum; i++)
                    {
                        Level.Zone zone = p.level.ZoneList[i];
                        Player.SendMessage(p, "&c" + i + " &b(" +
                            zone.smallX + "-" + zone.bigX + ", " +
                            zone.smallY + "-" + zone.bigY + ", " +
                            zone.smallZ + "-" + zone.bigZ + ") &f" +
                            zone.Owner);
                    }
                }
                else
                {
                    for (int i = 0; i < p.level.ZoneList.Count; i++)
                    {
                        Level.Zone zone = p.level.ZoneList[i];
                        Player.SendMessage(p, "&c" + i + " &b(" +
                            zone.smallX + "-" + zone.bigX + ", " +
                            zone.smallY + "-" + zone.bigY + ", " +
                            zone.smallZ + "-" + zone.bigZ + ") &f" +
                            zone.Owner);
                    }
                    Player.SendMessage(p, "For a more structured list, use /tpzone list <1/2/3/..>");
                }
            }
            else
            {
                int zoneID;
                try
                {
                    zoneID = int.Parse(message);
                }
                catch { Help(p); return; }

                if (zoneID < 0 || zoneID > p.level.ZoneList.Count)
                {
                    Player.SendMessage(p, "This zone doesn't exist");
                    return;
                }

                Level.Zone zone = p.level.ZoneList[zoneID];
                unchecked { p.SendPos((byte)-1, (ushort)(zone.bigX * 32 + 16), (ushort)(zone.bigY * 32 + 32), (ushort)(zone.bigZ * 32 + 16), p.rot[0], p.rot[1]); }

                Player.SendMessage(p, "Teleported to zone &c" + zoneID + " &b(" +
                    zone.bigX + ", " + zone.bigY + ", " + zone.bigZ + ") &f" +
                    zone.Owner);
            }
        }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:69,代码来源:CmdTpZone.cs


注:本文中的MCDawn.Player.SendPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。