Beispiel #1
0
 public static void teleport(ref ConsoleSystem.Arg arg)
 {
     if (arg.Args.Length >= 2)
     {
         string[] array = arg.Args;
         if (array[0].Contains(","))
         {
             array = string.Join(" ", array).Replace(",", " ").Split(new string[]
             {
                 " "
             }, StringSplitOptions.RemoveEmptyEntries);
         }
         PlayerClient playerClient = Helper.GetPlayerClient(array[0]);
         if (playerClient == null)
         {
             arg.ReplyWith("Player with name " + Helper.QuoteSafe(array[0]) + " not found.");
         }
         else
         {
             Vector3 vector = Vector3.zero;
             if (array.Length > 2)
             {
                 float x = 0f;
                 float y = 0f;
                 float z = 0f;
                 if (!float.TryParse(array[1], out x) || !float.TryParse(array[2], out y) || !float.TryParse(array[3], out z))
                 {
                     arg.ReplyWith("Invalid syntax for execute command");
                     return;
                 }
                 vector = new Vector3(x, y, z);
                 arg.ReplyWith(Helper.QuoteSafe(playerClient.userName) + " teleported to " + vector.AsString());
             }
             else
             {
                 PlayerClient playerClient2 = Helper.GetPlayerClient(array[1]);
                 if (playerClient2 == null)
                 {
                     arg.ReplyWith(Config.GetMessage("Command.PlayerNoFound", null, array[1]));
                     return;
                 }
                 if (playerClient == playerClient2 || !ServerManagement.GetOrigin(playerClient2.netPlayer, true, out vector))
                 {
                     arg.ReplyWith(playerClient.userName + " cannot be teleported to " + playerClient2.userName);
                     return;
                 }
                 arg.ReplyWith(Helper.QuoteSafe(playerClient.userName) + " teleported to " + Helper.QuoteSafe(playerClient2.userName));
             }
             Helper.TeleportTo(playerClient.netUser, vector);
         }
     }
 }
Beispiel #2
0
 public static void teleport(ref ConsoleSystem.Arg arg)
 {
     if (arg.Args.Length >= 2)
     {
         string[] args = arg.Args;
         if (args[0].Contains(","))
         {
             args = string.Join(" ", args).Replace(",", " ").Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
         }
         PlayerClient playerClient = Helper.GetPlayerClient(args[0]);
         if (playerClient == null)
         {
             arg.ReplyWith("Player with name " + Helper.QuoteSafe(args[0]) + " not found.");
         }
         else
         {
             Vector3 zero = Vector3.zero;
             if (args.Length > 2)
             {
                 float result = 0f;
                 float num2   = 0f;
                 float num3   = 0f;
                 if ((!float.TryParse(args[1], out result) || !float.TryParse(args[2], out num2)) || !float.TryParse(args[3], out num3))
                 {
                     arg.ReplyWith("Invalid syntax for execute command");
                     return;
                 }
                 zero = new Vector3(result, num2, num3);
                 arg.ReplyWith(Helper.QuoteSafe(playerClient.userName) + " teleported to " + zero.AsString());
             }
             else
             {
                 PlayerClient client2 = Helper.GetPlayerClient(args[1]);
                 if (client2 == null)
                 {
                     arg.ReplyWith(Config.GetMessage("Command.PlayerNoFound", null, args[1]));
                     return;
                 }
                 if ((playerClient == client2) || !ServerManagement.GetOrigin(client2.netPlayer, true, out zero))
                 {
                     arg.ReplyWith(playerClient.userName + " cannot be teleported to " + client2.userName);
                     return;
                 }
                 arg.ReplyWith(Helper.QuoteSafe(playerClient.userName) + " teleported to " + Helper.QuoteSafe(client2.userName));
             }
             Helper.TeleportTo(playerClient.netUser, zero);
         }
     }
 }