Proconプラグイン「InsaneLimits」でDiscord(webhook)とTwitterへラウンド結果を投稿する
Post round results to Discord (webhook) and Twitter with Procon plugin “Insane Limits”
プログラミングど素人がInsane Limits – Live Server Stats – Kills by Country, Clan, Weapon, … をいじりまくって作ってみました。
I am a programming beginner, I made it based on “Insane Limits – Live Server Stats – Kills by Country, Clan, Weapon, …“.
導入するとこんな感じ・・・ example
Twitterはこちら Twitter example
導入方法
- Insane Limitsのインストール(詳細はこちら)
- Discordでwebhookの設定(詳細はこちら)
- Limit #1のFunction settingsで以下の箇所を書き換える
- webhookのURLを
String webhookUrl = "https://";
のhttps://
へ上書き - Twitter機能を使う場合は
bool tweet = false;
のfalse
をへ書き換える - Discordへの投稿にマップ名とモード名を出力したい場合は
bool mapMode = false;
のfalse
をへ書き換える - Limit #1を
evalution: OnRoundOver、first_check: Code、limit_action: none
で設定 - Limit #2を
evalution: OnKill、first_check: Code、limit_action: none
で設定
注意!Limit #2はLive Server Statsに一部コードを追加しただけなのでLive Server Stats – Kills by Country, Clan, Weapon, …を使用する場合は重複しないようにこちらを使用するように!
注意!Twitter機能を使用するときは、必ずMAX_STATUS_LENGTHを140から300へ書き換えて下さい。
注意!Thread.Sleepを使用しているため他プラグインに影響を及ぼす可能性があります。もし影響があるようなら別に専用で稼働させるProconを用意して下さい。
Installation
- Install Insane Limits
- Setting webhook with Discord
- In the Function settings of Limit # 1, rewrite the following parts.
- Set your webhook URL. Write your webhook URL in “” of line 10
String webhookUrl = "http://"
. - When using Twitter function, change false of
bool tweet = false;
totrue
. - If you want to output map name and mode name on posting to Discord, change false of
bool mapMode = false;
totrue
- Limit #1 –
evalution: OnRoundOver, first_check: Code, limit_action: none
- Limit #2 –
evalution: OnKill, first_check: Code, limit_action: none
NOTE) If you are using Live Server Stats, please use only this “#2 Limits” to prevent round stats bugs.
NOTE) When you use the Twitter function please be sure to rewrite “MAX_STATUS_LENGTH = 140;” to 300.
NOTE) Since using Thread.Sleep, other plugins may be affected. If you have any other plugins affected please prepare Procon to run it exclusively. I am currently working on this problem. I am testing with ver 1.2
Limit #1
evalution: OnRoundOver |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
// Insane Limits - Round Result Announce for Discord(webhook) and Twitter Part 1 - 1.3 by DA-xx-V // Special thanks - phantom // // evalution: OnRoundOver // first_check: Code // limit_action: none // // Function settings ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Set your Webhook URL */ string webhookUrl = "https://"; /* Use Tweet Function. true or false */ bool tweet = false; /* Map and Mode output to webhook. true or false */ bool mapMode = false; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string map = plugin.FriendlyMapName(server.MapFileName); string mode = plugin.FriendlyModeName(server.Gamemode); int second = (int)server.TimeRound; TimeSpan ts = new TimeSpan(0, 0, second); string hms = ts.ToString(); string webhookString = null; try { if (team1.Tickets != team1.StartTickets && team2.Tickets != team2.StartTickets) { Dictionary<string, int> PHsKill = new Dictionary<string, int>(); Dictionary<string, int> TmpWeaponName = new Dictionary<string, int>(); if (plugin.RoundData.issetObject("StatsKillWeaponName")||plugin.RoundData.issetObject("StatsPossibleHSKill")) { PHsKill = (Dictionary<string,int>)plugin.RoundData.getObject("StatsPossibleHSKill"); TmpWeaponName = (Dictionary<string,int>)plugin.RoundData.getObject("StatsKillWeaponName"); List<KeyValuePair<string, int>> KillsByWeaponNameListSORTED = new List<KeyValuePair<string, int>>(); foreach (KeyValuePair<string, int> pair in TmpWeaponName) { KillsByWeaponNameListSORTED.Add(pair); } if (KillsByWeaponNameListSORTED.Count > 0) { KillsByWeaponNameListSORTED.Sort( delegate(KeyValuePair<string, int> firstPair, KeyValuePair<string, int> nextPair) { int na = TmpWeaponName[firstPair.Key]; int nb = TmpWeaponName[nextPair.Key]; if (na > nb) return -1; if (na < nb) return 0; return 0; } ); } List<PlayerInfoInterface> playersListR1 = new List<PlayerInfoInterface>(); playersListR1.AddRange(team1.players); playersListR1.AddRange(team2.players); Dictionary<string, double> ScoreByPlayerList = new Dictionary<string, double>(); List<PlayerInfoInterface> playersListR2 = new List<PlayerInfoInterface>(); playersListR2.AddRange(team1.players); playersListR2.AddRange(team2.players); Dictionary<string, double> KillsByPlayerList = new Dictionary<string, double>(); List<PlayerInfoInterface> playersListR3 = new List<PlayerInfoInterface>(); playersListR3.AddRange(team1.players); playersListR3.AddRange(team2.players); Dictionary<string, double> FaceOffPlayerList = new Dictionary<string, double>(); foreach(PlayerInfoInterface player_info in playersListR1) { if (!ScoreByPlayerList.ContainsKey(player_info.Name)) ScoreByPlayerList.Add(player_info.Name, 0); ScoreByPlayerList[player_info.Name] += player_info.ScoreRound; if (player_info.TeamId == server.WinTeamId) { if(server.Gamemode == "AirSuperiority0" || server.Gamemode == "Capturetheflag0" || server.Gamemode == "CarrierAssaultSmall0" || server.Gamemode == "CarrierAssaultLarge0" || server.Gamemode == "Chainlink0" || server.Gamemode == "Domination0" || server.Gamemode == "GunMaster0" || server.Gamemode == "SquadDeathMatch0" || server.Gamemode == "SquadObliteration0" || server.Gamemode == "TeamDeathMatch0") { ScoreByPlayerList[player_info.Name] += 200; } else if (server.Gamemode == "Elimination0") { ScoreByPlayerList[player_info.Name] += 500; } else if (server.Gamemode == "Obliteration") { ScoreByPlayerList[player_info.Name] += 2000; } else if (server.Gamemode == "ConquestSmall0" || server.Gamemode == "ConquestLarge0" || server.Gamemode == "RushLarge0") { ScoreByPlayerList[player_info.Name] += 3000; } else {} } } List<KeyValuePair<string, double>> ScoreByPlayerListSORTED = new List<KeyValuePair<string, double>>(); foreach (KeyValuePair<string, double> pair in ScoreByPlayerList) { ScoreByPlayerListSORTED.Add(pair); } if (ScoreByPlayerListSORTED.Count > 0) { ScoreByPlayerListSORTED.Sort( delegate(KeyValuePair<string, double> firstPair, KeyValuePair<string, double> nextPair) { double na = ScoreByPlayerList[firstPair.Key]; double nb = ScoreByPlayerList[nextPair.Key]; if (na > nb) return -1; if (na < nb) return 0; return 0; } ); } foreach(PlayerInfoInterface player_info in playersListR2) { if (!KillsByPlayerList.ContainsKey(player_info.Name)) KillsByPlayerList.Add(player_info.Name, 0); KillsByPlayerList[player_info.Name] += player_info.KillsRound; } List<KeyValuePair<string, double>> KillsByPlayerListSORTED = new List<KeyValuePair<string, double>>(); foreach (KeyValuePair<string, double> pair in KillsByPlayerList) { KillsByPlayerListSORTED.Add(pair); } if (KillsByPlayerListSORTED.Count > 0) { KillsByPlayerListSORTED.Sort( delegate(KeyValuePair<string, double> firstPair, KeyValuePair<string, double> nextPair) { double na = KillsByPlayerList[firstPair.Key]; double nb = KillsByPlayerList[nextPair.Key]; if (na > nb) return -1; if (na < nb) return 0; return 0; } ); } foreach(PlayerInfoInterface player_info in playersListR3) { if (!FaceOffPlayerList.ContainsKey(player_info.Name)) FaceOffPlayerList.Add(player_info.Name, 0); FaceOffPlayerList[player_info.Name] += player_info.HeadshotsRound; } List<KeyValuePair<string, double>> FaceOffPlayerListSORTED = new List<KeyValuePair<string, double>>(); foreach (KeyValuePair<string, double> pair in FaceOffPlayerList) { FaceOffPlayerListSORTED.Add(pair); } if (FaceOffPlayerListSORTED.Count > 0) { FaceOffPlayerListSORTED.Sort( delegate(KeyValuePair<string, double> firstPair, KeyValuePair<string, double> nextPair) { double na = FaceOffPlayerList[firstPair.Key]; double nb = FaceOffPlayerList[nextPair.Key]; if (na > nb) return -1; if (na < nb) return 0; return 0; } ); } string breport = ""; string regexLastReports = @"""gameReportId"":""(\d+)"",""createdAt"":(\d+),""name"":""(.*?)"""; string tmp_weaponname0 = KillsByWeaponNameListSORTED[0].Key; string tmp_weaponname1 = KillsByWeaponNameListSORTED[1].Key; string tmp_weaponname2 = KillsByWeaponNameListSORTED[2].Key; double hskr = Math.Round(FaceOffPlayerListSORTED[0].Value / PHsKill[FaceOffPlayerListSORTED[0].Key] * 100, 2, MidpointRounding.AwayFromZero); double killrate0 = Math.Round(KillsByWeaponNameListSORTED[0].Value / server.KillsRound * 100, 2, MidpointRounding.AwayFromZero); double killrate1 = Math.Round(KillsByWeaponNameListSORTED[1].Value / server.KillsRound * 100, 2, MidpointRounding.AwayFromZero); double killrate2 = Math.Round(KillsByWeaponNameListSORTED[2].Value / server.KillsRound * 100, 2, MidpointRounding.AwayFromZero); plugin.ConsoleWrite("Round Time: " + hms); plugin.ConsoleWrite("MVP: " + ScoreByPlayerListSORTED[0].Key + " " + ScoreByPlayerListSORTED[0].Value); plugin.ConsoleWrite("2nd: " + ScoreByPlayerListSORTED[1].Key + " " + ScoreByPlayerListSORTED[1].Value); plugin.ConsoleWrite("3rd: " + ScoreByPlayerListSORTED[2].Key + " " + ScoreByPlayerListSORTED[2].Value); plugin.ConsoleWrite("Killing Machine: " + KillsByPlayerListSORTED[0].Key + " " + KillsByPlayerListSORTED[0].Value + " Kills"); plugin.ConsoleWrite("Face Off: " + FaceOffPlayerListSORTED[0].Key + " " + FaceOffPlayerListSORTED[0].Value + " HeadShots HSKR: " + hskr + "%"); plugin.ConsoleWrite("--- TOP3 WEAPONS ---"); plugin.ConsoleWrite("#1: " + tmp_weaponname0 + " " + KillsByWeaponNameListSORTED[0].Value + "Kills"); plugin.ConsoleWrite("#2: " + tmp_weaponname1 + " " + KillsByWeaponNameListSORTED[1].Value + "Kills"); plugin.ConsoleWrite("#3: " + tmp_weaponname2 + " " + KillsByWeaponNameListSORTED[2].Value + "Kills"); if (tweet == true) { plugin.Tweet("Round Result\n\nPlayers: " + server.PlayerCount + " / " + server.MaxPlayers + "\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets + "\n\nMVP: " + ScoreByPlayerListSORTED[0].Key + " " + ScoreByPlayerListSORTED[0].Value + " pts.\nKilling Machine: " + KillsByPlayerListSORTED[0].Key + " " + KillsByPlayerListSORTED[0].Value + " Kills.\nFace Off: " + FaceOffPlayerListSORTED[0].Key + " " + FaceOffPlayerListSORTED[0].Value + " HeadShots. HSKR: " + hskr + "%\n\nTOP3 Weapons\n#1: " + tmp_weaponname0 + " " + KillsByWeaponNameListSORTED[0].Value + " Kills.\n#2: " + tmp_weaponname1 + " " + KillsByWeaponNameListSORTED[1].Value + " Kills.\n#3: " + tmp_weaponname2 + " " + KillsByWeaponNameListSORTED[2].Value + " Kills."); } try { WebRequest request = WebRequest.Create(webhookUrl); request.Method = "POST"; request.ContentType = "application/json"; if (mapMode == false) { webhookString = webhookString = "{\"content\": \"**```py\\n'Round Result'\\n@ " + server.Name + "\\n\\nPlayers: " + server.PlayerCount + " / " + server.MaxPlayers + "\\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets + "\\nRound Time: " + hms + "\\n\\nMVP: '" + ScoreByPlayerListSORTED[0].Key + "' " + ScoreByPlayerListSORTED[0].Value + " points.\\nSecond: '" + ScoreByPlayerListSORTED[1].Key + "' " + ScoreByPlayerListSORTED[1].Value +" points.\\nThird: '" + ScoreByPlayerListSORTED[2].Key + "' " + ScoreByPlayerListSORTED[2].Value + " points.\\n\\nKilling Machine: '" + KillsByPlayerListSORTED[0].Key + "' " + KillsByPlayerListSORTED[0].Value + " Kills." + "\\nFace Off: '" + FaceOffPlayerListSORTED[0].Key + "' " + FaceOffPlayerListSORTED[0].Value + " HeadShots. HSKR: " + hskr + "%\\n\\n@ TOP3 Weapons\\n#1: " + tmp_weaponname0 + " " + KillsByWeaponNameListSORTED[0].Value + " Kills. Rate " + killrate0 + "%\\n#2: " + tmp_weaponname1 + " " + KillsByWeaponNameListSORTED[1].Value + " Kills. Rate " + killrate1 + "%\\n#3: " + tmp_weaponname2 + " " + KillsByWeaponNameListSORTED[2].Value + " Kills. Rate " + killrate2 + "%\\n```**" + "\"}"; } else if (mapMode == true) { webhookString = webhookString = "{\"content\": \"**```py\\n'Round Result'\\n@ " + server.Name + "\\n\\nMap: '" + map + "'\\nMode: '" + mode + "'\\n\\n Players: " + server.PlayerCount + " / " + server.MaxPlayers + "\\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets + "\\nRound Time: " + hms + "\\n\\nMVP: '" + ScoreByPlayerListSORTED[0].Key + "' " + ScoreByPlayerListSORTED[0].Value + " points.\\nSecond: '" + ScoreByPlayerListSORTED[1].Key + "' " + ScoreByPlayerListSORTED[1].Value +" points.\\nThird: '" + ScoreByPlayerListSORTED[2].Key + "' " + ScoreByPlayerListSORTED[2].Value + " points.\\n\\nKilling Machine: '" + KillsByPlayerListSORTED[0].Key + "' " + KillsByPlayerListSORTED[0].Value + " Kills." + "\\nFace Off: '" + FaceOffPlayerListSORTED[0].Key + "' " + FaceOffPlayerListSORTED[0].Value + " HeadShots. HSKR: " + hskr + "%\\n\\n@ TOP3 Weapons\\n#1: " + tmp_weaponname0 + " " + KillsByWeaponNameListSORTED[0].Value + " Kills. Rate " + killrate0 + "%\\n#2: " + tmp_weaponname1 + " " + KillsByWeaponNameListSORTED[1].Value + " Kills. Rate " + killrate1 + "%\\n#3: " + tmp_weaponname2 + " " + KillsByWeaponNameListSORTED[2].Value + " Kills. Rate " + killrate2 + "%\\n```**" + "\"}"; } byte[] byteArray = Encoding.UTF8.GetBytes(webhookString); request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); } catch (Exception e) { plugin.ConsoleWrite("Error: " + e.ToString()); } Thread t = new Thread(new ThreadStart(delegate { System.Threading.Thread.Sleep(15000); using(WebClient webClient = new WebClient()) { for (int i = 0;i <= server.PlayerCount; i++) { plugin.ConsoleWrite("brPlayer " + ScoreByPlayerListSORTED[i].Key); string str = webClient.DownloadString("http://battlelog.battlefield.com/bf4/user/" + ScoreByPlayerListSORTED[i].Key +"/"); MatchCollection pid = Regex.Matches(str, @"/soldier/" + ScoreByPlayerListSORTED[i].Key + @"/stats/(\d+)(/\w*)?/", RegexOptions.IgnoreCase | RegexOptions.Singleline); string personaId = ""; foreach (Match m in pid) { if (m.Success && m.Groups[2].Value.Trim() != "/ps3" && m.Groups[2].Value.Trim() != "/xbox" && m.Groups[2].Value.Trim() != "/xbox360" && m.Groups[2].Value.Trim() != "/xboxone" && m.Groups[2].Value.Trim() != "/ps4") { personaId = m.Groups[1].Value.Trim(); } } plugin.ConsoleWrite("brPersonaId " + personaId); string result = webClient.DownloadString("http://battlelog.battlefield.com/bf4/warsawbattlereportspopulate/" + personaId + "/2048/"); Match matchLastReports = Regex.Match(result, regexLastReports); if (matchLastReports.Success) { breport = matchLastReports.Groups[1].Value; plugin.ConsoleWrite("brReportId " + breport); string breportURL = "http://battlelog.battlefield.com/bf4/battlereport/show/1/" + breport + "/"; plugin.ConsoleWrite("brReportURL " + breportURL); if (tweet == true) { plugin.Tweet("Battle Report.\n" + breportURL); } try { WebRequest request = WebRequest.Create(webhookUrl); request.Method = "POST"; request.ContentType = "application/json"; webhookString = webhookString = "{\"content\": \"" + breportURL + "\"}"; byte[] byteArray = Encoding.UTF8.GetBytes(webhookString); request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); plugin.ConsoleWrite("Post to webhook..."); } catch (Exception ee) { plugin.ConsoleWrite("Error: " + ee.ToString()); } break; } else { plugin.ConsoleWrite("failed to get Battle Report..."); } } } })); t.Start(); } } } catch (Exception eee) { plugin.ConsoleWrite("Error: " + eee.ToString()); try { WebRequest request = WebRequest.Create(webhookUrl); request.Method = "POST"; request.ContentType = "application/json"; if (mapMode == false) { webhookString = webhookString = "{\"content\": \"**```py\\n'Round Result'\\n@ " + server.Name + "\\n\\nPlayers: " + server.PlayerCount + " / " + server.MaxPlayers + "\\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets + "\\nRound Time: " + hms + "\\n```**" + "\"}"; } else if (mapMode == true) { webhookString = webhookString = "{\"content\": \"**```py\\n'Round Result'\\n@ " + server.Name + "\\n\\nMap: '" + map + "'\\nMode: '" + mode + "'\\n\\n Players: " + server.PlayerCount + " / " + server.MaxPlayers + "\\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets + "\\nRound Time: " + hms + "\\n```**" + "\"}"; } byte[] byteArray = Encoding.UTF8.GetBytes(webhookString); request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); if (tweet == true) { plugin.Tweet("Round Result\n\nPlayers: " + server.PlayerCount + " / " + server.MaxPlayers + "\nTickets: " + " US " + team1.Tickets + " - RU " + team2.Tickets); } } catch (Exception eeee) { plugin.ConsoleWrite("Error: " + eeee.ToString()); } } return false; |
Limit #2
evalution: OnKill |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
// Insane Limits - Round Result Announce for Discord(webhook) and Twitter Part 2 - 1.0 by DA-xx-V // // evalution: OnKill // first_check: Code // limit_action: none // // To "Insane Limits - Live Server Stats - Kills by Country, Clan, Weapon, ..." added count function of kill which can be headshot. // NOTE) DO NOT USE Live Server Stats LIMIT#2 as it is compatible. // https://forum.myrcon.com/showthread.php?17480-Insane-Limits-Live-Server-Stats-Kills-by-Country-Clan-Weapon // // count kill by weapon category Dictionary<string, int> TmpWeaponCat = new Dictionary<string, int>(); if (!plugin.RoundData.issetObject("StatsKillWeaponCategory")) plugin.RoundData.setObject("StatsKillWeaponCategory", new Dictionary<string, int>()); TmpWeaponCat = (Dictionary<string,int>)plugin.RoundData.getObject("StatsKillWeaponCategory"); if (!TmpWeaponCat.ContainsKey(kill.Category)) { TmpWeaponCat.Add(kill.Category, 0); } TmpWeaponCat[kill.Category] += 1; plugin.RoundData.setObject("StatsKillWeaponCategory", TmpWeaponCat); // count kill by weapon name KillReasonInterface friendly = plugin.FriendlyWeaponName(kill.Weapon); //plugin.ConsoleWrite(friendly.Name); Dictionary<string, int> TmpWeaponName = new Dictionary<string, int>(); if (!plugin.RoundData.issetObject("StatsKillWeaponName")) plugin.RoundData.setObject("StatsKillWeaponName", new Dictionary<string, int>()); TmpWeaponName = (Dictionary<string,int>)plugin.RoundData.getObject("StatsKillWeaponName"); if (!TmpWeaponName.ContainsKey(friendly.Name)) { TmpWeaponName.Add(friendly.Name, 0); } TmpWeaponName[friendly.Name] += 1; plugin.RoundData.setObject("StatsKillWeaponName", TmpWeaponName); // count possible hs kill Dictionary<string, int> PHsKill = new Dictionary<string, int>(); if (Regex.Match(kill.Weapon, @"(dlSHTR|U_Repairtool|Death)", RegexOptions.IgnoreCase).Success){ if (!plugin.RoundData.issetObject("StatsPossibleHSKill")) plugin.RoundData.setObject("StatsPossibleHSKill", new Dictionary<string, int>()); PHsKill = (Dictionary<string,int>)plugin.RoundData.getObject("StatsPossibleHSKill"); if (!PHsKill.ContainsKey(player.Name)) { PHsKill.Add(player.Name, 0); } PHsKill[player.Name] += 1; plugin.RoundData.setObject("StatsPossibleHSKill", PHsKill); } else if (Regex.Match(kill.Category, @"(Handgun|AssaultRifle|Carbine|Shotgun|LMG|SMG|DMR|SniperRifle|ProjectileExplosive|Impact|VehiclePersonal|VehicleTransport|VehicleLight|VehicleHeavy|VehicleAir|VehicleWater|VehicleStationary)", RegexOptions.IgnoreCase).Success){ if (!plugin.RoundData.issetObject("StatsPossibleHSKill")) plugin.RoundData.setObject("StatsPossibleHSKill", new Dictionary<string, int>()); PHsKill = (Dictionary<string,int>)plugin.RoundData.getObject("StatsPossibleHSKill"); if (!PHsKill.ContainsKey(player.Name)) { PHsKill.Add(player.Name, 0); } PHsKill[player.Name] += 1; plugin.RoundData.setObject("StatsPossibleHSKill", PHsKill); } |