public static void CheckCurrVersion(AdminToolbox plugin, string version) { try { string host = "http://raw.githubusercontent.com/Rnen/AdminToolbox/master/version.md"; if (!int.TryParse(version.Replace(".", string.Empty), out int currentVersion)) { plugin.Info("Coult not get Int16 from currentVersion"); } if (int.TryParse(new System.Net.WebClient().DownloadString(host).Replace(".", string.Empty).Replace("at_version=", string.Empty), out int onlineVersion)) { if (onlineVersion > currentVersion) { plugin.Info("Your version is out of date, please run the \"AT_AutoUpdate.bat\" or visit the AdminToolbox GitHub"); } } else { plugin.Info("Could not get Int16 from onlineVersion"); } } catch (System.Exception e) { plugin.Error("Could not fetch latest version: " + e.Message); } }
public static void SendToJail(Player ply) { if (AdminToolbox.playerdict.ContainsKey(ply.SteamId)) { //Saves original variables AdminToolbox.playerdict[ply.SteamId].originalPos = ply.GetPosition(); if (!AdminToolbox.playerdict[ply.SteamId].isJailed) { AdminToolbox.playerdict[ply.SteamId].previousRole = ply.TeamRole.Role; AdminToolbox.playerdict[ply.SteamId].playerPrevInv = ply.GetInventory(); AdminToolbox.playerdict[ply.SteamId].previousHealth = ply.GetHealth(); AdminToolbox.playerdict[ply.SteamId].prevAmmo5 = ply.GetAmmo(AmmoType.DROPPED_5); AdminToolbox.playerdict[ply.SteamId].prevAmmo7 = ply.GetAmmo(AmmoType.DROPPED_7); AdminToolbox.playerdict[ply.SteamId].prevAmmo9 = ply.GetAmmo(AmmoType.DROPPED_9); } //Changes role to Tutorial, teleports to jail, removes inv. ply.ChangeRole(Role.TUTORIAL, true, false); ply.Teleport(AdminToolbox.warpVectors["jail"]); foreach (Smod2.API.Item item in ply.GetInventory()) { item.Remove(); } AdminToolbox.playerdict[ply.SteamId].isJailed = true; } else { plugin.Info("Player not in PlayerDict!"); } }