diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index ea639b91..5b72b4cc 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -109,10 +109,21 @@ namespace ReallifeGamemode.Server.Commands return; } + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + if (user.BankAccount.Balance < 5) { + ChatService.ErrorMessage(player, "Dafür hast du nicht genug Geld auf deinem Bankkonto"); + return; + } + + user.BankAccount.Balance -= 5; + } + msg = Regex.Replace(msg, "(~[a-zA-Z]~)|(!{(.*)})", ""); - ChatService.SendMessage(player, $"~y~SMS ~w~an ~y~{target.Name}~w~: {msg}"); - ChatService.SendMessage(target, $"~y~SMS ~w~von ~y~{player.Name}~w~: { msg }"); + ChatService.SendMessage(player, $"~y~SMS ~w~an ~y~{ target.Name }~w~: { msg }"); + ChatService.SendMessage(target, $"~y~SMS ~w~von ~y~{ player.Name }~w~: { msg }"); } [Command("look", "~m~look")]