private void Teleport(Vector3 Location, float Rotation, IRocketPlayer caller, string name = null)
 {
     int numPlayers = Provider.clients.Count;
     List<string> excluded = new List<string>();
     if (numPlayers == 0)
     {
         UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("no_players_tpall"));
         return;
     }
     if (name == null)
         name = Location.xyz_Location();
     foreach (SteamPlayer player in Provider.clients)
     {
         // Don't teleport the player to teleport if they are in a car.
         if (player.player.stance.stance == EPlayerStance.DRIVING || player.player.stance.stance == EPlayerStance.SITTING)
         {
             numPlayers--;
             excluded.Add(player.playerID.characterName);
             continue;
         }
         UnturnedChat.Say(player.playerID.steamID, TeleportUtil.Instance.Translate("tp_success", name));
         player.player.sendTeleport(Location, MeasurementTool.angleToByte(Rotation));
     }
     UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("tpall_num_teleported", numPlayers, name, string.Join(", ", excluded.ToArray())));
 }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0)
            {
                UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("tprel_help"));
                return;
            }

            // Only allow the command to be ran with all three parameters.
            if (command.Length != 3)
            {
                UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("invalid_arg"));
                return;
            }
            else
            {
                float? x = command.GetFloatParameter(0);
                float? y = command.GetFloatParameter(1);
                float? z = command.GetFloatParameter(2);
                UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller;
                Vector3 newLocation;
                if (x.HasValue && y.HasValue && z.HasValue)
                {
                    // Compute new location from the relative location parameters entered into the command.
                    if (unturnedCaller.IsInVehicle)
                    {
                        InteractableVehicle vehicle = unturnedCaller.CurrentVehicle;
                        newLocation = new Vector3(vehicle.transform.position.x + x.Value, vehicle.transform.position.y + y.Value, vehicle.transform.position.z + z.Value);
                        if (vehicle.TeleportCar(unturnedCaller, newLocation))
                            UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("tp_success", newLocation.xyz_Location()));
                        else
                            UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("tp_fail_vehicle"));
                    }
                    else
                    {
                        newLocation = new Vector3(unturnedCaller.Position.x + x.Value, unturnedCaller.Position.y + y.Value, unturnedCaller.Position.z + z.Value);
                        unturnedCaller.Teleport(newLocation, unturnedCaller.Rotation);
                        UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("tp_success", newLocation.xyz_Location()));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("invalid_arg"));
                    return;
                }
            }
        }