示例#1
0
        private void onATMEventTrigger(Client sender, string eventname, object[] arguments)
        {
            if (eventname.Equals("onATMPayInPayOut"))
            {
                string type   = (string)arguments[0];
                float  amount = float.Parse((string)arguments[1]);
                string reason = (string)arguments[2];

                if (amount < 0)
                {
                    return;
                }

                if (type.Equals("in"))
                {
                    if (MoneyManager.CanPlayerPayMoney(sender, amount))
                    {
                        MoneyManager.ChangePlayerMoney(sender, -amount, false, MoneyManager.Categorys.BankToMoney,
                                                       reason, null);
                        MoneyManager.ChangePlayerMoney(sender, amount, true, MoneyManager.Categorys.BankToMoney, reason,
                                                       null);
                        sender.sendNotification("ATM", "~g~Betrag erfolgreich eingezahlt.");
                        sender.triggerEvent("updateATM");
                    }
                    else
                    {
                        sender.sendNotification("ATM", "~r~Nicht genug Geld.");
                    }
                }
                else
                {
                    if (MoneyManager.CanPlayerPayBank(sender, amount))
                    {
                        MoneyManager.ChangePlayerMoney(sender, amount, false, MoneyManager.Categorys.BankToMoney, reason, null);
                        MoneyManager.ChangePlayerMoney(sender, -amount, true, MoneyManager.Categorys.BankToMoney, reason, null);
                        sender.sendNotification("ATM", "~g~Betrag erfolgreich ausgezahlt.");
                        sender.triggerEvent("updateATM");
                    }
                    else
                    {
                        sender.sendNotification("ATM", "~r~Nicht genug Guthaben.");
                    }
                }
            }
        }