コード例 #1
0
        /// <summary>
        /// Обработчик оплаты штрафа для снятия розыска
        /// </summary>
        private void PayPenalty(Client player, object[] objects)
        {
            var playerInfo = PlayerInfoManager.GetInfo(player);

            if (playerInfo.Wanted.WantedLevel == 0)
            {
                API.sendNotificationToPlayer(player, "~r~Вы не в розыске", true);
                return;
            }
            var penalty = PoliceManager.CalculatePenalty(playerInfo);

            if (playerInfo.Balance < penalty)
            {
                API.sendNotificationToPlayer(player, "~b~Недостаточно средств", true);
                return;
            }
            playerInfo.Balance -= penalty;
            PlayerInfoManager.RefreshUI(player, playerInfo);
            PlayerInfoManager.ClearWanted(player);
            API.sendNotificationToPlayer(player, "~b~Вы сняты с розыска");
        }