private void OnPlayerBeginConnect(Client player, CancelEventArgs cancelConnection) { if (!Weather.WeatherData.Any()) { cancelConnection.Reason = "Server is initialising, please wait..."; cancelConnection.Cancel = true; return; } if (!player.socialClubName.IsBETA()) { cancelConnection.Reason = "You are not an accepted BETA Tester"; cancelConnection.Cancel = true; return; } Ban ban = BanRepository.GetActiveBanBySocialClubName(player.socialClubName); if (ban != null) { ban.DisplayBanInfo(player); cancelConnection.Cancel = true; return; } if (!player.isCEFenabled) { API.sendNotificationToPlayer(player, "Please enable CEF in your GTA:N settings."); cancelConnection.Cancel = true; } player.FadeOut(100); }
private void OnClientEventTrigger(Client sender, string eventName, params object[] arguments) { if (eventName == "banReasonSubmitted" && (int)arguments[0] == 1) { Player player = Player.PlayerData[sender]; if (player.CurrentBanData != null) { player.CurrentBanData.BanReason = arguments[1].ToString(); BanRepository.AddNewBan(player.CurrentBanData); Player playerBeingBanned = player.CurrentBanData.PlayerBeingBanned; if (player.CurrentBanData.BannedUntil == DateTime.MaxValue) { API.sendChatMessageToPlayer(playerBeingBanned.Client, "~r~You have been permanently banned from Paleto Bay Roleplay by Admin {0}.", sender.name); API.SendErrorNotification(sender, string.Format("{0} has been permbanned.", playerBeingBanned.Client.name)); } else { API.sendChatMessageToPlayer(playerBeingBanned.Client, string.Format("~r~You have been temporarily banned from Paleto Bay Roleplay until {0:dd/MM/yy hh:mm tt}.", player.CurrentBanData.BannedUntil)); API.SendErrorNotification(sender, string.Format("{0} has been tempbanned until {1:dd/MM/yy hh:mm tt}.", playerBeingBanned.Client.name, player.CurrentBanData.BannedUntil)); } API.kickPlayer(playerBeingBanned.Client, "Banned"); player.CurrentBanData = null; } } }
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."); } }
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."); }