public async Task RE_BankDepositMoney(Client player, string money) { //var user = player.GetExternalData<Data.Entities.User>(0); if (!player.HasData("USER_CLASS")) { return; } Data.Entities.User user = player.GetData("USER_CLASS"); double quantity = Convert.ToDouble(money); if (user.bankEntity.type == 2 && quantity >= 1001) { Utilities.Notifications.SendNotificationERROR(player, "Solo puedes ingresar $1000 en un cajero"); } else { if (!user.bankDelay) { if (await Game.Money.MoneyModel.SubMoney(player, quantity)) { await MoneyFunctions.AddMoneyBank(player, quantity); Utilities.Notifications.SendNotificationOK(player, $"Has depositado ${money} en tu cuenta bancaria"); player.TriggerEvent("UpdateMoneyBankATM", user.bank.ToString()); if (user.bankEntity.type == 2) { user.bankDelay = true; } } else { Utilities.Notifications.SendNotificationERROR(player, $"No tienes ${money} disponibles"); } } else { Utilities.Notifications.SendNotificationERROR(player, "Debes de esperar un poco para hacer otro movimiento"); } } }
public async Task RE_BankTransferirMoney(Client player, string iban, string money) { //var user = player.GetExternalData<Data.Entities.User>(0); if (!player.HasData("USER_CLASS")) { return; } Data.Entities.User user = player.GetData("USER_CLASS"); double quantity = Convert.ToDouble(money); if (user.bankEntity.type == 2 && quantity >= 1001) { Utilities.Notifications.SendNotificationERROR(player, "Solo puedes retirar $1000 en un cajero"); } else { if (!user.bankDelay) { Console.WriteLine(iban); string username = await DatabaseFunctions.GetUsernameByIBAN(iban); if (username != "no") { if (await MoneyFunctions.RemoveMoneyBank(player, quantity)) { bool isOnline = false; foreach (var target in NAPI.Pools.GetAllPlayers()) { if (target.Name == username) { isOnline = true; await MoneyFunctions.AddMoneyBank(target, quantity); Utilities.Notifications.SendNotificationOK(target, $"Has recibido una transferencia de ${money} desde la cuenta {user.IBAN}"); Utilities.Notifications.SendNotificationOK(player, $"Has enviado una transferencia de ${money} a la cuenta {iban}"); player.TriggerEvent("UpdateMoneyBankATM", user.bank.ToString()); } } if (!isOnline) { int offbank = await DatabaseFunctions.GetBankMoneyOfflineByName(username); await DatabaseFunctions.UpdateOfflineUserBankByName(username, offbank + Convert.ToInt32(money)); Utilities.Notifications.SendNotificationOK(player, $"Has enviado una transferencia de ${money} a la cuenta {iban}"); player.TriggerEvent("UpdateMoneyBankATM", user.bank.ToString()); } if (user.bankEntity.type == 2) { user.bankDelay = true; } } else { Utilities.Notifications.SendNotificationERROR(player, $"No tienes ${money} disponibles en tu cuenta"); } } else { Utilities.Notifications.SendNotificationERROR(player, "No existe ninguna cuenta con ese número IBAN"); } } else { Utilities.Notifications.SendNotificationERROR(player, "Debes de esperar un poco para hacer otro movimiento"); } } }