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

@@ -187,6 +187,20 @@ namespace reallife_gamemode.Server.Commands
player.SendChatMessage("Position: X Y Z: " + player.Position);
}
[Command("goto", "~m~Benutzung: ~s~/goto [Ort]")]
public void CmdAdminGotoPoint(Client player, string location)
{
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
return;
}
using (var dbContext = new DatabaseContext())
{
Entities.GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == location);
player.MovePosition(new Vector3(p.X, p.Y, p.Z), 0);
}
}
[Command("gotox", "~m~Benutzung: ~s~/gotox [X] [Y] [Z]")]
public void CmdAdminGotoxyz(Client player, float x, float y, float z)
@@ -630,13 +644,25 @@ namespace reallife_gamemode.Server.Commands
target.GetUser().BanPlayer(admin, reason, mins);
}
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle, FVehicle, SVehicle")]
public void CmdAdminSave(Client player, string typ)
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, Goto (X), ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle, FVehicle, SVehicle] (Beschreibung) = (X)")]
public void CmdAdminSave(Client player, string typ, string description = null)
{
switch (typ)
{
case "Blip":
player.TriggerEvent("saveBlip");
break;
case "Goto":
if(description == null)
{
player.SendChatMessage("Für Goto musst du einen dritten Parameter angeben. Beispiel: Ort des Goto-Punktes.");
return;
}
else
{
SaveManager.SaveGotoPoint(player, description);
}
break;
case "Vehicle":
if (player.IsInVehicle)