Added /remove command for vehicles and goto points
This commit is contained in:
@@ -571,7 +571,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == location);
|
||||
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == location);
|
||||
|
||||
if(p == null)
|
||||
{
|
||||
@@ -1344,6 +1344,71 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[Command("remove", "~m~Benutzung: ~s~/remove [Vehicle, Goto] [Option]")]
|
||||
public void CmdAdminRemove(Client player, string type, string option = "")
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(type.ToLower())
|
||||
{
|
||||
case "vehicle":
|
||||
if(!player.IsInVehicle)
|
||||
{
|
||||
player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||
return;
|
||||
}
|
||||
|
||||
ServerVehicle veh = player.Vehicle.GetServerVehicle();
|
||||
if(veh == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Fahrzeug wird nicht von einem Server-System genutzt.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(option.ToLower() != "yes")
|
||||
{
|
||||
player.SendChatMessage("Bist du sicher, dass du folgendes Fahrzeug löschen willst: ~m~" + veh.ToString() + " ~s~?");
|
||||
player.SendChatMessage("Falls ~g~Ja~s~, nutze ~y~/remove vehicle yes");
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
VehicleManager.DeleteVehicle(player.Vehicle);
|
||||
dbContext.ServerVehicles.Remove(veh);
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
break;
|
||||
|
||||
case "goto":
|
||||
if(option == "")
|
||||
{
|
||||
player.SendChatMessage("~m~Benutzung: ~s~/remove [Goto] [Punkt]");
|
||||
return;
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == option);
|
||||
if(p == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieser Goto-Punkt existiert nicht.");
|
||||
return;
|
||||
}
|
||||
|
||||
dbContext.GotoPoints.Remove(p);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
player.SendNotification("Der Goto-Punkt ~r~" + p.Description + "~s~ wurde erfolgreich gelöscht.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region loadCommand
|
||||
[Command("load", "~m~Benutzung: ~s~/load [Typ = OnlineBunkers, ArcadiusBusinessCentre, MazeBankBuilding, LomBank, MazeBankWest, ClubWareHouse, SpecialLocations, GRHYacht, DHYacht, PYacht, AircraftCarrier, BridgeTC, BridgeTN, NorthYankton, ONeilsFarmB, ONeilsFarm, Morgue")]
|
||||
public void CmdAdminloadlocation(Client player, string typ)
|
||||
|
||||
Reference in New Issue
Block a user