Ejemplo n.º 1
0
        public void BanPlayerID(string id, string name = "1", string reason = "You were banned.", string adminname = "Unknown")
        {
            bool cancel = Hooks.OnBanEventHandler(new BanEvent(id, name, reason, adminname, true));

            if (cancel)
            {
                return;
            }
            File.AppendAllText(Path.Combine(Util.GetRootFolder(), "Save\\BanLog.log"), "[" + DateTime.Now.ToShortDateString()
                               + " " + DateTime.Now.ToString("HH:mm:ss") + "] " + name + "|" + id + "|" + adminname + "|" + reason + "\r\n");
            DataStore.GetInstance().Add("Ids", id, name);
        }
Ejemplo n.º 2
0
        public void BanPlayer(Fougerite.Player player, string Banner = "Console", string reason = "Te han baneado.", Fougerite.Player Sender = null, bool AnnounceToServer = false)
        {
            bool cancel = Hooks.OnBanEventHandler(new BanEvent(player, Banner, reason, Sender));

            if (cancel)
            {
                return;
            }
            string red   = "[color #FF0000]";
            string green = "[color #009900]";
            string white = "[color #FFFFFF]";

            if (player.IsOnline && !player.IsDisconnecting)
            {
                player.SendClientMessage(red + " " + reason);
                player.SendClientMessage(red + " Baneado por: " + Banner);
                player.Disconnect();
            }
            if (Sender != null)
            {
                Sender.SendClientMessage("Baneaste a " + player.Name);
                Sender.SendClientMessage("IP: " + player.IP);
                Sender.SendClientMessage("ID: " + player.SteamID);
            }
            if (!AnnounceToServer)
            {
                foreach (Fougerite.Player pl in Players.Where(pl => pl.Admin || pl.Moderator))
                {
                    pl.SendClientMessage(red + player.Name + white + " fue baneado por: " + green + Banner);
                    pl.SendClientMessage(red + " Motivo: " + reason);
                }
            }
            else
            {
                Broadcast(red + player.Name + white + " fue baneado por: " + green + Banner);
                Broadcast(red + " Motivo: " + reason);
            }
            BanPlayerIPandID(player.IP, player.SteamID, player.Name, reason, Banner);
        }