public void SetPluginVariable(string strVariable, string strValue)
        {
            int MaxRank = 0;
            int iTimeMinutes = 0;
            int KickBanValue = 0;
            int Rounds = 0;
            enumBoolYesNo clear = enumBoolYesNo.No;

            if (strVariable.CompareTo("RoC read and accepted") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_RoCAccepted = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Ban Player's GUID?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_BanGUID = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("RankKicker") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true)
            {
                this.m_RankKicker = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue);
            }
            else if (strVariable.CompareTo("Access Limitation") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true)
            {
                this.m_AccessLimitation = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue);
            }
            else if (strVariable.CompareTo("Clan Tag Moderation") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true)
            {
                this.m_ClanTagModeration = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue);
            }
            else if (strVariable.CompareTo("Disallowed Clan Tags") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true)
            {
                this.m_DisallowedTags = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue);
            }
            else if (strVariable.CompareTo("RankKicker active? (Ingame-Command)") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true)
            {
                this.m_RankKickerOnOff = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue);
            }
            else if (strVariable.CompareTo("Show actions in plugin console?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_ConsoleLog = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Rank Limit") == 0 && int.TryParse(strValue, out MaxRank) == true)
            {
                this.m_RankLimit = int.Parse(strValue);
            }
            else if (strVariable.CompareTo("White List") == 0)
            {
                this.m_WhiteList = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Allowed certain Clan Tags?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_ClanTagWhiteList = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("White List Clan Tags") == 0)
            {
                this.m_WhiteListClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Clear data now?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                clear = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
                if (clear == enumBoolYesNo.Yes)
                {
                    Clear(1);
                    this.m_ClearAll = enumBoolYesNo.No;
                }
            }
            else if (strVariable.CompareTo("Ban Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_TempBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Permanently Ban Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_PermBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Player Ban Time (minutes)") == 0 && int.TryParse(strValue, out iTimeMinutes) == true)
            {
                if (iTimeMinutes > 0)
                {
                    this.m_TempBanTime = iTimeMinutes;
                }
            }
            else if (strVariable.CompareTo("Ban Player after X Kicks?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_BanAfterKicks = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Number of Kicks before Ban") == 0 && int.TryParse(strValue, out KickBanValue) == true)
            {
                this.m_KicksBeforeBan = KickBanValue;
            }
            else if (strVariable.CompareTo("Kick Reason") == 0)
            {
                this.m_KickReason = strValue;
            }
            else if (strVariable.CompareTo("Ban Reason") == 0)
            {
                this.m_BanReason = strValue;
            }
            else if (strVariable.CompareTo("Permanent Ban Reason") == 0)
            {
                this.m_PermBanReason = strValue;
            }
            else if (strVariable.CompareTo("Allow Access via Playername?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_AccessLimitationPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Allow Access via Clantag?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_AccessLimitationTags = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Allowed Players") == 0)
            {
                this.m_AllowedPlayers = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Allowed Clantags") == 0)
            {
                this.m_AllowedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Ban disallowed Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_AccessBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Access Kick Reason") == 0)
            {
                this.m_AccessKickReason = strValue;
            }
            else if (strVariable.CompareTo("Access Ban Reason") == 0)
            {
                this.m_AccessPermBanReason = strValue;
            }
            else if (strVariable.CompareTo("Moderated Clan Tags") == 0)
            {
                this.m_ModeratedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Allowed Clan Players") == 0)
            {
                this.m_AllowedClanPlayers = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Ban dísallowed Clan Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_ClanTagBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Clan Tag Kick Reason") == 0)
            {
                this.m_ClanTagKickReason = strValue;
            }
            else if (strVariable.CompareTo("Clan Tag Ban Reason") == 0)
            {
                this.m_ClanTagPermBanReason = strValue;
            }
            else if (strVariable.CompareTo("Ban disallowed Clan Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_DisallowedTagsBan = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Black List") == 0)
            {
                this.m_DisallowedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue));
            }
            else if (strVariable.CompareTo("Disallowed Clan Kick Reason") == 0)
            {
                this.m_DisallowedTagsKickReason = strValue;
            }
            else if (strVariable.CompareTo("Disallowed Clan Ban Reason") == 0)
            {
                this.m_DisallowedTagsBanReason = strValue;
            }
            else if (strVariable.CompareTo("Clear Cache automatically? (Recommended!)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true)
            {
                this.m_AutomaticallyClearCache = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
            }
            else if (strVariable.CompareTo("Rounds before Cache-Clearing") == 0 && int.TryParse(strValue, out Rounds) == true)
            {
                this.m_CacheClearRounds = int.Parse(strValue);
            }

               if (this.m_ConsoleLog == enumBoolYesNo.Yes && clear == enumBoolYesNo.No)
                {
                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0Plugin variable '{0}' set to '{1}'", strVariable, strValue));
                }
        }
 public AccessRestriction()
 {
     this.lstPlayerList = new List<CPlayerInfo>();
     //this.m_LastUpdated = null;
     this.m_RoCAccepted = enumBoolYesNo.No;
     this.m_BanGUID = enumBoolYesNo.No;
     this.m_RankKicker = enumBoolOnOff.Off;
     this.m_AccessLimitation = enumBoolOnOff.Off;
     this.m_RankLimit = 50;
     this.m_TempBanPlayers = enumBoolYesNo.No;
     this.m_PermBanPlayers = enumBoolYesNo.No;
     this.m_TempBanTime = 60;
     this.m_BanAfterKicks = enumBoolYesNo.No;
     this.m_KicksBeforeBan = 3;
     this.m_KickReason = "You got kicked due to your Player Rank being too high!";
     this.m_BanReason = "You  got banned for %bt% minutes due to your Player Rank being too high!";
     this.m_PermBanReason = "You permanently got banned due to your Player Rank being too high!";
     this.m_IsPluginEnabled = false;
     this.m_RankKickerOnOff = enumBoolOnOff.On;
     this.m_ConsoleLog = enumBoolYesNo.Yes;
     this.m_ClearAll = enumBoolYesNo.No;
     this.m_WhiteList = new List<string>();
     this.m_ClanTagWhiteList = enumBoolYesNo.No;
     this.m_WhiteListClanTags = new List<string>();
     this.m_AllowedClanTags = new List<string>();
     this.m_AccessLimitationPlayers = enumBoolYesNo.No;
     this.m_AccessLimitationTags = enumBoolYesNo.No;
     this.m_AllowedPlayers = new List<string>();
     this.m_AccessBanPlayers = enumBoolYesNo.No;
     this.m_AccessKickReason = "Sorry for the kick, dude! This is a private match!";
     this.m_AccessPermBanReason = "Sorry for the ban, dude! This is a private match!";
     this.m_ModeratedClanTags = new List<string>();
     this.m_AllowedClanPlayers = new List<string>();
     this.m_ClanTagModeration = enumBoolOnOff.Off;
     this.m_ClanTagBanPlayers = enumBoolYesNo.No;
     this.m_ClanTagKickReason = "You got kicked for using a clantag by unfair means!";
     this.m_ClanTagPermBanReason = "You got banned for using a clantag by unfair means!";
     this.m_DisallowedClanTags = new List<string>();
     this.m_DisallowedTags = enumBoolOnOff.Off;
     this.m_DisallowedTagsBan = enumBoolYesNo.No;
     this.m_DisallowedTagsKickReason = "Your clan isn't welcome on this server! You got kicked!";
     this.m_DisallowedTagsBanReason = "Your clan isn't welcome on this server! You got banned permanently!";
     this.m_AutomaticallyClearCache = enumBoolYesNo.Yes;
     this.m_CacheClearRounds = 6;
 }
 public void OnCommandToggle(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     if (capCommand.ExtraArguments == "0" || capCommand.ExtraArguments == "off")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker disabled!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker disabled ingame!");
         this.m_RankKickerOnOff = enumBoolOnOff.Off;
     }
     else if (capCommand.ExtraArguments == "1" || capCommand.ExtraArguments == "on")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker enabled!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker enabled ingame!");
         this.m_RankKickerOnOff = enumBoolOnOff.On;
     }
     else if (capCommand.ExtraArguments == "clear")
     {
         Clear(0);
     }
     else if (capCommand.ExtraArguments == "check")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker checking all players!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker checking all players!");
         this.ExecuteCommand("procon.protected.send", "admin.listPlayers", "all");
     }
     else
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "Wrong arguments. Use '0'/'off', '1'/'on', 'clear' or 'check'!", "all");
     }
 }
Beispiel #4
0
            public MetabansAPI(string Username, string ApiKey, enumBoolOnOff Debug) {
                m_requests = new ArrayList();

                // if username + apikey == "", load from xml file.

                this.Username = Username;
                this.ApiKey = ApiKey;
                this.Debug = Debug;
            }