fCraft.Command.Rewind C# (CSharp) Method

Rewind() public method

Resets the argument offset. After calling Rewind, arguments can be read from the beginning again.
public Rewind ( ) : void
return void
        public void Rewind()
        {
            Offset = 1;
            Next();
        }

Usage Example

示例#1
0
 void TP(Player player, Command cmd)
 {
     if (player.Can(Permissions.Teleport))
     {
         string name = cmd.Next();
         if (name == null)
         {
             player.Send(PacketWriter.MakeTeleport(255, world.map.spawn));
         }
         else
         {
             Player target = world.FindPlayer(name);
             if (target != null)
             {
                 Position pos = target.pos;
                 pos.x += 1;
                 pos.y += 1;
                 pos.h += 1;
                 player.Send(PacketWriter.MakeTeleport(255, pos));
             }
             else if (cmd.Next() == null)
             {
                 world.NoPlayerMessage(player, name);
             }
             else
             {
                 cmd.Rewind();
                 int x, y, h;
                 if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out h))
                 {
                     if (x < 0 || x > world.map.widthX ||
                         y < 0 || y > world.map.widthY ||
                         y < 0 || y > world.map.height)
                     {
                         player.Message("Specified coordinates are outside the map!");
                     }
                     else
                     {
                         player.pos.Set(x * 32 + 16, y * 32 + 16, h * 32 + 16, player.pos.r, player.pos.l);
                         player.Send(PacketWriter.MakeTeleport(255, player.pos));
                     }
                 }
                 else
                 {
                     player.Message("See " + Color.Help + "/help tp" + Color.Sys + " for information on using /tp");
                 }
             }
         }
     }
     else
     {
         world.NoAccessMessage(player);
     }
 }
All Usage Examples Of fCraft.Command::Rewind