Exemplo n.º 1
0
        public void UnbanPlayer(Client player, string fullPlayerName, string reason)
        {
            Player user = Player.PlayerData[player];

            if (user.MasterAccount.AdminLevel < 3)
            {
                Message.NotAuthorised(player); return;
            }

            try
            {
                Ban    banData        = BanRepository.GetActiveBanByPlayerAccount(fullPlayerName);
                Master adminWhoBanned = MasterRepository.GetMasterDataById(banData.BannedBy);

                if (user.MasterAccount.AdminLevel > adminWhoBanned.AdminLevel || user.MasterId == adminWhoBanned.Id)
                {
                    BanRepository.RemoveAsync(banData);

                    API.sendChatMessageToPlayer(player,
                                                string.Format("You have successfully unbanned {0}",
                                                              PlayerRepository.GetPlayerDataByName(fullPlayerName).Username.Roleplay()));
                }
                else
                {
                    API.SendWarningNotification(player, "You aren't a higher enough administrative level to unban this player.");
                }
            }
            catch { API.SendErrorNotification(player, "The specified player doesn't exist."); }
        }
Exemplo n.º 2
0
 public void DisplayBanInfo(Client player)
 {
     if (BannedUntil == DateTime.MaxValue)
     {
         API.shared.sendChatMessageToPlayer(player, "~r~You are permanently banned from Paleto Bay Roleplay.");
     }
     else
     {
         if (BannedUntil > Server.Date)
         {
             API.shared.sendChatMessageToPlayer(player, String.Format("~r~You are temporarily banned from Paleto Bay Roleplay until {0}.",
                                                                      BannedUntil.ToString("dd/MM/yy hh:mm tt")));
         }
         else
         {
             BanRepository.RemoveAsync(this);
         }
     }
     API.shared.sendChatMessageToPlayer(player, String.Format("~r~For Reason: {0}", BanReason));
     API.shared.sendChatMessageToPlayer(player, "~r~If you wish to appeal the ban, head over the the forums.");
 }