public DeleteSetting ( String sectionName, String settingName ) : void | ||
sectionName | String | Section to add under. |
settingName | String | Key name to add. |
Résultat | void |
public bool UnbanByName(string name, string UnBanner = "Console") { var id = ReturnACNByName2(name); var ip = ReturnACNByName(name); if (id == null) { return(false); } string red = "[color #FF0000]"; string green = "[color #009900]"; string white = "[color #FFFFFF]"; foreach (Fougerite.Player pl in Server.GetServer().Players) { if (pl.Admin || pl.Moderator) { pl.Message(red + name + white + " was unbanned by: " + green + UnBanner); } } IniParser ini = GlobalBanList; name = id; var iprq = ini.GetSetting("NameIps", ip); var idrq = ini.GetSetting("NameIds", id); ini.DeleteSetting("Ips", iprq); ini.DeleteSetting("Ids", idrq); ini.DeleteSetting("NameIps", name); ini.DeleteSetting("NameIds", name); ini.Save(); return(true); }
public void Save(IniParser ini, string section) { ini.AddSetting(section, "Enabled", Enabled); ini.AddSetting(section, "ID", ID.ToString()); ini.AddSetting(section, "Alias", Alias.ToString()); ini.AddSetting(section, "Multihex", Multihex.ToString()); ini.AddSetting(section, "Aim", Aim); ini.AddSetting(section, "Armor", Armor); ini.AddSetting(section, "Rotate", Rotate); ini.AddSetting(section, "Walk", Walk.ToString()); ini.AddSetting(section, "Run", Run.ToString()); ini.AddSetting(section, "Step1", Step1.ToString()); ini.AddSetting(section, "Step2", Step2.ToString()); ini.AddSetting(section, "Step3", Step3.ToString()); ini.AddSetting(section, "Step4", Step4.ToString()); if (Sound.Length > 0) { ini.AddNewSetting(section, "Sound", Sound); } else { ini.DeleteSetting(section, "Sound"); } if (Comment.Length > 0) { ini.AddNewSetting(section, "Comment", Comment); } else { ini.DeleteSetting(section, "Comment"); } }
private void OnConsoleReceived(ref ConsoleSystem.Arg arg, bool external) { if (arg.Class == "authme" && arg.Function == "resetuser") { if ((arg.argUser != null && arg.argUser.admin) || arg.argUser == null) { Fougerite.Player adminplr = null; if (arg.argUser != null) { adminplr = Fougerite.Server.GetServer().FindPlayer(arg.argUser.userID); } string name = string.Join(" ", arg.Args); if (string.IsNullOrEmpty(name)) { arg.ReplyWith(green + "Specify a name!"); return; } Fougerite.Player plr = Fougerite.Server.GetServer().FindPlayer(name); if (plr != null) { if (Auths.GetSetting("Login", plr.SteamID) != null) { Auths.DeleteSetting("Login", plr.SteamID); Auths.Save(); } if (Credentials.ContainsKey(plr.UID)) { Credentials.Remove(plr.UID); } arg.ReplyWith(green + "User: "******" reset! He can now register a new account for that steamid."); plr.MessageFrom("AuthMe", green + CredsReset); if (adminplr != null) { AuthLogger.Log("[USER RESET] " + adminplr.Name + " - " + adminplr.SteamID + " - " + adminplr.IP + " reset credetials for: " + plr.Name + " - " + plr.SteamID + " - " + plr.IP); } else { AuthLogger.Log("[USER RESET] Console reset credetials for: " + plr.Name + " - " + plr.SteamID + " - " + plr.IP); } } else { arg.ReplyWith(green + "No player found!"); } } } }
private bool GiveGroupPerm(string Group, string Permission) { if (GroupData.ContainsKey(Group)) { if (GroupData[Group].Contains(Permission)) { UnityEngine.Debug.Log("[Permissions] " + Group + " already has permission: " + Permission); return(false); } else { bool threaderror = false; Thread thread = new Thread(() => { try { GroupData[Group].Add(Permission); permissionsData.DeleteSetting("Groups", Group); permissionsData.AddSetting("Groups", Group, string.Join(", ", GroupData[Group].ToArray())); permissionsData.Save(); } catch { threaderror = true; } }) { IsBackground = true }; thread.Start(); if (threaderror) { UnityEngine.Debug.LogError("[Permissions] Unable to add permission: " + Permission + " to: " + Group); return(false); } else { UnityEngine.Debug.Log("[Permissions] Gave " + Group + " group permission: " + Permission); return(true); } } } else { UnityEngine.Debug.Log("[Permissions] Can not find group: " + Group); return(false); } }
public bool UnbanByID(string id) { IniParser ini = GlobalBanList; if (ini.ContainsSetting("Ids", id)) { ini.DeleteSetting("Ids", id); ini.Save(); return(true); } return(false); }
public void DeleteZone(Fougerite.Player pl, string ZoneName) { //juli method ZonesFile = new IniParser(Path.Combine(ModuleFolder, "Zones.ini")); if (ExisteLaZona(ZoneName)) { try { ZonesFile.DeleteSetting(ZoneName, "Location"); ZonesFile.DeleteSetting(ZoneName, "Radius"); ZonesFile.Save(); pl.MessageFrom(Name, orange + "La zona: " + white + ZoneName + orange + " ha sido eliminada."); } catch (Exception ex) { Debug.Log("Error al borrar zona: " + ex.ToString()); pl.MessageFrom(Name, "hubo un error al borrar"); } } ReloadZonesJuli(); return; }
void Leave(Player pl) { if (locs.ContainsSetting("Locs", pl.SteamID)) { locs.DeleteSetting("Locs", pl.SteamID); locs.AddSetting("Locs", pl.SteamID, pl.DisconnectLocation.ToString()); locs.Save(); } else { locs.AddSetting("Locs", pl.SteamID, pl.DisconnectLocation.ToString()); locs.Save(); } }
private void BanForDays(Fougerite.Player target, Fougerite.Player player, int time, string reason) { daybans[target.IP] = new TimerPlus(); daybans[target.IP].Interval = time * 86400000; daybans[target.IP].AutoReset = false; daybans[target.IP].Elapsed += (x, y) => { banlist.DeleteSetting("DayBans", target.IP); banlist.Save(); daybans.Remove(target.IP); }; daybans[target.IP].Start(); if ((bool)config.Settings["BroadcastBans"]) { Server.GetServer().BroadcastNotice(config.Settings["TimedBan"].ToString().Replace("<player>", target.Name).Replace("<time>", time + " Days").Replace("<admin>", player.Name)); } target.PlayerClient.netUser.Kick(NetError.ApprovalDenied, true); }
public void On_Command(Fougerite.Player player, string cmd, string[] args) { if (cmd == "wlist") { if (player.Admin || player.Moderator) { if (args.Length.Equals(0)) { player.MessageFrom("CountryBlackList", "Usage: /wlist <User Name>"); player.MessageFrom("CountryBlackList", "Adds a user to the whitelist"); } else { string search = string.Join(" ", args); Fougerite.Player target = Fougerite.Server.GetServer().FindPlayer(search); if (target != null) { if (!OnWhiteList(player.SteamID, player.IP)) { WhiteList.AddSetting(target.SteamID, target.IP, target.Name); WhiteList.Save(); player.MessageFrom("CountryBlackList", "You have added " + target.Name + " to the whitelist"); } else { player.MessageFrom("CountryBlackList", target.Name + " is already on the whitelist!"); } } } } else { player.MessageFrom("CountryBlackList", "You are not allowed to use this command!"); } } else if (cmd == "dlist") { if (player.Admin || player.Moderator) { if (args.Length.Equals(0)) { player.MessageFrom("CountryBlackList", "Usage: /dlist <User Name>"); player.MessageFrom("CountryBlackList", "Removes a user from the whitelist"); } else { string search = string.Join(" ", args); Fougerite.Player target = Fougerite.Server.GetServer().FindPlayer(search); if (target != null) { if (OnWhiteList(player.SteamID, player.IP)) { WhiteList.DeleteSetting(target.SteamID, target.IP); WhiteList.Save(); player.MessageFrom("CountryBlackList", "You have removed " + target.Name + " from the whitelist"); } else { player.MessageFrom("CountryBlackList", target.Name + " is not on the whitelist!"); } } } } else { player.MessageFrom("CountryBlackList", "You are not allowed to use this command!"); } } else if (cmd == "cbreload") { if (player.Admin) { player.MessageFrom("CountryBlackList", "Reloading config..."); ReloadConfig(); player.MessageFrom("CountryBlackList", "Done"); } } }
public void Command(Player pl, string cmd, string[] args) { if (cmd == "tploc") { if (pl.Admin || Hasflag(pl, FLAG_USE)) { if (args.Length == 0) { pl.MessageFrom(Name, "Try out /tploc name"); string[] en = ini.EnumSection("Locations"); { foreach (var locs in en) { pl.MessageFrom(Name, locs); } } } else { if (ini.ContainsSetting("Locations", args[0])) { string j = ini.GetSetting("Locations", args[0]); Vector3 loc = Util.GetUtil().ConvertStringToVector3(j); // makes a Vector3 of string pl.TeleportTo(loc); pl.InventoryNotice(args[0]); } else { pl.MessageFrom(Name, "There is no location called " + args[0]); } } } } else if (cmd == "tplocadd") { if (pl.Admin || Hasflag(pl, FLAG_USE)) { if (args.Length == 0) { pl.MessageFrom(Name, "Syntax /tplocadd name"); return; } if (ini.ContainsSetting("Locations", args[0])) { pl.MessageFrom(Name, "There is already a location called " + args[0]); } else { ini.AddSetting("Locations", args[0], pl.Location.ToString()); pl.MessageFrom(Name, "New location called " + args[0] + " added at " + pl.Location); ini.Save(); } } } else if (cmd == "tplocremove") { if (pl.Admin || Hasflag(pl, FLAG_USE)) { if (args.Length == 0) { pl.MessageFrom(Name, "Syntax /tplocremove name"); return; } if (ini.ContainsSetting("Locations", args[0])) { ini.DeleteSetting("Locations", args[0]); ini.Save(); pl.MessageFrom(Name, "The location " + args[0] + " has been deleted"); } } } }
public void Command(User pl, string cmd, string[] args) { if(cmd == "esshelp") { pl.Message("Fougerite-Essentials " + Version + " by ice cold"); pl.Message("/help - see all commands"); pl.Message("/rules - see all the rules"); pl.Message("/info - See info about this plugin"); pl.Message("/friendhelp - See all information about the friends system"); pl.Message("/sharehelp - See all help about the share system"); if(EnableHome) { pl.Message("/home - See all help about the home system"); } if(EnableRemove) { pl.Message("/remove - Enables/disables remover tool"); } if(Enabletpr) { pl.Message("/tpr name - sends teleport request to that user"); pl.Message("/tpa - Accepts an teleport reqequest"); } if(EnableWarps) { pl.Message("/warphelp - See all the help for the warping system"); } if(pl.Admin || pl.Moderator) { pl.Message("/prod - Shows the owner of the object you are looking at"); pl.Message("/country player - Shows from which country a player comes"); pl.Message("/download url filename - downloads that object and put it in the the Downloaded folder EXAMPLE: (/download http://myitem.com myitem.zip)"); pl.Message("/addnewspawn - adds a new spawns to the overwrite spawn list"); } } else if(cmd == "country") { if(pl.Admin || pl.Moderator) { if(args.Length != 1) { pl.Message("Usage /country player"); return; } User target = Server.GetServer().FindPlayer(args[0]); if(target == null) { pl.Message("Couldn't find the target user"); return; } string country = PlayerDatabase.GetSetting(target.SteamID, "Country"); pl.Message("[color #ffb90f]" + target.Name + " is located from [color #c1ffc1]" + country); } } else if(cmd == "download") { if(pl.Admin) { if(args.Length != 2) { pl.Message("Usage /download url filename - EXAMPLE: (/download http://myitem.com myitem.zip)"); return; } using (WebClient web = new WebClient()) { web.DownloadFileAsync(new Uri(args[0]), Util.GetRootFolder() + "\\Save\\Fougerite-Essentials\\Downloaded\\" + args[1]); pl.Message("[color #00ced1]Downloading " + args[1] + " to downloaded folder"); } } } else if(cmd == "addnewspawn") { if(pl.Admin) { if(EnableNewSpawns) { string[] c = SpawnsOverwrite.EnumSection("SpawnLocations"); string co = (Convert.ToInt32(c[c.Length - 1]) + 1).ToString(); SpawnsOverwrite.AddSetting("SpawnLocations", co, pl.Location.ToString()); SpawnsOverwrite.Save(); } } } else if(cmd == "warphelp") { pl.Message("Fougerite-Essentials WarpSystem by ice cold"); pl.Message("/warp name - Warps you to that location"); pl.Message("/warps - See all the current warps"); if(pl.Admin) { pl.Message("/warp_set Name"); pl.Message("/warp_remove Name"); } } else if(cmd == "warp") { if(args.Length != 1) { pl.Message("Usage /warp name"); return; } if(Warps.ContainsSetting("Warps", args[0])) { if (pl.Admin) { Vector3 loc = Util.GetUtil().ConvertStringToVector3(Warps.GetSetting("Warps", args[0])); pl.TeleportTo(loc); pl.Message("[color#00bfff]Warped to " + args[0]); } else { if(!warpcd.Contains(pl.UID)) { var dict = new Dictionary<string, object>(); dict["pl"] = pl; warpcd.Add(pl.UID); Warpcooldown(WarpCooldown * 1000, dict).Start(); Warpdelaytimer(WarpDelay * 1000, dict).Start(); string message = WarpDelayMessage.Replace("{warpname}", args[0]); } else { pl.Message(WarpCooldownMessage); } } } } else if(cmd == "warps") { pl.Message("WarpsList"); string[] l = Warps.EnumSection("Warps"); foreach(var num in l) { pl.Message(num); } } else if(cmd == "warp_set") { if(pl.Admin) { if(args.Length != 1) { pl.Message("Usage /warp_set Name"); return; } if(Warps.ContainsSetting("Warps", args[0])) { pl.Message("There is already a warp with the name " + args[0]); return; } Warps.AddSetting("Warps", args[0], pl.Location.ToString()); Warps.Save(); pl.Message("Warp saved"); } } else if(cmd == "warp_remove") { if(pl.Admin) { if(args.Length != 1) { pl.Message("Usage /warp_remove Name"); return; } if(!Warps.ContainsSetting("Warps", args[0])) { pl.Message("There is no warp with the name " + args[0]); return; } Warps.DeleteSetting("Warps", args[0]); Warps.Save(); pl.Message("The warp " + args[0] + " has been succesfully removed"); } } else if(cmd == "help") { if(EnableHelp) { foreach (var h in HelpList.EnumSection("Help")) { string d = HelpList.GetSetting("Help", h); pl.MessageFrom("Help", d); } } } else if(cmd == "rules") { if(EnableRules) { foreach (var r in RulesList.EnumSection("Rules")) { string d = RulesList.GetSetting("Help", r); pl.MessageFrom("Help", d); } } } else if(cmd == "info") { pl.MessageFrom(Name, "[color #87cefa][Fougerite-Essentials " + Version + " plugin brought by ice cold"); pl.MessageFrom(Name, "[color #20b2aa]Wanna support ice cold? https://www.patreon.com/uberrust"); pl.MessageFrom(Name, "[color #8470ff]You can download this plugin at "); } else if(cmd == "friendhelp") { pl.Message("[Fougerite-Essentials] Friends system brought by ice cold"); pl.Message("/addfriend Name - ads player to your friends list"); pl.Message("/unfriend Name - Unfriend someone"); pl.Message("/friends - See all your friends"); } else if(cmd == "sharehelp") { pl.Message("[Fougerite-Essentials] Share system brought by ice cold"); pl.Message("/share Name - Door/structure share the player"); pl.Message("/unshare Name - unshare someone"); pl.Message("/sharelist - See all the people you have shared"); } else if(cmd == "addfriend") { if(EnableFriendsSystem) { if (args.Length != 1) { pl.Message("Usage /addfriend Name"); return; } User target = Server.GetServer().FindPlayer(args[0]); if (target == null) { pl.Message("Couldn't find the target user"); return; } if (friends.ContainsSetting(pl.SteamID, target.SteamID)) { string message = AlreadyFriendedMessage.Replace("{friend}", target.Name); pl.Message(message); return; } string me = AddFriendMessage.Replace("{friend}", target.Name); pl.Message(me); friends.AddSetting(pl.SteamID, target.SteamID, target.Name); friends.Save(); } } else if(cmd == "unfriend") { if(EnableShareSystem) { if (args.Length != 1) { pl.Message("Usage /unfriend Name"); return; } User target = Server.GetServer().FindPlayer(args[0]); if(target == null) { pl.Message("Couldn't find the target user"); return; } if(!friends.ContainsSetting(pl.SteamID, target.SteamID)) { pl.Message(target.Name + " Isnt in your friends list"); return; } friends.DeleteSetting(pl.SteamID, target.SteamID); friends.Save(); string message = UnfriendMessage.Replace("{target}", target.Name); pl.Message(message); friends.DeleteSetting(pl.SteamID, target.SteamID); friends.Save(); } } else if(cmd == "friends") { if(EnableFriendsSystem) { pl.Message("===FriendsList==="); foreach (var id in friends.EnumSection(pl.SteamID)) { string m = friends.GetSetting(pl.SteamID, id); pl.Message("_ " + m); } } } else if(cmd == "share") { if(EnableShareSystem) { if(args.Length != 1) { pl.Message("Usage /share Name"); return; } User target = Server.GetServer().FindPlayer(args[0]); if (target == null) { pl.Message("Couldn't find the target user"); return; } if(share.ContainsSetting(pl.SteamID, target.SteamID)) { string message = AlreadySharedMessage.Replace("{player}", target.Name); pl.Message(message); return; } share.AddSetting(pl.SteamID, target.SteamID, target.Name); share.Save(); string me = SharedMessage.Replace("{player}", target.Name); pl.Message(me); } } else if(cmd == "unshare") { if(EnableShareSystem) { if(args.Length != 1) { pl.Message("Usage /unshare Name"); return; } User target = Server.GetServer().FindPlayer(args[0]); if(target == null) { pl.Message("Couldn't find the target user"); return; } if(!share.ContainsSetting(pl.SteamID, target.SteamID)) { pl.Message("You are not sharing with " + target.Name); return; } share.DeleteSetting(pl.SteamID, target.SteamID); share.Save(); string message = UnSharedMessage.Replace("{player}", target.Name); pl.Message(message); } } else if(cmd == "sharelist") { if(EnableShareSystem) { pl.Message("===ShareList==="); foreach(var id in share.EnumSection(pl.SteamID)) { string m = share.GetSetting(pl.SteamID, id); pl.Message("- " + m); } } } else if(cmd == "prod") { if(pl.Admin || pl.Moderator) { cachedCharacter = pl.PlayerClient.rootControllable.idMain.GetComponent<Character>(); if (!MeshBatchPhysics.Raycast(cachedCharacter.eyesRay, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { pl.Message("He Hello thats the sky bro"); return; } if(cachedhitInstance != null) { cachedCollider = cachedhitInstance.physicalColliderReferenceOnly; if (cachedCollider == null) { pl.Message("Sorry but i cannot prod that"); return; } cachedStructure = cachedCollider.GetComponent<StructureComponent>(); if (cachedStructure != null && cachedStructure._master != null) { cachedMaster = cachedStructure._master; var name = PlayerDatabase.GetSetting(cachedMaster.ownerID.ToString(), "Name"); pl.Message(string.Format("{object} - {ID} - {name}", cachedStructure.gameObject.name, cachedMaster.ownerID.ToString(), name == null ? "Unknown" : name.ToString())); } } else { cachedDeployable = cachedRaycast.collider.GetComponent<DeployableObject>(); if(cachedDeployable != null) { var name = PlayerDatabase.GetSetting(cachedMaster.ownerID.ToString(), "Name"); pl.Message(string.Format("{object} - {ID} - {name}", cachedDeployable.gameObject.name, cachedDeployable.ownerID.ToString(), name == null ? cachedDeployable.ownerName.ToString() : name.ToString())); } } pl.Message("Failed to prod " + cachedRaycast.collider.gameObject.name); } } else if(cmd == "home") { if(EnableHome) { if(args.Length != 1) { pl.Message("[Fougerite-Essentials] Home system brought by ice cold"); if(!SleepingHome) { pl.Message("/home Name - teleports you the home"); pl.Message("/sethome Name - Enabled sethome mode (hit a foundation or ceiling to save your home)"); pl.Message("/delhome Name - Deletes that home"); pl.Message("/homes - Shows the list of homes"); } else { pl.Message("/homeon - Enables home mode (place a Sleepingbag or Bed to save that as your current home)"); pl.Message("/gohome - Teleports you to your sleepingBag or Bed"); } } else { if(!SleepingHome) { if(!homecd.Contains(pl.UID)) { if (StructureHome.ContainsSetting(pl.SteamID, args[0])) { var homeloc = StructureHome.GetSetting(pl.SteamID, args[0]); var dict = new Dictionary<string, object>(); dict["pl"] = pl; dict["homeloc"] = homeloc; HomeTimer(HomeDelay * 1000, dict).Start(); string message = HomeDelayMessage.Replace("{home}", args[0]).Replace("{delay}", HomeDelay.ToString()); pl.Message(message); HomeCooldown(HomeCooldown * 1000, dict).Start(); homecd.Add(pl.UID); } else { string message = NoHomeMessage.Replace("{home}", args[0]); pl.Message(message); } } else { string message = HomeCooldownMessage.Replace("{cooldown}", HomeCooldown.ToString()); pl.Message(message); } } } } } else if(cmd == "sethome") { if(EnableHome) { if(!homemode.Contains(pl.UID)) { if (args.Length != 1) { pl.Message("Usage /sethome Name"); return; } string[] l = StructureHome.EnumSection(pl.SteamID); if ((Convert.ToBoolean(l.Length == MaxHomes))) { pl.Message(MaxHomesMessage); } else { homemode.Add(pl.UID); pl.Message("Sethome mode activated hit a foundation/ceiling to set your home"); homenum.Add(pl.UID, args[0]); } } else { pl.Message("Please do /homestop first"); } } } else if(cmd == "") }
public void Command(Player sender, string cmd, string[] args) { if (cmd == "jail") { if (sender.Admin || sender.Moderator && AllowMods) { sender.MessageFrom(Name, green + "Jail Remastered by " + cadet1 + Author); sender.MessageFrom(Name, cornflower + "/jail_send player time reason - sends a player to jail"); sender.MessageFrom(Name, cornflower + "/jail_set radius - sends a jail"); sender.MessageFrom(Name, cornflower + "/jail_del - deletes the jail"); sender.MessageFrom(Name, cornflower + "/jail_free player - free someone"); } } else if (cmd == "jail_send") { if (sender.Admin || sender.Moderator && AllowMods) { if (args.Length != 3) { sender.Notice("☢", "Usage /jail_send player time reason", 20f); return; } Player inmate = server.FindPlayer(args[0]); if (inmate == null) { sender.Notice("☢", "Couldn't find the target user", 10f); return; } if (!inmate.IsAlive) { sender.Notice("☢", inmate.Name + " seems to be dead wait for him to respawn", 10f); return; } if (list.ContainsSetting("inmates", inmate.SteamID)) { sender.Notice("☢", inmate.Name + " is already in jail", 10f); return; } if (!ini.ContainsSetting("jailloc", "location")) { sender.Notice("☢", "You must have a jail", 10f); return; } if (!radius.ContainsKey("radius")) { sender.Notice("☢", "Failed to find jail radius please reset the jail", 10f); return; } if (inmate.Admin && AdminProtection) { sender.Notice("☢", "You cannot send admins to jail", 10f); return; } int time = Convert.ToInt32(args[1]); Vector3 loc = util.ConvertStringToVector3(ini.GetSetting("jailloc", "location")); string message = GlobalSendMessage.Replace("{inmate}", inmate.Name).Replace("{sender}", sender.Name).Replace("{time}", args[1]).Replace("{reason}", args[2]); list.AddSetting("inmates", inmate.SteamID, inmate.Name); list.AddSetting("jailreasons", inmate.SteamID, args[2]); list.AddSetting("previouslocations", inmate.SteamID, inmate.Location.ToString()); list.Save(); ds.Add("inmates", inmate.SteamID, "injail"); ds.Save(); inmate.MessageFrom(Name, ArrestMessage); server.BroadcastFrom(Name, message); inmate.TeleportTo(loc); inmate.AdjustCalorieLevel(100f); var dict = new Dictionary <string, object>(); dict["inmate"] = inmate; Jailtimer(time * 60000, dict).Start(); BlockCommands(inmate); Logger.Log("[Jail] " + inmate.Name + " was sended to jail by " + sender.Name + " for " + time + " minutes, for " + args[2]); } else { sender.Notice("✘", "You dont have permissions to use this command", 10f); } } else if (cmd == "jail_set") { if (sender.Admin || sender.Moderator && AllowMods) { if (args.Length != 1) { sender.Notice("☢", "Usage /jail_set Radius"); return; } if (ini.ContainsSetting("jailloc", "location")) { sender.Notice("☢", "Please remove your jail before setting new one"); return; } int rad = Convert.ToInt32(args[0]); Vector3 loc = sender.Location; SetJail(loc, rad); sender.MessageFrom(Name, "Jail saved at " + sender.Location + " with a radius of " + rad); } } else if (cmd == "jail_del") { if (sender.Admin || sender.Moderator && AllowMods) { if (!ini.ContainsSetting("jailloc", "location")) { sender.Notice("☢", "Failed to find jail", 10f); return; } ini.DeleteSetting("jailloc", "location"); ini.DeleteSetting("JailRadius", "radius"); radius.Remove("radius"); ini.Save(); sender.Notice("☢", "The jail has been succesfully removed", 10f); } } else if (cmd == "jail_free") { if (sender.Admin || sender.Moderator && AllowMods) { if (args.Length != 1) { sender.Notice("☢", "Usage /jail_free player", 10f); return; } Player inmate = server.FindPlayer(args[0]); if (inmate == null) { sender.Notice("☢", "Couldn't find the target user", 10f); return; } if (!ds.ContainsKey("inmates", inmate.SteamID)) { sender.Notice("☢", inmate.Name + " isnt in jail", 10f); return; } list.DeleteSetting("inmates", inmate.SteamID); list.DeleteSetting("jailreasons", inmate.SteamID); Vector3 loc = util.ConvertStringToVector3(list.GetSetting("previouslocations", inmate.SteamID)); inmate.TeleportTo(loc); list.DeleteSetting("previouslocations", inmate.SteamID); string message = FreeMessage.Replace("inmate", inmate.Name); server.BroadcastFrom(Name, message); ini.Save(); ds.Remove("inmates", inmate.SteamID); ds.Save(); } } }
void Command(Player pl, string cmd, string[] args) { if (cmd == "flag") { if (pl.Admin || API.HasFlag(pl, "canflag")) { pl.Notice("⚑", "FlagsAPI brought by ice cold", 20f); pl.MessageFrom(Name, "FlagsAPI 1.1 by ice cold"); pl.MessageFrom(Name, "/flag_add Player flagname - gives the player the flagname"); pl.MessageFrom(Name, "/flag_invoke Player flagname - removes the flag in player"); pl.MessageFrom(Name, "/flag_register Flagname - register a new flag"); } else { pl.MessageFrom(Name, "You dont have the > canflag < flag"); } } else if (cmd == "flag_add") { if (pl.Admin || API.HasFlag(pl, "canflag")) { if (args.Length != 2) { pl.Notice("⚑", "Syntax /flag_add PlayerName FlagName"); return; } if (list.ContainsSetting("Flags", args[1])) { var user = Fougerite.Server.GetServer().FindPlayer(args[0]); if (user == null) { pl.Notice("⚑", "Failed to find user"); return; } ini.AddSetting(user.SteamID, args[1], args[1]); ini.Save(); pl.Notice("⚑", "You have given " + user.Name + " flag (" + args[1] + ")", 20f); user.Notice("⚑", "You have received flag (" + args[1] + ")", 20f); } else { pl.MessageFrom(Name, "You must register this flag first by doing /flag_register " + args[1]); } } } else if (cmd == "flag_invoke") { if (pl.Admin || API.HasFlag(pl, "canflag")) { if (args.Length != 2) { pl.Notice("⚑", "Syntax /flag_invoke PlayerName FlagName"); return; } var user = Fougerite.Server.GetServer().FindPlayer(args[0]); if (user == null) { pl.Notice("⚑", "Failed to find user"); return; } if (ini.ContainsSetting(user.SteamID, args[1])) { ini.DeleteSetting(user.SteamID, args[1]); ini.Save(); pl.Notice("⚑", user.Name + " has no longer the flag " + args[1]); } else { pl.Notice("⚑", user.Name + " doesn't have this flag"); } } } else if (cmd == "flags_reload") { if (pl.Admin || API.HasFlag(pl, "canflag")) { ini = new IniParser(Path.Combine(ModuleFolder, "PlayerFlagdb.ini")); list = new IniParser(Path.Combine(ModuleFolder, "Flags.list")); pl.Notice("Flags database reloaded"); } } else if (cmd == "flag_register") { if (pl.Admin || API.HasFlag(pl, "canflag")) { API.RegisterFlag(args[0]); pl.MessageFrom(Name, "The flag (" + args[0] + ") was succestfully registered"); } } }
public void SaveSettingsToFile() { IniParser parser = new IniParser(m_settingsPath); parser.DeleteSetting("NewTaskHotkey", "alt"); parser.DeleteSetting("NewTaskHotkey", "ctrl"); parser.DeleteSetting("NewTaskHotkey", "shift"); parser.DeleteSetting("NewTaskHotkey", "win"); parser.DeleteSetting("NewTaskHotkey", "key"); parser.DeleteSetting("general", "startwithwindows"); parser.DeleteSetting("general", "autoupdate"); parser.DeleteSetting("general", "playsound"); parser.DeleteSetting("CultureInfo", "name"); parser.DeleteSetting("RemindMeLater", "default"); parser.DeleteSetting("skin", "code"); parser.DeleteSetting("skin", "themename"); parser.DeleteSetting("sync", "id"); parser.DeleteSetting("sync", "interval"); parser.DeleteSetting("sync", "enable"); parser.AddSetting("NewTaskHotkey", "alt", StaticData.Settings.NewTaskHotkey.Alt.ToString()); parser.AddSetting("NewTaskHotkey", "ctrl", StaticData.Settings.NewTaskHotkey.Ctrl.ToString()); parser.AddSetting("NewTaskHotkey", "shift", StaticData.Settings.NewTaskHotkey.Shift.ToString()); parser.AddSetting("NewTaskHotkey", "win", StaticData.Settings.NewTaskHotkey.Win.ToString()); parser.AddSetting("NewTaskHotkey", "key", StaticData.Settings.NewTaskHotkey.Key); parser.AddSetting("General", "startwithwindows", StaticData.Settings.StartWithWindows.ToString()); parser.AddSetting("General", "autoupdate", StaticData.Settings.CheckUpdates.ToString()); parser.AddSetting("General", "playsound", StaticData.Settings.PlaySound.ToString()); parser.AddSetting("CultureInfo", "name", StaticData.Settings.CultureData.CultureInfo.Name.ToString()); parser.AddSetting("RemindMeLater", "default", RemindLaterValue.Round(StaticData.Settings.RemindMeLaterDecimalValue).ToString()); parser.AddSetting("skin", "code", StaticData.Settings.SkinsUniqueCodes.SelectedSkin); parser.AddSetting("skin", "themename", StaticData.Settings.ThemeUniqueCode); parser.AddSetting("sync", "id", StaticData.Settings.Sync.Id); parser.AddSetting("sync", "interval", StaticData.Settings.Sync.Interval.ToString()); parser.AddSetting("sync", "enable", StaticData.Settings.Sync.Enable.ToString()); parser.SaveSettings(); m_log.Info("Settings were saved successfully"); }
public void SaveSettingsToFile() { IniParser parser = new IniParser(m_settingsPath); parser.DeleteSetting("NewTaskHotkey", "alt"); parser.DeleteSetting("NewTaskHotkey", "ctrl"); parser.DeleteSetting("NewTaskHotkey", "shift"); parser.DeleteSetting("NewTaskHotkey", "win"); parser.DeleteSetting("NewTaskHotkey", "key"); parser.DeleteSetting("general", "startwithwindows"); parser.DeleteSetting("general", "autoupdate"); parser.DeleteSetting("general", "playsound"); parser.DeleteSetting("CultureInfo", "name"); parser.DeleteSetting("RemindMeLater", "default"); parser.DeleteSetting("skin", "code"); parser.DeleteSetting("skin", "themename"); parser.DeleteSetting("sync", "id"); parser.DeleteSetting("sync", "interval"); parser.DeleteSetting("sync", "enable"); parser.AddSetting("NewTaskHotkey", "alt", StaticData.Settings.NewTaskHotkey.Alt.ToString()); parser.AddSetting("NewTaskHotkey", "ctrl", StaticData.Settings.NewTaskHotkey.Ctrl.ToString()); parser.AddSetting("NewTaskHotkey", "shift", StaticData.Settings.NewTaskHotkey.Shift.ToString()); parser.AddSetting("NewTaskHotkey", "win", StaticData.Settings.NewTaskHotkey.Win.ToString()); parser.AddSetting("NewTaskHotkey", "key", StaticData.Settings.NewTaskHotkey.Key); parser.AddSetting("General", "startwithwindows", StaticData.Settings.StartWithWindows.ToString()); parser.AddSetting("General", "autoupdate", StaticData.Settings.CheckUpdates.ToString()); parser.AddSetting("General", "playsound", StaticData.Settings.PlaySound.ToString()); parser.AddSetting("CultureInfo", "name", StaticData.Settings.CultureData.CultureInfo.Name.ToString()); parser.AddSetting("RemindMeLater", "default", RemindLaterValue.Round(StaticData.Settings.RemindMeLaterDecimalValue).ToString()); parser.AddSetting("skin", "code", StaticData.Settings.SkinsUniqueCodes.SelectedSkin); parser.AddSetting("skin", "themename", StaticData.Settings.ThemeUniqueCode); parser.AddSetting("sync", "id", StaticData.Settings.Sync.Id); parser.AddSetting("sync", "interval", StaticData.Settings.Sync.Interval.ToString()); parser.AddSetting("sync", "enable", StaticData.Settings.Sync.Enable.ToString()); parser.SaveSettings(); m_log.Info("Settings were saved successfully"); }