From 06ef762dcd595e9a3efb871f7638384040bb3c7b Mon Sep 17 00:00:00 2001 From: "michael.reiswich" Date: Sun, 30 May 2021 14:36:23 +0200 Subject: [PATCH] boote anderer spawn --- .../Managers/VehicleManager.cs | 146 ++++++++++++++++-- 1 file changed, 131 insertions(+), 15 deletions(-) diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index b7ae3bb5..130f312d 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -911,6 +911,23 @@ namespace ReallifeGamemode.Server.Managers VehicleRespawnPoints.Add(pos19); VehicleRespawnPoints.Add(pos20); #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 _serverVehicles = new Dictionary(); @@ -1128,17 +1145,32 @@ namespace ReallifeGamemode.Server.Managers if (sV is UserVehicle uV) { - - foreach (VehicleRespawnPoint point in VehicleRespawnPoints) + if(vehicle.Class == 14) //boot { - if (!NAPI.Pools.GetAllVehicles().Any(v => v.Position.DistanceTo(point.Position) < 1)) + foreach (VehicleRespawnPoint point in BootRespawnPoints) { - sV.PositionX = point.Position.X; - sV.PositionY = point.Position.Y; - sV.PositionZ = point.Position.Z; - sV.Heading = point.Heading; - dbContext.SaveChanges(); - break; + 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) + { + 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; + } } } User user = dbContext.Users.Find(uV.UserId); @@ -1158,7 +1190,6 @@ namespace ReallifeGamemode.Server.Managers } } - [RemoteEvent("CLIENT:setMarkerBehindVehicle")] 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))); vehicle.AddMarkerBehind(vector3); } - #region spawnpositions-vehicleInWater + #region spawnpositions-Vehicle public static List VehicleRespawnPoints = new List(); @@ -1315,12 +1346,97 @@ namespace ReallifeGamemode.Server.Managers new Vector3(-345.78, -931.86, 31.08), //Heading -110.89556 }.AsReadOnly(); */ - #endregion spawnpositions-vehicleInWater + #endregion spawnpositions-Vehicle - [RemoteEvent("CheckWater")] - public static void CheckWater(Player player, int id) + #region spawnpositions-Boot + + public static List BootRespawnPoints = new List(); + + 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 PlaneRespawnPoints = new List(); + + 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); } } }