public void On_Spawn(Fougerite.Player player, SpawnEvent e) { if (ShouldRemoveLoadoutItemsAtConnect) { if (LoadoutEnabled == true) { player.Inventory.RemoveItem(36); player.Inventory.RemoveItem(37); player.Inventory.RemoveItem(38); player.Inventory.RemoveItem(39); player.Inventory.RemoveItem("M4", 1); player.Inventory.RemoveItem("P250", 1); player.Inventory.RemoveItem("556 Ammo", 250); player.Inventory.RemoveItem("9mm Ammo", 250); LoadoutEnabled = false; } } else if (PreventVanishBug) { if (DataStore.GetInstance().ContainsKey("Vanish", player.SteamID)) { DataStore.GetInstance().Remove("Vanish", player.SteamID); player.Health += 100f; } } }
private void PlayerHurt(HurtEvent he) { try { if (GodModDetect) { var Damage = Math.Round(he.DamageAmount); Fougerite.Player Victim = (Fougerite.Player)he.Victim; if ((!Victim.Admin) && (Damage == 0)) { Log("GOD: " + Victim.Name + ". received 0 damage. Check him for GodMode!"); foreach (var player in Server.GetServer().Players) { if (player.Admin) { player.MessageFrom(EchoBotName, "[color#FFA500]" + Victim.Name + " received 0 damage. Check him for GodMode!"); } } } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " GodDetect crash"); Logger.LogException(ex); } }
private void PlayerPingCheck(Fougerite.Player player) { try { if (player.Ping < HighPingKicking_MaxPing) { DS.Add("ping", player.SteamID.ToString(), 0); return; } int Warned = (int)DS.Get("ping", player.SteamID.ToString()); if (Warned == 0) { player.MessageFrom(EchoBotName, "[color#FF2222]Fix your ping (" + player.Ping + ") or you will be kicked!"); DS.Add("ping", player.SteamID.ToString(), 1); } else if (Warned == 1) { player.MessageFrom(EchoBotName, "[color#FF2222]Your ping is " + player.Ping + " but maximum allowed is " + HighPingKicking_MaxPing); Log("Kick: " + player.Name + ". Lagger"); player.Disconnect(); } } catch (Exception ex) { Logger.LogException(ex); } }
public void On_DoorUse(Fougerite.Player player, Fougerite.Events.DoorEvent DoorEvent) { if (DataStore.GetInstance().ContainsKey("Doors", player.SteamID)) { if (player.Admin) { DoorEvent.Open = true; } } }
public void OnChat(Fougerite.Player player, ref ChatString text) { if (ShouldLogChat) { string line = DateTime.Now + " " + player.Name + ": " + text + " "; file = new System.IO.StreamWriter(ppath, true); file.WriteLine(line); file.Close(); } }
private void BanCheater(Fougerite.Player player, string StringLog) { try { IniParser iniBansIP; string ConfigFile = Path.Combine(ModuleFolder, "BansIP.ini"); if (File.Exists(ConfigFile)) { iniBansIP = new IniParser(ConfigFile); } else { Logger.LogError("BansIP.ini does not exist!"); return; } IniParser iniBansID; ConfigFile = Path.Combine(ModuleFolder, "BansID.ini"); if (File.Exists(ConfigFile)) { iniBansID = new IniParser(ConfigFile); } else { Logger.LogError("BansID.ini does not exist!"); return; } string Date = DateTime.Now.ToShortDateString(); string Time = DateTime.Now.ToShortTimeString(); string BanMessage = "Nickname: " + player.Name + ", Date: " + Date + ", Time: " + Time + ", Reason: " + StringLog + ", Ping: " + player.Ping; iniBansIP.AddSetting("Ips", player.IP, BanMessage); iniBansID.AddSetting("Ids", player.SteamID, BanMessage); iniBansIP.Save(); iniBansID.Save(); player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned."); Log("BAN: " + player.Name + " " + ". " + StringLog + ". Ping: " + player.Ping); player.Disconnect(); } catch (Exception ex) { Logger.LogException(ex); } }
public void OnPlayerDisconnected(Fougerite.Player player) { if (ShouldPreventAbuse) { if (DataStore.GetInstance().ContainsKey("Invis", player.SteamID)) { DataStore.GetInstance().Remove("Invis", player.SteamID); } else if (TurnAdminDoorsOffOnLeave) { if (DataStore.GetInstance().ContainsKey("Doors", player.SteamID)) { DataStore.GetInstance().Remove("Doors", player.SteamID); } } } }
private void PlayerKilled(DeathEvent deathEvent) { try { if (!(deathEvent.Attacker is Fougerite.Player)) { return; } Fougerite.Player player = (Fougerite.Player)deathEvent.Attacker; Fougerite.Player victim = (Fougerite.Player)deathEvent.Victim; string weapon = deathEvent.WeaponName; if ((deathEvent.DamageType == "Bullet" && (weapon == "HandCannon" && weapon == "Pipe Shotgun" && weapon == "Revolver" && weapon == "9mm Pistol" && weapon == "P250" && weapon == "Shotgun" && weapon == "Bolt Action Rifle" && weapon == "M4" && weapon == "MP5A4")) || (deathEvent.DamageType == "Melee" && (int)(Math.Round(deathEvent.DamageAmount)) == 75 && string.IsNullOrEmpty(weapon))) { Vector3 attacker_location = player.Location; Vector3 victim_location = ((Fougerite.Player)deathEvent.Victim).Location; float distance = (float)Math.Round(Util.GetUtil().GetVectorsDistance(attacker_location, victim_location)); if (distance > RangeOf(weapon) && RangeOf(weapon) > 0) { player.Kill(); BanCheater(player, "AutoAIM. Gun: " + weapon + " Dist: " + distance); Server.GetServer() .BroadcastFrom(EchoBotName, player.Name + " shooted " + victim.Name + " from " + distance + "m."); Log("AutoAIM: " + player.Name + ". Gun: " + weapon + " Dist: " + distance); player.Disconnect(); victim.TeleportTo(attacker_location.x, attacker_location.y, attacker_location.z); } } } catch (Exception ex) { Logger.LogException(ex); } }
private void PlayerDisconnect(Fougerite.Player player) { try { if (RelogCooldown) { if (!player.Admin) { var Time = System.Environment.TickCount; if (Cooldown == 0) { DS.Add("loginCooldown", player.SteamID.ToString(), Time); } } } } catch (Exception ex) { Logger.LogException(ex); } }
private void PlayerConnect(Fougerite.Player player) { try { try { if (AntiSpeedHack_Enabled) { DS.Add("lastCoords", player.SteamID.ToString(), player.Location); DS.Add("AntiSpeedHack", player.SteamID.ToString(), 0); } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " DS fill fail"); Logger.LogException(ex); } try { IniParser iniBansIP; string ConfigFile = Path.Combine(ModuleFolder, "BansIP.ini"); if (File.Exists(ConfigFile)) { iniBansIP = new IniParser(ConfigFile); } else { Logger.LogError("BansIP.ini does not exist!"); return; } string IpBanned = iniBansIP.GetSetting("Ips", player.IP); if (!string.IsNullOrEmpty(IpBanned)) { player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned."); Logger.LogDebug(ConsolePrefix + " " + player.Name + " banned by IP!"); player.Disconnect(); return; } IniParser iniBansID; ConfigFile = Path.Combine(ModuleFolder, "BansID.ini"); if (File.Exists(ConfigFile)) { iniBansID = new IniParser(ConfigFile); } else { Logger.LogError("BansID.ini does not exist!"); return; } string IdBanned = iniBansID.GetSetting("Ids", player.SteamID); if (!string.IsNullOrEmpty(IdBanned)) { player.MessageFrom(EchoBotName, "[color#FF2222]You have been banned."); Logger.LogDebug(ConsolePrefix + " " + player.Name + " banned by ID!"); player.Disconnect(); return; } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " Bans check fail"); Logger.LogException(ex); } } catch (Exception ex) { Logger.LogException(ex); } try { if (NamesRestrict_Enabled) { var name = player.Name; var len = player.Name.Length; try { if (len > NamesRestrict_MaxLength) { player.MessageFrom(EchoBotName, "[color#FF2222]You have too many characters in your name. Please Change it. Maximum is " + NamesRestrict_MaxLength); Log("Nick: " + player.Name + ". Too many chars in name."); player.Disconnect(); return; } if (len < NamesRestrict_MinLength) { player.MessageFrom(EchoBotName, "[color#FF2222]You have not enough characters in your name. Please Change it. Minimum is " + NamesRestrict_MinLength); Log("Nick: " + player.Name + ". Low length of name."); player.Disconnect(); return; } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " NameLenght fail"); Logger.LogException(ex); } try { foreach (char Symbol in player.Name) { if (NamesRestrict_AllowedChars.IndexOf(Symbol) == -1) { player.MessageFrom(EchoBotName, "[color#FF2222]You have invalid characters in your name"); Log("Nick: " + player.Name + ". Banned chars in name."); player.Disconnect(); return; } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " Name Symbols fail"); Logger.LogException(ex); } try { for (var i = 0; i < BannedNames.Length; i++) { if (player.Name.ToLower() == BannedNames[i].ToLower()) { player.MessageFrom(EchoBotName, "[color#FF2222]This name isn't allowed. Please change your name."); Log("Nick: " + player.Name + ". Banned name."); player.Disconnect(); return; } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " BannedNames fail"); Logger.LogException(ex); } try { if (NamesRestrict_BindName) { IniParser BoundNames; if (File.Exists(Path.Combine(ModuleFolder, "BoundNames.ini"))) { BoundNames = new IniParser(Path.Combine(ModuleFolder, "BoundNames.ini")); } else { Logger.LogError(Path.Combine(ModuleFolder, "BoundNames.ini") + " does not exist!"); return; } var Name = player.Name.ToLower(); string ID = BoundNames.GetSetting("Names", Name); if ((player.Admin && NamesRestrict_AdminsOnly) || !NamesRestrict_AdminsOnly) { if (string.IsNullOrEmpty(ID)) { player.MessageFrom(EchoBotName, "[color#22AAFF]Nick " + player.Name + " was bound to your SteamID."); BoundNames.AddSetting("Names", Name, player.SteamID); BoundNames.Save(); } else if (ID != player.SteamID) { player.MessageFrom(EchoBotName, "[color#FF2222]This nickname doesn't belong to you."); Log("Nick: " + player.Name + ". Nick stealer."); player.Disconnect(); return; } } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " BindName fail"); Logger.LogException(ex); } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " NickRestrict check fail"); Logger.LogException(ex); } try { if (RelogCooldown) { var Time = Environment.TickCount; object ObjCooldown = DS.Get("loginCooldown", player.SteamID.ToString()); if (ObjCooldown == null) { return; } int Disconnected = (int)ObjCooldown; if (Time <= Cooldown * 1000 + Disconnected) { var Remaining = ((Cooldown * 1000 - (Time - Disconnected)) / 1000).ToString("F2"); player.MessageFrom(EchoBotName, "[color#FF2222]You must wait " + Cooldown + " seconds before reconnecting. Remaining: " + Remaining + " seconds."); Logger.LogDebug(ConsolePrefix + " " + player.Name + " connect cooldown " + Cooldown + " sec!"); player.Disconnect(); return; } if (Time > Cooldown * 1000 + Disconnected) { DS.Remove("loginCooldown", player.SteamID.ToString()); } } } catch (Exception ex) { Logger.LogError(ConsolePrefix + " Cooldown check fail"); Logger.LogException(ex); } Logger.LogDebug(ConsolePrefix + " " + player.Name + " Connected!"); }
private void PlayerSpawned(Fougerite.Player player, SpawnEvent se) { DS.Add("lastCoords", player.SteamID.ToString(), player.Location); DS.Add("AntiSpeedHack", player.SteamID.ToString(), 0); }
private void DoorUse(Fougerite.Player p, DoorEvent de) { }
// private void Chat(Fougerite.Player p, ref ChatString text) { }
public void OnCommand(Fougerite.Player player, string cmd, string[] args) { if (cmd == "madmin") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.MessageFrom("MultiAdmin", green + "[color green]" + Name + " [color green]Version " + Version + " [color aqua]by [color yellow]" + Author); player.MessageFrom("MultiAdmin", green + "/invis - gives you invisible suit"); player.MessageFrom("MultiAdmin", green + "/invisoff - Removes invis suit"); player.MessageFrom("MultiAdmin", green + "/cleaninv - cleans your inventory"); player.MessageFrom("MultiAdmin", green + "/atp name - teleports you"); player.MessageFrom("MultiAdmin", green + "/loadout - gives you the admin loadout"); player.MessageFrom("MultiAdmin", green + "/vanish - Turns you into a ghost"); player.MessageFrom("MultiAdmin", green + "/adon - Turns Admindoors on"); player.MessageFrom("MultiAdmin", green + "/adoff - Turns Admindoors off"); player.MessageFrom("MultiAdmin", green + "/mban <Name> - Bans the player"); player.MessageFrom("MultiAdmin", green + "/mkick <Name> - kicks the player"); player.MessageFrom("MultiAdmin", green + "/drug <Name> - Drug the player"); player.MessageFrom("MultiAdmin", green + "/itemboost - Boost your current item to max stack"); } } else if (cmd == "itemboost") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.Inventory.InternalInventory.activeItem.SetUses(250); player.MessageFrom("MultiAdmin", green + "Current item boosted"); } } else if (cmd == "invis") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { DataStore.GetInstance().Add("invis", "UseInvis", player.SteamID); player.Inventory.RemoveItem(36); player.Inventory.RemoveItem(37); player.Inventory.RemoveItem(38); player.Inventory.RemoveItem(39); 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.MessageFrom("MultiAdmin", green + "None can see you now!"); Logger.Log(player.Name + " Has spawned himself a invisible suit"); } } else if (cmd == "invisoff") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { DataStore.GetInstance().Remove("invis", player.SteamID); player.Inventory.RemoveItem(36); player.Inventory.RemoveItem(37); player.Inventory.RemoveItem(38); player.Inventory.RemoveItem(39); player.MessageFrom("MultiAdmin", "You are not a god anymore!"); //InvisIsOn = false; } } else if (cmd == "cleaninv") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.Inventory.ClearAll(); // this cleans the inventory player.Notice("☤", "Inventory cleared!"); Logger.Log(player.Name + " has cleaned his inventory"); } } else if (cmd == "atp") { if (UseAdminTeleport) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { string s = string.Join(" ", args); Fougerite.Player p = Fougerite.Server.GetServer().FindPlayer(s); if (p == null) { player.MessageFrom("MultiAdmin", yellow + "Failed to find " + s); } else if (args.Length.Equals(0)) { player.MessageFrom("MultiAdmin", green + "Wrong Syntax use /atp <name>"); } else { Fougerite.Player target = Fougerite.Server.GetServer().FindPlayer(string.Join(" ", args)) ?? null; if (!target.Equals(null)) { float x = target.X; float y = target.Y; float z = target.Z; player.TeleportTo(target.X, target.Y, target.Z); player.MessageFrom("MultiAdmin", green + "You have been teleported to " + target.Name); Logger.Log(player.Name + " Has Atped to " + target.Name); } } } } } else if (cmd == "loadout") //make sure you disabled the loadoad feature in rust++ or disable this command in settings.ini { if (UseAdminLoadout) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.Inventory.RemoveItem(36); player.Inventory.RemoveItem(37); player.Inventory.RemoveItem(38); player.Inventory.RemoveItem(39); player.Inventory.AddItemTo("Kevlar Helmet", 36, 1); player.Inventory.AddItemTo("Kevlar Vest", 37, 1); player.Inventory.AddItemTo("Kevlar Pants", 38, 1); player.Inventory.AddItemTo("Kevlar Boots", 39, 1); player.Inventory.AddItem("M4", 1); player.Inventory.AddItem("P250", 1); player.Inventory.AddItem("556 Ammo", 250); player.Inventory.AddItem("9mm Ammo", 250); Logger.Log(player.Name + " Has used the /loadout command"); DataStore.GetInstance().Add("Loadout", player.SteamID, "Loadout"); } } } else if (cmd == "multiadmin") { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { ReloadSettings(); player.MessageFrom("MultiAdmin", green + "[color green]MultiAdmin [color aqua]by [color yellow]ice cold"); player.MessageFrom("MultiAdmin", green + "Settings have been reloaded"); } } else if (cmd == "vanish") { if (UseVanishCommand) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else if (player.PlayerClient.controllable.health == 0.0) { player.Health = 100f; player.Notice("Your soul has been returned into your body"); } else { player.Health = (player.PlayerClient.controllable.health - player.PlayerClient.controllable.health); player.Notice("You are now a ghosty boo"); DataStore.GetInstance().Add("Vanish", player.SteamID, "Vanish"); } } } else if (cmd == "adon") { if (UseAdminDoor) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.MessageFrom("MultiAdmin", green + "Admin doors enabled"); DataStore.GetInstance().Add("Doors", player.SteamID, "1"); } } } else if (cmd == "adoff") { if (UseAdminDoor) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { player.MessageFrom("MultiAdmin", green + "Admin doors disabled"); DataStore.GetInstance().Remove("Doors", player.SteamID); } } } else if (cmd == "mban") { if (UsebanCommand) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { string s = string.Join(" ", args); Fougerite.Player p = Fougerite.Server.GetServer().FindPlayer(s); if (p == null) { player.MessageFrom("MultiAdmin", yellow + "Failed to find " + s); } else if (args.Length.Equals(0)) { player.MessageFrom("MultiAdmin", yellow + "Wrong Syntax use /mban <name>"); } else { Fougerite.Player banned = Fougerite.Server.GetServer().FindPlayer(string.Join(" ", args)) ?? null; if (!banned.Equals(null)) { Fougerite.Server.GetServer().BanPlayer(banned, "MultiAdminBan", "Was banned from the server"); player.Notice("☢", banned.Name + "Was banned from the server"); Fougerite.Server.GetServer().BroadcastNotice(banned.Name + "Has been banned from the server"); } } } } } else if (cmd == "mkick") { if (UseKickCommand) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { string s = string.Join(" ", args); Fougerite.Player p = Fougerite.Server.GetServer().FindPlayer(s); if (p == null) { player.MessageFrom("MultiAdmin", yellow + "Failed to find " + s); } else if (args.Length.Equals(0)) { player.MessageFrom("MultiAdmin", yellow + "Wrong Syntax use /mkick <name>"); } else { Fougerite.Player kicked = Fougerite.Server.GetServer().FindPlayer(string.Join(" ", args)) ?? null; if (!kicked.Equals(null)) { player.Notice("☢", kicked.Name + "Was kicked from the server"); Fougerite.Server.GetServer().BroadcastNotice(kicked.Name + "Has been kicked from the server"); kicked.Disconnect(); } } } } } else if (cmd == "drug") { if (UseDrugCommand) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { string s = string.Join(" ", args); Fougerite.Player p = Fougerite.Server.GetServer().FindPlayer(s); if (p == null) { player.MessageFrom("MultiAdmin", yellow + "Failed to find " + s); } else if (args.Length.Equals(0)) { player.MessageFrom("MultiAdmin", yellow + "Wrong Syntax use /drug <name>"); } else { Fougerite.Player pl = Fougerite.Server.GetServer().FindPlayer(string.Join(" ", args)) ?? null; if (!pl.Equals(null)) { player.Notice("☢", pl.Name + "Was drugged"); pl.SendCommand("render.fov 120"); } } } } } else if (cmd == "freeze") { if (UseFreezeCommand) { if (!player.Admin) { player.Notice("✘", "You dont have permission to use this command"); } else { string s = string.Join(" ", args); Fougerite.Player p = Fougerite.Server.GetServer().FindPlayer(s); if (p == null) { player.MessageFrom("MultiAdmin", yellow + "Failed to find " + s); } else if (args.Length.Equals(0)) { player.MessageFrom("MultiAdmin", yellow + "Wrong Syntax use /freeze <name>"); } else { Fougerite.Player pl = Fougerite.Server.GetServer().FindPlayer(string.Join(" ", args)) ?? null; if (!pl.Equals(null)) { player.Notice("☢", pl.Name + " Was frozen"); pl.SendCommand("input.bind Left None None"); pl.SendCommand("input.bind Right None None"); pl.SendCommand("input.bind Up None None"); pl.SendCommand("input.bind Down None None"); } } } } } }