示例#1
0
        void SendMapMotd()
        {
            byte[] packet = Packet.Motd(this, level.GetMotd(this));
            if (OnSendMOTD != null)
            {
                OnSendMOTD(this, packet);
            }
            Send(packet);

            if (!HasCpeExt(CpeExt.HackControl))
            {
                return;
            }
            Send(Hacks.MakeHackControl(this));
            if (Game.Referee)
            {
                Send(Packet.HackControl(true, true, true, true, true, -1));
            }
        }
示例#2
0
        public void SendMapMotd()
        {
            string motd = GetMotd();

            motd = Chat.Format(motd, this);
            OnSendingMotdEvent.Call(this, ref motd);

            byte[] packet = Packet.Motd(this, motd);
            Send(packet);

            if (!Supports(CpeExt.HackControl))
            {
                return;
            }
            Send(Hacks.MakeHackControl(this, motd));
            if (Game.Referee)
            {
                Send(Packet.HackControl(true, true, true, true, true, -1));
            }
        }
示例#3
0
        public static byte[] MakeHackControl(Player p, string motd)
        {
            motd = Colors.Strip(motd);
            bool isOp = p.Rank >= LevelPermission.Operator;

            bool  fly = true, noclip = true, speed = true, respawn = true, _3rdPerson = true;
            short maxJump = -1;

            string[] parts = motd.SplitSpaces();
            for (int i = 0; i < parts.Length; i++)
            {
                string part = parts[i];
                if (part.CaselessEq("-hax"))
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                if (part.CaselessEq("-hax"))
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                else if (part.CaselessEq("-ophax") && isOp)
                {
                    fly = false; noclip = false; speed = false; respawn = false; _3rdPerson = false;
                }
                else if (part.CaselessEq("+ophax") && isOp)
                {
                    fly = true; noclip = true; speed = true; respawn = true; _3rdPerson = true;
                }

                if (part.CaselessEq("+noclip"))
                {
                    noclip = true;
                }
                else if (part.CaselessEq("+fly"))
                {
                    fly = true;
                }
                else if (part.CaselessEq("+speed"))
                {
                    speed = true;
                }
                else if (part.CaselessEq("+respawn"))
                {
                    respawn = true;
                }
                else if (part.CaselessEq("+thirdperson"))
                {
                    _3rdPerson = true;
                }

                if (part.CaselessEq("-noclip"))
                {
                    noclip = false;
                }
                else if (part.CaselessEq("-fly"))
                {
                    fly = false;
                }
                else if (part.CaselessEq("-speed"))
                {
                    speed = false;
                }
                else if (part.CaselessEq("-respawn"))
                {
                    respawn = false;
                }
                else if (part.CaselessEq("-thirdperson"))
                {
                    _3rdPerson = false;
                }

                if (!part.CaselessStarts("jumpheight="))
                {
                    continue;
                }
                string heightPart = part.Substring(part.IndexOf('=') + 1);
                float  value;
                if (Utils.TryParseDecimal(heightPart, out value))
                {
                    maxJump = (short)(value * 32);
                }
            }
            return(Packet.HackControl(fly, noclip, speed, respawn, _3rdPerson, maxJump));
        }