add option to park vehicles in vehicle menu
This commit is contained in:
@@ -159,16 +159,6 @@ namespace ReallifeGamemode.Server.Managers
|
||||
user.PositionZ = pos.Z;
|
||||
}
|
||||
|
||||
foreach (ServerVehicle veh in saveAll.ServerVehicles)
|
||||
{
|
||||
Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh);
|
||||
|
||||
veh.PositionX = v.Position.X;
|
||||
veh.PositionY = v.Position.Y;
|
||||
veh.PositionZ = v.Position.Z;
|
||||
veh.Heading = v.Heading;
|
||||
}
|
||||
|
||||
saveAll.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,27 +162,13 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh, DatabaseContext dbContext = null)
|
||||
{
|
||||
if (dbContext == null)
|
||||
dbContext = dbContext ?? new DatabaseContext();
|
||||
|
||||
foreach (KeyValuePair<int, NetHandle> pair in _serverVehicles)
|
||||
{
|
||||
using (dbContext = new DatabaseContext())
|
||||
if (pair.Value == veh.Handle)
|
||||
{
|
||||
foreach (KeyValuePair<int, NetHandle> pair in _serverVehicles)
|
||||
{
|
||||
if (pair.Value == veh.Handle)
|
||||
{
|
||||
return dbContext.ServerVehicles.Find(pair.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<int, NetHandle> pair in _serverVehicles)
|
||||
{
|
||||
if (pair.Value == veh.Handle)
|
||||
{
|
||||
return dbContext.ServerVehicles.Find(pair.Key);
|
||||
}
|
||||
return dbContext.ServerVehicles.Find(pair.Key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user