public void KickPlayer(Fougerite.Player badPlayer, Fougerite.Player myAdmin) { RustPP.Data.Entities.User kicked = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == badPlayer.Name); RustPP.Data.Entities.User admin = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == myAdmin.Name); if (kicked != null) { if (Administrator.IsAdmin(badPlayer.UID) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON")) { myAdmin.MessageFrom(Core.Name, badPlayer.Name + " es un administrador, no puedes kickear administradores."); return; } RustPP.Data.Globals.SendAdminMessageForAll(string.Format("{0} fue kickeado por {1}.", badPlayer.Name, myAdmin.Name)); badPlayer.Disconnect(); } else { if (badPlayer == myAdmin) { myAdmin.MessageFrom(Core.Name, "No puedes kickearte."); return; } else if (Administrator.IsAdmin(badPlayer.UID) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON") || kicked.AdminLevel >= admin.AdminLevel) { myAdmin.MessageFrom(Core.Name, badPlayer.Name + " es un administrador, no puedes kickear administradores."); return; } else { Administrator.NotifyAdmins(string.Format("{0} fue kickeado por {1}.", badPlayer.Name, myAdmin.Name)); badPlayer.Disconnect(); } } }
static void OnPlayerSpawned(Fougerite.Player player, SpawnEvent se) { if (player.Name == "" || player.Name == " ") { player.Disconnect(); } if (!UserIsLogged(player)) { //player.Inventory.ClearAll(); FreezePlayer(player); if (LanguageComponent.LanguageComponent.GetPlayerLang(player) == null) { AskLanguageTimer(player); } else { ShowLoginMessages(player); } } else { User user = Data.Globals.usersOnline.Find(x => x.Name == player.Name); if (user.SteamID != player.UID) { player.Notice("Ya estás conectado al servidor / Você já está conectado ao servidor."); player.Disconnect(); } } }
void OnPlayerConnected(Fougerite.Player player) { if (player.Admin) { return; } string ip = player.IP; var url = string.Format("http://legacy.iphub.info/api.php?ip=" + ip + "&showtype=4"); Web.GET(url, (code, response) => { if (code != 200 || string.IsNullOrEmpty(response)) { Fougerite.Logger.LogError("Service temporarily offline"); } else { var jsonresponse = JsonConvert.DeserializeObject <Dictionary <string, object> >(response); var playervpn = (jsonresponse["proxy"].ToString()); var playerispvpn = (jsonresponse["asn"].ToString()); { if (playervpn == "1") { player.Disconnect(); Fougerite.Logger.LogWarning(player.Name + "| " + player.SteamID + " | " + player.IP + " is using vpn KICKED!!"); } } } }); }
public void CallBack(TimedEvent e) { var dictt = e.Args; e.Kill(); AfkPlayer pl = (AfkPlayer)dictt["player"]; Vector3 loc = lastloc[pl.UID]; float d = Vector3.Distance(loc, pl.Location); if (d < Kickdist) { lastloc.Remove(pl.UID); string msg = KickMessage.Replace("{0}", pl.Name); Broadcast(msg); pl.Disconnect(); return; } else { lastloc.Remove(pl.UID); var dict = new Dictionary <string, object>(); dict["player"] = pl; AfkTimer(AfkTime * 60000, dict).Start(); lastloc.Add(pl.UID, pl.Location); } }
public void BanPlayer(PList.Player ban, Fougerite.Player myAdmin) { if (ban.UserID == myAdmin.UID) { myAdmin.MessageFrom(Core.Name, "Seriously? You can't ban yourself."); return; } if (Administrator.IsAdmin(ban.UserID) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON")) { myAdmin.MessageFrom(Core.Name, ban.DisplayName + " is an administrator. You can't ban administrators."); return; } if (RustPP.Core.blackList.Contains(ban.UserID)) { Logger.LogError(string.Format("[BanPlayer] {0}, id={1} already on blackList.", ban.DisplayName, ban.UserID)); Core.blackList.Remove(ban.UserID); } Core.blackList.Add(ban); Administrator.DeleteAdmin(ban.UserID); Administrator.NotifyAdmins(string.Format("{0} has been banned by {1}.", ban.DisplayName, myAdmin.Name)); Fougerite.Player client = Fougerite.Server.GetServer().FindPlayer(ban.UserID.ToString()); if (client != null) { client.Disconnect(); } }
private void Callback(AuthMeTE e) { e.Kill(); var data = e.Args; Fougerite.Player player = (Fougerite.Player)data["Player"]; if (player.IsOnline && WaitingUsers.ContainsKey(player.UID)) { player.Disconnect(); } }
public static bool loginNotice(Fougerite.Player pl) { try { if (Core.blackList.Contains(pl.UID)) { Core.tempConnect.Add(pl.UID); pl.Disconnect(); return(false); } if (Core.config.GetBoolSetting("WhiteList", "enabled") && !Core.whiteList.Contains(pl.UID)) { pl.Disconnect(); return(false); } if (!Core.userCache.ContainsKey(pl.UID)) { Core.userCache.Add(pl.UID, SecurityElement.Escape(pl.Name)); } else if (pl.Name != Core.userCache[pl.UID]) { Core.userCache[pl.UID] = SecurityElement.Escape(pl.Name); } if (Administrator.IsAdmin(pl.UID) && Administrator.GetAdmin(pl.UID).HasPermission("RCON")) { pl.PlayerClient.netUser.admin = true; } Core.motd(pl); if (Core.config.GetBoolSetting("Settings", "join_notice")) { foreach (var client in Fougerite.Server.GetServer().Players.Where(client => client.UID != pl.UID)) { client.SendClientMessage("[color cyan]<!>[/color] " + pl.Name + " " + RustPPModule.JoinMsg); } } } catch { } return(true); }
private void HandlePlayerConnection(object sender, DoWorkEventArgs doWorkEventArgs) { Fougerite.Player player = (Fougerite.Player)doWorkEventArgs.Argument; var data = GeoIP.GeoIP.Instance.GetDataOfIP(player.IP); if (data == null) { if (CountryBlackList.Instance.Show_Accept_Message) { string message = CountryBlackList.Instance.Join_Message.Replace("%PLAYER%", player.Name).Replace("%COUNTRY%", CountryBlackList.Instance.Unknown_Location); Server.GetServer().BroadcastFrom("CountryBlackList", message); } if (CountryBlackList.Instance.Log_TimedOut_Connections) { CountryBlackList.Instance.file = new System.IO.StreamWriter(Path.Combine(CountryBlackList.Instance.ModuleFolder, "TimedOut Connections.log"), true); CountryBlackList.Instance.file.WriteLine(DateTime.Now + ": " + player.SteamID + "=" + player.Name + " [" + player.IP + "]"); CountryBlackList.Instance.file.Close(); } return; } string countrycode = data.CountryShort; if (CountryBlackList.Instance.BlackList.Any(countrycode.Contains)) { if (CountryBlackList.Instance.Use_WhiteList) { if (CountryBlackList.Instance.OnWhiteList(player.SteamID, player.IP)) { if (CountryBlackList.Instance.Show_Accept_Message) { string message = CountryBlackList.Instance.Join_Message.Replace("%PLAYER%", player.Name).Replace("%COUNTRY%", data.Country); Server.GetServer().BroadcastFrom("CountryBlackList", message); } return; } } if (CountryBlackList.Instance.Show_Denied_Message) { string message = CountryBlackList.Instance.Server_Disconnect_Message.Replace("%PLAYER%", player.Name).Replace("%COUNTRY%", data.Country); Server.GetServer().BroadcastFrom("CountryBlackList", message); } player.MessageFrom("CountryBlackList", CountryBlackList.Instance.Player_Disconnect_Message.Replace("%PLAYER%", player.Name).Replace("%COUNTRY%", data.Country)); player.Disconnect(); } else { if (CountryBlackList.Instance.Show_Accept_Message) { string message = CountryBlackList.Instance.Join_Message.Replace("%PLAYER%", player.Name).Replace("%COUNTRY%", data.Country); Server.GetServer().BroadcastFrom("CountryBlackList", message); } } }
private void OnPlayerGathering(Fougerite.Player player, Fougerite.Events.GatherEvent ge) { if (player.Inventory.InternalInventory.activeItem != null) { string toolname = player.Inventory.InternalInventory._activeItem.datablock.name; if (toolname == "Uber Hatchet") { Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #45f542]Get Kicked [color #42b3f5]cause of Farming with a UberHatchet!"); player.Disconnect(); string logtext = player.Name + " Kicked cause of Farming with a UberHatchet!"; Log(logtext, "UberFarm"); } } }
private void Connected(User player) { CheckForPlayerData(player); if (!playerlist.Contains(player)) { playerlist.Add(player); } else { playerlist.Remove(player); Helper.LogError("[RustEssentials]KICKING " + player.Name + " becaus he already existed in the player list list"); player.Disconnect(); } }
public void CheckWalloot(InventoryModEvent e) { User looter = e.Player; if (looter == null) { return; } if (IsWallooting(e.Player, e.Inventory)) { Notify(looter, e.Inventory); Server.GetServer().BroadcastFrom(Name, "[color red]" + looter.Name + "[color red] has been kicked for wallooting"); looter.Disconnect(); } }
public void KickPlayer(Fougerite.Player badPlayer, Fougerite.Player myAdmin) { if (badPlayer == myAdmin) { myAdmin.MessageFrom(Core.Name, yellow + "☢ " + red + "You can't kick yourself."); } else if (Administrator.IsAdmin(badPlayer.UID) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON")) { myAdmin.MessageFrom(Core.Name, yellow + "☢ " + red + "You can't kick: " + yellow + badPlayer.Name + red + " he/she is an administrator."); } else { Administrator.NotifyAdmins(string.Format(yellow + "☢ " + green + "Player: " + yellow + "{0}" + green + " has been kicked by " + yellow + "{1}" + green + ".", badPlayer.Name, myAdmin.Name)); badPlayer.Disconnect(); } }
public void KickPlayer(Fougerite.Player badPlayer, Fougerite.Player myAdmin) { if (badPlayer == myAdmin) { myAdmin.MessageFrom(Core.Name, "You can't kick yourself."); } else if (Administrator.IsAdmin(badPlayer.UID) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON")) { myAdmin.MessageFrom(Core.Name, badPlayer.Name + " is an administrator. You can't kick administrators."); } else { Administrator.NotifyAdmins(string.Format("{0} has been kicked by {1}.", badPlayer.Name, myAdmin.Name)); badPlayer.Disconnect(); } }
public void CheckWalloot(InventoryModEvent e) { User looter = e.Player; if (looter == null) { return; } if (IsWallooting(e.Player, e.Inventory)) { ItemDataBlock block = DatablockDictionary.GetByName(e.ItemName); e.Inventory.AddItemAmount(block, 1); Notify(looter, e.Inventory); Server.GetServer().BroadcastFrom(Core.Name, "[color yellow]☢ [color red]Player: [color yellow]" + looter.Name + "[color red] has been kicked for wall looting."); looter.Disconnect(); } }
public static void LoadPlayer(Fougerite.Player player, bool firstLogin) { string lang = LanguageComponent.LanguageComponent.GetPlayerLangOrDefault(player); User user = Data.Globals.usersOnline.Find(x => x.Name == player.Name); if (user != null) { if (user.BannedPlayer == 1) { char ch = '☢'; player.Notice(ch.ToString(), LanguageComponent.LanguageComponent.getMessage("account_banned", lang), 4f); player.Disconnect(); } if (player.UID != user.SteamID) { Vector3 position = new Vector3(user.XPos, user.YPos, user.ZPos); player.TeleportTo(position); } if (!firstLogin) { //LoadInventory(player); //ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand; //command.AddDoors(user.SteamID, player); } else { player.Inventory.RemoveItem(30); player.Inventory.RemoveItem(31); player.Inventory.RemoveItem(32); player.Inventory.AddItemTo("Stone Hatchet", 30, 1); player.Inventory.AddItemTo("Bandage", 31, 3); player.Inventory.AddItemTo("Cooked Chicken Breast", 32, 3); } } else { player.SendClientMessage(LanguageComponent.LanguageComponent.getMessage("error_0102", lang)); } UnFreezePlayer(player); }
public void BanPlayer(Fougerite.Player ban, Fougerite.Player myAdmin) { if (ban.UID == myAdmin.UID) { myAdmin.SendClientMessage("[color red]<Error>[/color] No puedes banearte a ti mismo."); return; } var bannedPlayer = Fougerite.Server.Cache[ban.UID]; if (!RustPP.Data.Globals.UserIsLogged(bannedPlayer)) { Fougerite.Player asd = Fougerite.Server.GetServer().FindPlayer(ban.Name.ToString()); Server.GetServer().BanPlayer(asd, myAdmin.Name, "Decisión Administrativa", myAdmin, true); asd.Disconnect(); return; } if (!RustPP.Data.Globals.UserIsLogged(bannedPlayer) && !Administrator.GetAdmin(myAdmin.UID).HasPermission("RCON")) { myAdmin.SendClientMessage(ban.Name + " no esta conectado, por lo que no se lo puede banear."); return; } else { var bannedUser = RustPP.Data.Globals.GetInternalUser(bannedPlayer); var adminUser = RustPP.Data.Globals.GetInternalUser(myAdmin); if (bannedUser.AdminLevel >= adminUser.AdminLevel && adminUser.Name != "ForwardKing") { myAdmin.SendClientMessage($"[color red]<Error>[/color] {ban.Name} es administrador nivel {bannedUser.AdminLevel}, no puedes banearlo."); return; } else { bannedUser.BannedPlayer = 1; } } Fougerite.Player client = Fougerite.Server.GetServer().FindPlayer(ban.Name.ToString()); Server.GetServer().BanPlayer(client, myAdmin.Name, "Decisión Administrativa", myAdmin, true); client.Disconnect(); }
public void ItemRemoved(InventoryModEvent e) { try { if (e.Player != null) { Fougerite.Player player = (Fougerite.Player)e.Player; if (player.IsOnline) { Vector3 location = player.Location; float d = Vector3.Distance(e.Inventory.transform.position, location); if (d > MaxlootDist) { if (BroadcastAdmins) { NotifyAdmin(player.Name + yellow + " Is Maybe using longdistance looting dist: " + (Math.Round(d))); } string line = DateTime.Now + " [AntiAutoLoot] " + player.Name + "-" + player.SteamID + " Tried to loot from " + (Math.Round(d)) + " max dist = " + MaxlootDist + ""; file = new System.IO.StreamWriter(ppath, true); file.WriteLine(line); file.Close(); string message = Broadcast.Replace("{Player}", player.Name); Server.GetServer().Broadcast(message); player.Message(WarningMessage); Logger.LogWarning(player.Name + " Tried to loot from an unreachable container"); e.Cancel(); player.Disconnect(); } } } } catch (Exception ex) { Logger.LogError("[AntiCrackLoot] ERROR: " + ex); } }
public void OnCommand(Fougerite.Player player, string cmd, string[] args) { if (player.Admin || player.Moderator) { if (cmd == "ahelp") { player.MessageFrom(Name, "[color #42b3f5]/duty /unduty /warn /delwarn /hp "); player.MessageFrom(Name, "[color #42b3f5]/mtp /mtpback /ann /wipebar /wipeshelt "); player.MessageFrom(Name, "[color #42b3f5]/kick /ban /unban /rbban /rbunban /unbanip /mute /unmute "); return; } if (cmd == "duty") { if (!DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID)) { DataStore.GetInstance().Add("AdminDuty", player.SteamID, 0); player.Inventory.ClearArmor(); player.Inventory.AddItemTo("Invisible Helmet", 36, 1); player.Inventory.AddItemTo("Invisible Vest", 37, 1); player.Inventory.AddItemTo("Invisible Pants", 38, 1); player.Inventory.AddItemTo("Invisible Boots", 39, 1); player.Inventory.AddItem("Uber Hatchet", 1); Server.GetServer().BroadcastFrom(Name, "[color #42b3f5]Admin [color #f5e042]" + player.Name + " [color #42b3f5]is now [color #45f542]On Duty!"); } else { player.MessageFrom(Name, "[color #42b3f5]You are already OnDuty!!!"); } } if (cmd == "unduty") { if (DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID)) { DataStore.GetInstance().Remove("AdminDuty", player.SteamID); player.Inventory.ClearArmor(); player.Inventory.RemoveItem("Invisible Helmet", 1); player.Inventory.RemoveItem("Invisible Vest", 1); player.Inventory.RemoveItem("Invisible Pants", 1); player.Inventory.RemoveItem("Invisible Boots", 1); player.Inventory.RemoveItem("Uber Hatchet", 1); Server.GetServer().BroadcastFrom(Name, "[color #42b3f5]Admin [color #f5e042]" + player.Name + " [color #42b3f5]is now [color #f55142]Off Duty!"); } else { player.MessageFrom(Name, "[color #42b3f5]You are [color #f55142]not [color #42b3f5]On Duty!!!"); } } if (cmd == "warn") { if (args.Length == 0) { player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /warn PlayerName"); return; } else { Fougerite.Player playertor = FindSimilarPlayer(player, args); if (playertor == null) { return; } if (!DataStore.GetInstance().ContainsKey("warn", playertor.SteamID)) { DataStore.GetInstance().Add("warn", playertor.SteamID, 0); Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + "[color #42b3f5] Warned [color #f5e042] " + playertor.Name + "![color #f5e042](1/2)"); string logtext = player.Name + " Warned " + playertor.Name + "!(1/2)"; Log(logtext, "Warn"); return; } else { DataStore.GetInstance().Remove("warn", playertor.SteamID); Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + "[color #42b3f5] Warned[color #f5e042] " + playertor.Name + "![color red]Kicked (2/2)"); string logtext = player.Name + " Warned " + playertor.Name + "!Kicked (2/2)"; Log(logtext, "Warn"); playertor.Disconnect(); } } } if (cmd == "delwarn") { if (args.Length == 0) { player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /delwarn PlayerName"); return; } else { Fougerite.Player playertor = FindSimilarPlayer(player, args); if (playertor == null) { return; } if (DataStore.GetInstance().ContainsKey("warn", playertor.SteamID)) { DataStore.GetInstance().Remove("warn", playertor.SteamID); Server.GetServer().Broadcast("[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color #f5e042] " + playertor.Name + " [color #42b3f5]Warns![color #f5e042](0/2)"); string logtext = player.Name + " Deleted " + playertor.Name + " Warns!"; Log(logtext, "DeleteWarn"); return; } else { player.MessageFrom(Name, "[color #42b3f5]This Player [color #f55142]Doesn't [color #42b3f5]have any Warn!"); return; } } } if (cmd == "hp") { if (args.Length == 0) { player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /hp PlayerName"); return; } else { Fougerite.Player playertor = FindSimilarPlayer(player, args); if (playertor == null) { return; } player.MessageFrom(Name, playertor.Name + " HP : " + playertor.Health); string logtext = player.Name + " Used /HP On " + playertor.Name + ""; Log(logtext, "HP"); } } if (cmd == "mtp") { if (args.Length == 0) { player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /mtp PlayerName"); return; } else { if (DataStore.GetInstance().ContainsKey("AdminDuty", player.SteamID)) { Fougerite.Player playertor = FindSimilarPlayer(player, args); if (playertor == null) { return; } if (playertor.Moderator) { player.MessageFrom("AntiAbuse", "[color #42b3f5]You [color #f55142]Can't [color #42b3f5]Teleport to another Mods!"); return; } RecuperaListaDeClanes(); if (SonDeElMismoClan(player.SteamID, GetClanName(playertor.SteamID))) { player.MessageFrom("AntiAbuse", "[color #42b3f5]You [color #f55142]Can't [color #42b3f5]Teleport to your Clanmates!"); return; } if (!DataStore.GetInstance().ContainsKey("ModeratorLastLoc", player.UID)) { DataStore.GetInstance().Add("ModeratorLastLoc", player.UID, player.Location.ToString()); } player.TeleportTo(playertor, 1.5f, false); player.Notice("You have Teleported to " + playertor.Name + ""); player.InventoryNotice("Checkpoint Saved!"); playertor.Notice("Admin " + player.Name + " Teleported to You!"); string logtext = player.Name + " Teleported To " + playertor.Name + " !LOC: " + playertor.X + " " + playertor.Y + " " + playertor.Z + " "; Log(logtext, "Teleports"); } else { player.MessageFrom(Name, "[color #42b3f5]You are [color #f55142]not [color #42b3f5]OnDuty!!!"); } } } if (cmd == "mtpback") { if (DataStore.GetInstance().ContainsKey("ModeratorLastLoc", player.UID) && !DataStore.GetInstance().ContainsKey("HGIG", player.UID)) { var location = StringToVector3(DataStore.GetInstance().Get("ModeratorLastLoc", player.UID).ToString()); player.SafeTeleportTo(location, false); DataStore.GetInstance().Remove("ModeratorLastLoc", player.UID); player.Notice("You Teleported Back to your Checkpoint!"); string logtext = "Admin " + player.Name + " Teleported to his Checkpoint!"; Log(logtext, "Teleports"); } else { player.Notice("You Don't have any save Checkpoint or You Are in HungerGame!"); } } if (cmd == "ann") { if (args.Length == 0) { player.MessageFrom(Name, "[color #f55142]Syntax:[color #42b3f5] /ann TEXT"); } else { Server.GetServer().BroadcastNotice(string.Join(" ", args)); string logtext = player.Name + " /ann ==> : " + string.Join(" ", args); Log(logtext, "Announce"); } } if (cmd == "wipeshelt") { int c = 0; foreach (var x in World.GetWorld().Entities) { if (x.Name.ToLower().Contains("shelter")) { x.Destroy(); c++; } } Server.GetServer().BroadcastFrom("AntiLag", "[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color red] " + c + " [color #42b3f5]Shelters"); string logtext = player.Name + " Deleted " + c + " Shelters"; Log(logtext, "Shelter"); } if (cmd == "wipebar") { int c = 0; foreach (var x in World.GetWorld().Entities) { if (x.Name.ToLower().Contains("barricade")) { x.Destroy(); c++; } } Server.GetServer().BroadcastFrom("AntiLag", "[color #42b3f5]Admin/Mod [color #f5e042]" + player.Name + " [color #42b3f5]Deleted [color red] " + c + " [color #42b3f5]Barricades"); string logtext = player.Name + " Deleted " + c + " Barricades"; Log(logtext, "Barricade"); } } }