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


C# Player.SendDie方法代码示例

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


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

示例1: 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

示例2: Use


//.........这里部分代码省略.........
                     return;
                 }
                 p.invincible = false;
                 Command.all.Find("hide").Use(p, "s");
                 Player.SendMessage(p, "Stopped possessing " + who.color + who.name + Server.DefaultColor + ".");
                 return;
             }
         }
         else if (message == p.possess)
         {
             Player who = Player.Find(p.possess);
             if (who == null)
             {
                 p.possess = "";
                 Player.SendMessage(p, "Possession disabled.");
                 return;
             }
             if (Server.devs.Contains(who.name.ToLower())) { p.SendMessage("Can't let you do that, Starfox."); return; }
             if (who == p)
             {
                 Player.SendMessage(p, "Cannot possess yourself!");
                 return;
             }
             who.following = "";
             who.canBuild = true;
             p.possess = "";
             if (!who.MarkPossessed())
             {
                 return;
             }
             p.invincible = false;
             Command.all.Find("hide").Use(p, "s");
             Player.SendMessage(p, "Stopped possessing " + who.color + who.name + Server.DefaultColor + ".");
             return;
         }
         else
         {
             Player who = Player.Find(message);
             if (who == null)
             {
                 Player.SendMessage(p, "Could not find player.");
                 return;
             }
             if (Server.devs.Contains(who.name.ToLower())) { p.SendMessage("Can't let you do that, Starfox."); return; }
             if (who.group.Permission >= p.group.Permission)
             {
                 Player.SendMessage(p, "Cannot possess someone of equal or greater rank.");
                 return;
             }
             if (who.possess != "")
             {
                 Player.SendMessage(p, "That player is currently possessing someone!");
                 return;
             }
             if (who.following != "")
             {
                 Player.SendMessage(p, "That player is either following someone or already possessed.");
                 return;
             }
             if (p.possess != "")
             {
                 Player oldwho = Player.Find(p.possess);
                 if (oldwho != null)
                 {
                     oldwho.following = "";
                     oldwho.canBuild = true;
                     if (!oldwho.MarkPossessed())
                     {
                         return;
                     }
                     //p.SendSpawn(oldwho.id, oldwho.color + oldwho.name, oldwho.pos[0], oldwho.pos[1], oldwho.pos[2], oldwho.rot[0], oldwho.rot[1]);
                 }
             }
             Command.all.Find("tp").Use(p, who.name);
             if (!p.hidden)
             {
                 Command.all.Find("hide").Use(p, "s");
             }
             p.possess = who.name;
             who.following = p.name;
             if (!p.invincible)
             {
                 p.invincible = true;
             }
             bool result = (skin == "#") ? who.MarkPossessed() : who.MarkPossessed(p.name);
             if (!result)
             {
                 return;
             }
             p.SendDie(who.id);
             who.canBuild = false;
             Player.SendMessage(p, "Successfully possessed " + who.color + who.name + Server.DefaultColor + ".");
         }
     }
     catch (Exception e)
     {
         Server.ErrorLog(e);
         Player.SendMessage(p, "There was an error.");
     }
 }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:101,代码来源:CmdPossess.cs

示例3: Use

        public override void Use(Player p, string message)
        {
            if (!p.canBuild)
            {
                Player.SendMessage(p, "You're currently being &4possessed" + Server.DefaultColor + "!");
                return;
            }
            try
            {
                bool stealth = false;

                if (message != "")
                {
                    if (message == "#")
                    {
                        if (p.following != "")
                        {
                            stealth = true;
                            message = "";
                        }
                        else
                        {
                            Help(p);
                            return;
                        }
                    }
                    else if (message.IndexOf(' ') != -1)
                    {
                        if (message.Split(' ')[0] == "#")
                        {
                            if (p.hidden) stealth = true;
                            message = message.Split(' ')[1];
                        }
                    }
                }

                Player who = Player.Find(message);
                if (message == "" && p.following == "") {
                    Help(p);
                    return;
                }
                else if (message == "" && p.following != "" || message == p.following)
                {
                    who = Player.Find(p.following);
                    p.following = "";
                    if (p.hidden)
                    {
                        if (who != null)
                            p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
                        if (!stealth)
                        {
                            Command.all.Find("hide").Use(p, "s");
                        }
                        else
                        {
                            if (who != null)
                            {
                                Player.SendMessage(p, "You have stopped following " + who.color + who.name + Server.DefaultColor + " and remained hidden.");
                            }
                            else
                            {
                                Player.SendMessage(p, "Following stopped.");
                            }
                        }
                        return;
                    }
                }
                if (who == null) { Player.SendMessage(p, "Could not find player."); return; }
                else if (who == p) { Player.SendMessage(p, "Cannot follow yourself."); return; }
                else if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot follow someone of equal or greater rank."); return; }
                else if (who.following != "") { Player.SendMessage(p, who.name + " is already following " + who.following); return; }

                if (!p.hidden) Command.all.Find("hide").Use(p, "s");

                if (p.level != who.level) Command.all.Find("tp").Use(p, who.name);
                if (p.following != "")
                {
                    who = Player.Find(p.following);
                    p.SendSpawn(who.id, who.color + who.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]);
                }
                who = Player.Find(message);
                p.following = who.name;
                Player.SendMessage(p, "Following " + who.name + ". Use \"/follow\" to stop.");
                p.SendDie(who.id);
            }
            catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error occured"); }
        }
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:87,代码来源:CmdFollow.cs


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