Add /goto and /save goto

This commit is contained in:
VegaZ
2018-10-15 18:29:16 +02:00
parent 216bdb4c6c
commit 42e1dc6e07
7 changed files with 84 additions and 81 deletions

View File

@@ -15,10 +15,12 @@ namespace reallife_gamemode.Server.Managers
{
public class LoadManager : Script
{
public static List<GotoPoint> GotoPointList = new List<GotoPoint>();
public static List<Vehicle> FactionVehicleList = new List<Vehicle>();
public static List<Vehicle> ShopVehicleList = new List<Vehicle>();
public static List<Vehicle> UserVehicleList = new List<Vehicle>();
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
@@ -32,6 +34,13 @@ namespace reallife_gamemode.Server.Managers
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
}
}
foreach (Entities.GotoPoint g in loadData.GotoPoints)
{
if (g.Active == true)
{
GotoPointList.Add(g);
}
}
foreach (Saves.SavedVehicle v in loadData.Vehicles)
{
if (v.Active == true)

View File

@@ -124,6 +124,23 @@ namespace reallife_gamemode.Server.Events
saveData.SaveChanges();
}
}
public static void SaveGotoPoint(Client player, string description)
{
using (var saveData = new Model.DatabaseContext())
{
var dataSet = new Entities.GotoPoint
{
Description = description,
X = player.Position.X,
Y = player.Position.Y,
Z = player.Position.Z,
Active = true
};
saveData.GotoPoints.Add(dataSet);
saveData.SaveChanges();
}
}
public static void SaveAllOnSave()
{
using (var saveAll = new Model.DatabaseContext())