Business kaufen
This commit is contained in:
@@ -2871,6 +2871,47 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[Command("business", "~m~Benutzung:~s~ /business [price] [Option]")]
|
||||
public void CmdAdminBusiness(Client player, string option, string option1)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
BusinessBase business = BusinessManager.GetNearBusiness(player);
|
||||
|
||||
if(business == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "In deiner Nähe ist kein Business");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (option.ToLower())
|
||||
{
|
||||
case "price":
|
||||
if(!int.TryParse(option1, out int price))
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Es muss ein gültiger Preis angegeben werden");
|
||||
return;
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
BusinessData data = business.GetData(dbContext);
|
||||
data.Price = price;
|
||||
dbContext.SaveChanges();
|
||||
|
||||
player.SendChatMessage($"Der Preis wurde auf {price.ToMoneyString()} gesetzt");
|
||||
|
||||
business.Update();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user