GELD LOGS

This commit is contained in:
hydrant
2021-05-15 03:14:37 +02:00
parent 3c2d56f2ad
commit a2db770316
22 changed files with 448 additions and 306 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
@@ -13,11 +14,16 @@ using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Services;
using ReallifeGamemode.Server.Log;
namespace ReallifeGamemode.Server.Commands
{
internal class UserCommands : Script
{
private static readonly ILogger logger = LogManager.GetLogger<UserCommands>();
private const int SMS_PRICE = 5;
[Command("rent", "~m~rent stop")]
public void CmdUserStopRent(Player player, String option = "")
{
@@ -113,13 +119,15 @@ namespace ReallifeGamemode.Server.Commands
using (var dbContext = new DatabaseContext())
{
User user = player.GetUser(dbContext);
if (user.BankAccount.Balance < 5)
if (user.BankAccount.Balance < SMS_PRICE)
{
ChatService.ErrorMessage(player, "Dafür hast du nicht genug Geld auf deinem Bankkonto");
return;
}
user.BankAccount.Balance -= 5;
logger.LogInformation("Player {0} sent a sms to {1} for {2} dollars", player.Name, target.Name, SMS_PRICE);
user.BankAccount.Balance -= SMS_PRICE;
dbContext.SaveChanges();
}