SendPos() public method

public SendPos ( byte id, ushort x, ushort y, ushort z, byte rotx, byte roty ) : void
id byte
x ushort
y ushort
z ushort
rotx byte
roty byte
return void
Example #1
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                if (Player.ValidName(message))
                {
                    Player target = Player.Find(message);
                    if (target != null)
                    {
                        // if the target is visible or your rank is higher than theirs, then teleport
                        if (!target.hidden || p.Rank > target.Rank)
                        {
                            if (p.level != target.level)
                            {
                                // Change levels if needed
                                p.ChangeLevel(target.level.name);
                            }
                            // Teleport to the player
                            unchecked
                            {
                                p.SendPos((byte)-1, target.pos[0], target.pos[1], target.pos[2], target.rot[0], 0);
                            }
                        }
                        else
                        {
                            // Player is offline
                            p.SendMessage("There is no player \"" + message + "\"!");
                        }
                    }
                    else
                    {
                        // Player is offline
                        p.SendMessage("There is no player \"" + message + "\"!");
                    }

                }
                else
                {
                    p.SendMessage("Invalid Name!");
                }
            }
            else
            {
                Help(p);
            }
        }
Example #2
0
 // Code to run when used by a player
 public override void Use(Player p,string message)
 {
     if (message == "")
     {
         // Send the player to the spawnpoint of the level
         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);
         }
     }
     else
     {
         Help(p);
     }
 }
Example #3
0
        void fTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            foreach (string s in dList.Keys)
            {
                adminPlayer = Player.Find(s);
                targetPlayer = Player.Find(dList[s]);

                if (targetPlayer != null)
                {
                    if (targetPlayer.level != adminPlayer.level)
                    {
                        dList.Remove(adminPlayer.name);
                        adminPlayer.SendMessage("Stopped following: " + targetPlayer.color + targetPlayer.name);
                        adminPlayer.SendMessage("Player moved to: " + targetPlayer.level.name);
                        return;
                    }
                    //if (lastPos != targetPlayer.pos || lastRot != targetPlayer.rot)
                    //{
                    //lastPos = targetPlayer.pos;
                    //lastRot = targetPlayer.rot;
                    unchecked { adminPlayer.SendPos((byte)-1, targetPlayer.pos[0], targetPlayer.pos[1], targetPlayer.pos[2], targetPlayer.rot[0], targetPlayer.rot[1]); }
                    //}
                }
                else
                {
                    adminPlayer.SendMessage("Following stopped!");
                    dList.Remove(adminPlayer.name);
                    break;
                }
            }
        }