diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 6520c391..92737c1e 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -263,7 +263,8 @@ namespace ReallifeGamemode.Server.Events } nearestBehindVehiclePoint.vehicle.RemoveMarkerBehind(); - + ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(vehicle); + sVeh.Spawn(vehicle); return; } foreach (var v in vehicleItems) diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index 8eefebda..ec064e89 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -893,14 +893,15 @@ namespace ReallifeGamemode.Server.Managers public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh, DatabaseContext dbContext = null) { + if (veh == null) + { + return null; + } + dbContext = dbContext ?? new DatabaseContext(); foreach (KeyValuePair pair in _serverVehicles) { - if (veh == null) - { - continue; - } if (pair.Value == veh.Handle) {