bank account refactor
This commit is contained in:
@@ -16,6 +16,12 @@ using ReallifeGamemode.Server.Common;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Services;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Main Class (Main.cs)
|
||||
@@ -105,6 +111,16 @@ namespace ReallifeGamemode.Server
|
||||
Jail.JailTimer();
|
||||
Economy.PaydayTimer();
|
||||
WeaponDealManager.WeaponDealTimer();
|
||||
|
||||
UserBankAccount.BalanceChanged += (account) =>
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
var user = dbContext.Users.Where(u => u.BankAccountId == account.Id).Select(u => u.Name).FirstOrDefault();
|
||||
if (user == null) return;
|
||||
PlayerService.GetPlayerByNameOrId(user).TriggerEvent("updateMoney", account.Balance);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:Event")]
|
||||
|
||||
Reference in New Issue
Block a user