boote anderer spawn

This commit is contained in:
michael.reiswich
2021-05-30 14:36:23 +02:00
parent 50e4026a37
commit 06ef762dcd

View File

@@ -911,6 +911,23 @@ namespace ReallifeGamemode.Server.Managers
VehicleRespawnPoints.Add(pos19); VehicleRespawnPoints.Add(pos19);
VehicleRespawnPoints.Add(pos20); VehicleRespawnPoints.Add(pos20);
#endregion add_VehicleRespawnPoints #endregion add_VehicleRespawnPoints
#region add_BootRespawnPoints
VehicleRespawnPoints.Add(Boot1);
VehicleRespawnPoints.Add(Boot2);
VehicleRespawnPoints.Add(Boot3);
VehicleRespawnPoints.Add(Boot4);
VehicleRespawnPoints.Add(Boot5);
#endregion add_BootRespawnPoints
/*
#region add_PlaneRespawnPoints
VehicleRespawnPoints.Add(plane1);
VehicleRespawnPoints.Add(plane2);
VehicleRespawnPoints.Add(plane3);
VehicleRespawnPoints.Add(plane4);
VehicleRespawnPoints.Add(plane5);
#endregion add_PlaneRespawnPoints
*/
} }
private static readonly Dictionary<int, ushort> _serverVehicles = new Dictionary<int, ushort>(); private static readonly Dictionary<int, ushort> _serverVehicles = new Dictionary<int, ushort>();
@@ -1128,7 +1145,21 @@ namespace ReallifeGamemode.Server.Managers
if (sV is UserVehicle uV) if (sV is UserVehicle uV)
{ {
if(vehicle.Class == 14) //boot
{
foreach (VehicleRespawnPoint point in BootRespawnPoints)
{
if (!NAPI.Pools.GetAllVehicles().Any(v => v.Position.DistanceTo(point.Position) < 1))
{
sV.PositionX = point.Position.X;
sV.PositionY = point.Position.Y;
sV.PositionZ = point.Position.Z;
sV.Heading = point.Heading;
dbContext.SaveChanges();
break;
}
}
}else {
foreach (VehicleRespawnPoint point in VehicleRespawnPoints) foreach (VehicleRespawnPoint point in VehicleRespawnPoints)
{ {
if (!NAPI.Pools.GetAllVehicles().Any(v => v.Position.DistanceTo(point.Position) < 1)) if (!NAPI.Pools.GetAllVehicles().Any(v => v.Position.DistanceTo(point.Position) < 1))
@@ -1141,6 +1172,7 @@ namespace ReallifeGamemode.Server.Managers
break; break;
} }
} }
}
User user = dbContext.Users.Find(uV.UserId); User user = dbContext.Users.Find(uV.UserId);
user.Player?.SendNotification("Dein Fahrzeug ist zerstört~n~Du kannst es im Interaktionsmenü unter \"Fahrzeuge\" orten"); user.Player?.SendNotification("Dein Fahrzeug ist zerstört~n~Du kannst es im Interaktionsmenü unter \"Fahrzeuge\" orten");
vehicle.Delete(); vehicle.Delete();
@@ -1158,7 +1190,6 @@ namespace ReallifeGamemode.Server.Managers
} }
} }
[RemoteEvent("CLIENT:setMarkerBehindVehicle")] [RemoteEvent("CLIENT:setMarkerBehindVehicle")]
public void setVectorBehindVehicle(Player player, int id, string jsonX, string jsonY, string jsonZ) public void setVectorBehindVehicle(Player player, int id, string jsonX, string jsonY, string jsonZ)
{ {
@@ -1166,7 +1197,7 @@ namespace ReallifeGamemode.Server.Managers
Vector3 vector3 = new Vector3(Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonX)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonY)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonZ))); Vector3 vector3 = new Vector3(Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonX)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonY)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonZ)));
vehicle.AddMarkerBehind(vector3); vehicle.AddMarkerBehind(vector3);
} }
#region spawnpositions-vehicleInWater #region spawnpositions-Vehicle
public static List<VehicleRespawnPoint> VehicleRespawnPoints = new List<VehicleRespawnPoint>(); public static List<VehicleRespawnPoint> VehicleRespawnPoints = new List<VehicleRespawnPoint>();
@@ -1315,12 +1346,97 @@ namespace ReallifeGamemode.Server.Managers
new Vector3(-345.78, -931.86, 31.08), //Heading -110.89556 new Vector3(-345.78, -931.86, 31.08), //Heading -110.89556
}.AsReadOnly(); }.AsReadOnly();
*/ */
#endregion spawnpositions-vehicleInWater #endregion spawnpositions-Vehicle
[RemoteEvent("CheckWater")] #region spawnpositions-Boot
public static void CheckWater(Player player, int id)
public static List<VehicleRespawnPoint> BootRespawnPoints = new List<VehicleRespawnPoint>();
VehicleRespawnPoint Boot1 = new VehicleRespawnPoint()
{ {
CheckVehicleDeath(id); Position = new Vector3(-999.68, -1397.92, -0.53),
Heading = 19.44f
};
VehicleRespawnPoint Boot2 = new VehicleRespawnPoint()
{
Position = new Vector3(-999.24, -1395.28, 0.53),
Heading = 22.01f
};
VehicleRespawnPoint Boot3 = new VehicleRespawnPoint()
{
Position = new Vector3(-981.93, -1393.21, 0.53),
Heading = 22.01f
};
VehicleRespawnPoint Boot4 = new VehicleRespawnPoint()
{
Position = new Vector3(-974.31, -1389.88, 0.53),
Heading = 19.46f
};
VehicleRespawnPoint Boot5 = new VehicleRespawnPoint()
{
Position = new Vector3(-964.71, -1388.49, 0.53),
Heading = 21.17f
};
#endregion spawnpositions-
/* #region spawnpositions-Plane
public static List<VehicleRespawnPoint> PlaneRespawnPoints = new List<VehicleRespawnPoint>();
VehicleRespawnPoint plane1 = new VehicleRespawnPoint()
{
Position = new Vector3(-999.68, -1397.92, -0.53),
Heading = 19.44f
};
VehicleRespawnPoint plane2 = new VehicleRespawnPoint()
{
Position = new Vector3(-999.24, -1395.28, 0.53),
Heading = 22.01f
};
VehicleRespawnPoint plane3 = new VehicleRespawnPoint()
{
Position = new Vector3(-981.93, -1393.21, 0.53),
Heading = 22.01f
};
VehicleRespawnPoint plane4 = new VehicleRespawnPoint()
{
Position = new Vector3(-974.31, -1389.88, 0.53),
Heading = 19.46f
};
VehicleRespawnPoint plane5 = new VehicleRespawnPoint()
{
Position = new Vector3(-964.71, -1388.49, 0.53),
Heading = 21.17f
};
#endregion spawnpositions-Plane
*/
[RemoteEvent("CheckWater")]
public static void CheckWater(Player player, Vehicle vehicle)
{
if(vehicle.Class == 14) //boot
{
return;
}
CheckVehicleDeath(vehicle.Id);
} }
} }
} }