public void Execute(IRocketPlayer caller, string[] command)
 {
     if (command.Length == 0)
     {
         UnturnedChat.Say(caller, Syntax);
     }
     else
     {
         UnturnedPlayer Player = UnturnedPlayer.FromName(command[0]);
         if (Player == null)
         {
             UnturnedChat.Say(caller, "DisableVehicleAccess_NoPlayer".Translate());
         }
         else
         {
             var Store = PlayerDataStore.GetPlayerData(Player);
             Store.CanEnterVehicle = !Store.CanEnterVehicle;
             if (Store.CanEnterVehicle)
             {
                 UnturnedChat.Say(caller, "DisableVehicleAccess_AccessEnabled".Translate());
             }
             else
             {
                 if (Player.IsInVehicle)
                 {
                     Player.CurrentVehicle.forceRemovePlayer(out byte seat, Player.CSteamID, out Vector3 pos, out byte angle);
                     SDG.Unturned.VehicleManager.sendExitVehicle(Player.CurrentVehicle, seat, pos, angle, true);
                 }
                 UnturnedChat.Say(caller, "DisableVehicleAccess_AccessDisabled".Translate());
             }
         }
     }
 }
        public static bool PlayerCanFlyAtSpeed(UnturnedPlayer Player, float Speed)
        {
            float      MaxSpeed = GetPlayerMaxFlySpeed(Player);
            PlayerData data     = PlayerDataStore.GetPlayerData(Player);

            if (data != null && data.FlightSpeedPermitOverride != 0)
            {
                MaxSpeed = data.FlightSpeedPermitOverride;
            }
            return(Math.Abs(Speed) <= MaxSpeed);
        }
        private void VehicleManager_onEnterVehicleRequested(Player player, InteractableVehicle vehicle, ref bool shouldAllow)
        {
            var Data = PlayerDataStore.GetPlayerData(UnturnedPlayer.FromPlayer(player));

            if (Data != null)
            {
                if (!Data.CanEnterVehicle)
                {
                    shouldAllow = false;
                }
            }
        }
 public void Execute(IRocketPlayer caller, string[] command)
 {
     if (command.Length == 0)
     {
         UnturnedChat.Say(caller, Syntax);
     }
     else
     {
         UnturnedPlayer Player = UnturnedPlayer.FromName(command[0]);
         if (Player == null)
         {
             UnturnedChat.Say(caller, "Error_PlayerNotFound".Translate());
             return;
         }
         int NewOverride = 0;
         if (command.Length > 1)
         {
             bool failed = false;
             try
             {
                 NewOverride = Convert.ToInt32(command[1]);
             }
             catch (FormatException)
             {
                 failed = true;
             }
             catch (OverflowException)
             {
                 failed = true;
             }
             if (failed)
             {
                 UnturnedChat.Say(caller, "Flight_PermitSpeed_InvalidNumber".Translate());
                 return;
             }
         }
         PlayerData data = PlayerDataStore.GetPlayerData(Player);
         if (data == null)
         {
             return;
         }
         data.FlightSpeedPermitOverride = NewOverride;
         if (NewOverride == 0)
         {
             UnturnedChat.Say(caller, "Flight_PermitSpeed_Reset".Translate());
         }
         else
         {
             UnturnedChat.Say(caller, "Flight_PermitSpeed_Updated".Translate());
         }
     }
 }