public static void swapseats(ConsoleSystem.Arg arg) { int num = 0; BasePlayer basePlayer = arg.Player(); if (basePlayer == null) { return; } if (basePlayer.SwapSeatCooldown()) { return; } BaseMountable mounted = basePlayer.GetMounted(); if (mounted == null) { return; } BaseVehicle component = mounted.GetComponent <BaseVehicle>(); if (component == null) { component = mounted.VehicleParent(); } if (component == null) { return; } component.SwapSeats(basePlayer, num); }
public static void swapseats(ConsoleSystem.Arg arg) { int targetSeat = 0; BasePlayer player = arg.Player(); if (Object.op_Equality((Object)player, (Object)null) || player.SwapSeatCooldown()) { return; } BaseMountable mounted = player.GetMounted(); if (Object.op_Equality((Object)mounted, (Object)null)) { return; } BaseVehicle baseVehicle = (BaseVehicle)((Component)mounted).GetComponent <BaseVehicle>(); if (Object.op_Equality((Object)baseVehicle, (Object)null)) { baseVehicle = mounted.VehicleParent(); } if (Object.op_Equality((Object)baseVehicle, (Object)null)) { return; } baseVehicle.SwapSeats(player, targetSeat); }
private void OnEntityDismounted(BaseMountable mountable, BasePlayer player) { CarController controller = mountable.VehicleParent()?.GetComponent <CarController>(); if (controller != null && controller.player == player) { controller.OnDriverExit(); } }
bool?CanMountEntity(BasePlayer player, BaseMountable entity) { if (entity != null && player != null) { BaseVehicle vehicleEntity = entity.VehicleParent(); if (vehicleEntity != null && CheckAnyRestrictionsMatched(player.inventory.containerWear.itemList, player, vehicleEntity, false)) { return(false); } } return(null); }
private void OnEntityDismounted(BaseMountable entity, BasePlayer player) { var vehicleParent = entity?.VehicleParent(); if (vehicleParent == null) { return; } Vehicle vehicle; if (!_vehiclesCache.TryGetValue(vehicleParent.net.ID, out vehicle)) { return; } vehicle.LastDismount = DateTime.UtcNow; }
private void OnEntityDismounted(BaseMountable entity, BasePlayer player) { var vehicleParent = entity?.VehicleParent(); if (vehicleParent == null) { return; } LisencedPlayer lisencedPlayer; if (!_boatsCache.TryGetValue(vehicleParent.net.ID, out lisencedPlayer)) { return; } lisencedPlayer.UpdateBoatLastDismount(vehicleParent.net.ID); }
public static void swapseats(Arg arg) { int targetSeat = 0; BasePlayer basePlayer = ArgEx.Player(arg); if (basePlayer == null || basePlayer.SwapSeatCooldown()) { return; } BaseMountable mounted = basePlayer.GetMounted(); if (!(mounted == null)) { BaseVehicle baseVehicle = mounted.GetComponent <BaseVehicle>(); if (baseVehicle == null) { baseVehicle = mounted.VehicleParent(); } if (!(baseVehicle == null)) { baseVehicle.SwapSeats(basePlayer, targetSeat); } } }
object CanMountEntity(BasePlayer player, BaseMountable entity) { if ( player == null || entity == null || player is Scientist || player.IPlayer == null ) { return(null); } // Only restrict to driver's seats if ( entity.name != chinookPilotSeat && entity.name != sedanDriverSeat && entity.name != smallBoatDriverSeat && entity.name != miniHeliSeat && entity.name != rhibDriverSeat && entity.name != saddlePrefab && entity.name != scrapTransportSeat ) { return(null); } var vehicle = entity.VehicleParent(); // If the player already owns the vehicle if (vehicle == null || vehicle.OwnerID == player.userID) { return(null); } // If the player is in a safe zone, they can always take any vehicle // Additionaly, if it's unowned, it can be taken. This sets ownership // to the player taking the vehicle. if (vehicle.OwnerID == 0 || (!player.InSafeZone() && player.CanBuild())) { player.IPlayer.Message(lang.GetMessage("vehicle.owned", this, player.IPlayer.Id)); vehicle.OwnerID = player.userID; return(null); } // Players who are standing in a place they are authorized to build, // with or without TC coverage, they can take a vehicle. var bp = player.GetBuildingPrivilege(); if (bp != null) { // At this point we need to determine if the owner is authorized to the // tool cupboard providing the build privileges. This is so if someone // parks their vehicle at an enemy base, anyone can take it. foreach (ProtoBuf.PlayerNameID playerNameID in bp.authorizedPlayers) { if (playerNameID.userid == vehicle.OwnerID) { player.IPlayer.Message(lang.GetMessage("vehicle.locked", this, player.IPlayer.Id)); return(false); } } } // All other checks have failed, the vehicle is theirs to take. player.IPlayer.Message(lang.GetMessage("vehicle.owned", this, player.IPlayer.Id)); vehicle.OwnerID = player.userID; return(null); }