Removed vespucci cardealer, add interior system (teleport missing)
This commit is contained in:
@@ -2111,6 +2111,87 @@ namespace reallife_gamemode.Server.Commands
|
||||
player.TriggerEvent("showTuningMenu");
|
||||
}
|
||||
|
||||
[Command("interior", "~m~Benutzung: ~s~/interior [Add / Remove / SetEnterPosition / SetExitPosition] [Name]")]
|
||||
public void CmdAdminInterior(Client player, string option1, string option2)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
option1 = option1.ToString();
|
||||
|
||||
if(option1 != "add" && option1 != "remove" && option1 != "setenterposition" && option1 != "setexitposition")
|
||||
{
|
||||
player.SendChatMessage("~m~Benutzung: ~s~/interior [Add / Remove / SetEnterPosition / SetExitPosition] [Name]");
|
||||
return;
|
||||
}
|
||||
|
||||
switch(option1)
|
||||
{
|
||||
case "add":
|
||||
if(InteriorManager.GetInteriorByName(option2) != null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Interior existiert schon.");
|
||||
return;
|
||||
}
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
Interior interiorAdd = new Interior
|
||||
{
|
||||
Name = option2
|
||||
};
|
||||
dbContext.Interiors.Add(interiorAdd);
|
||||
dbContext.SaveChanges();
|
||||
player.SendChatMessage("~b~[ADMIN]~s~ Das Interior ~y~" + option2 + "~s~ wurde erstellt. ~m~ID: " + interiorAdd.Id);
|
||||
}
|
||||
break;
|
||||
case "remove":
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Interior interiorRemove = InteriorManager.GetInteriorByName(option2, dbContext);
|
||||
if(interiorRemove == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Interior existiert nicht.");
|
||||
return;
|
||||
}
|
||||
dbContext.Interiors.Remove(interiorRemove);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
player.SendChatMessage("~b~[ADMIN]~s~ Das Interior wurde gelöscht.");
|
||||
break;
|
||||
case "setenterposition":
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Interior interior = InteriorManager.GetInteriorByName(option2, dbContext);
|
||||
if (interior == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Interior existiert nicht.");
|
||||
return;
|
||||
}
|
||||
interior.EnterPosition = player.Position;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
player.SendChatMessage("~b~[ADMIN]~s~ Die Eingangs-Position vom Interior ~y~" + option2 + "~s~ wurde gesetzt.");
|
||||
break;
|
||||
case "setexitposition":
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Interior interior = InteriorManager.GetInteriorByName(option2, dbContext);
|
||||
if (interior == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Interior existiert nicht.");
|
||||
return;
|
||||
}
|
||||
interior.ExitPosition = player.Position;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
player.SendChatMessage("~b~[ADMIN]~s~ Die Ausgangs-Position vom Interior ~y~" + option2 + "~s~ wurde gesetzt.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ALevel1338
|
||||
|
||||
Reference in New Issue
Block a user