save locations

This commit is contained in:
hydrant
2019-09-29 22:16:59 +02:00
parent cf7fccbc28
commit 6a23f6ef59
17 changed files with 1607 additions and 49 deletions

View File

@@ -1737,7 +1737,7 @@ namespace ReallifeGamemode.Server.Commands
}
}
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip~s~, ~g~Goto (X)~s~, ~r~Marker~s~, ~r~Ped~s~, ~r~Pickup~s~, ~r~TextLabel~s~, ~g~Vehicle~s~, ~g~FVehicle~s~, ~g~SVehicle (X)~s~, ~g~JVehicle (X)~s~] (Weitere Angaben) = (X)")]
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip~s~, ~g~Goto (X)~s~, ~r~Marker~s~, ~r~Ped~s~, ~r~Pickup~s~, ~r~TextLabel~s~, ~g~Vehicle~s~, ~g~FVehicle~s~, ~g~SVehicle (X)~s~, ~g~JVehicle (X)~s~, ~g~Location~s~] (Weitere Angaben) = (X)")]
public void CmdAdminSave(Client player, string typ, string option1 = null, string option2 = null)
{
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
@@ -1745,6 +1745,7 @@ namespace ReallifeGamemode.Server.Commands
ChatService.NotAuthorized(player);
return;
}
switch (typ.ToLower())
{
case "blip":
@@ -1849,6 +1850,7 @@ namespace ReallifeGamemode.Server.Commands
}
else ChatService.SendMessage(player, "~m~Du sitzt in keinem Fahrzeug!");
break;
case "svehicle":
if (player.IsInVehicle)
{
@@ -1888,6 +1890,28 @@ namespace ReallifeGamemode.Server.Commands
else ChatService.SendMessage(player, "~m~Du sitzt in keinem Fahrzeug!");
break;
case "location":
if(option1 == null || option1.Length < 0)
{
ChatService.SendMessage(player, "~m~Benutzung: ~s~/save location [Beschreibung]");
return;
}
using(var dbContext = new DatabaseContext())
{
dbContext.Locations.Add(new Location
{
Description = option1,
X = player.Position.X,
Y = player.Position.Y,
Z = player.Position.Z,
});
dbContext.SaveChanges();
player.SendNotification("Die Position wurde gespeichert");
}
break;
}
}