public void OnCommandScrambleNow(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope){ bool blIsAdmin = false; CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker); if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { blIsAdmin = true; } if(blIsAdmin){ this.DebugInfoSkill("^1Admin requested a scramble now!"); this.TSLevelStartWait = DateTime.Now - this.DTLevelStart; if (this.boolLevelStart && this.boolFirstOP){ if (this.ynbEnableScrambleNow == enumBoolYesNo.Yes){ if (!this.boolscrambleActive){ if (this.ynbScrambleMessage == enumBoolYesNo.Yes){ if (this.strScrambleNowMsg != ""){ if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleNowMsg); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleNowMsg , "all"); } if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleNowMsg , "30"); } } } int i = 1; this.dicPlayerScore.Clear(); this.dicSquadScore.Clear(); this.bestSquadTeamID = 0; foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache) { double value = this.dicPlayerCache[kvp.Key].playerValue; string tag = this.dicPlayerCache[kvp.Key].tag; CPlayerScoreInf newEntry = new CPlayerScoreInf(kvp.Key, this.dicPlayerCache[kvp.Key].teamID, this.dicPlayerCache[kvp.Key].playerSquad, value, false, false, tag); this.dicPlayerScore.Add(i, newEntry); i++; } bool Sortiert; do{ Sortiert = true; for (int j = 1; j < this.dicPlayerScore.Count; j++) { if (this.dicPlayerScore[j].playerValue < this.dicPlayerScore[j+1].playerValue){ CPlayerScoreInf temp = new CPlayerScoreInf(this.dicPlayerScore[j].playerName, this.dicPlayerScore[j].teamID, this.dicPlayerScore[j].playerSquad, this.dicPlayerScore[j].playerValue, false, false, this.dicPlayerScore[j].tag); this.dicPlayerScore[j] = this.dicPlayerScore[j+1]; this.dicPlayerScore[j+1] = temp; Sortiert = false; } } } while (!Sortiert); this.boolFirstOP = false; this.boolwaitfordeath = false; this.boolscrambleActive = true; this.boolTeamsScrambled = false; this.intScrambledPlayers = 0; this.teamswitcher.Clear(); this.ExecuteCommand("procon.protected.tasks.add", "WaitScrambleTimer", "3", "1", "1", "procon.protected.plugins.call", "TrueBalancer", "StartScrambler"); //StartScrambler(); }else{ this.DebugInfoSkill("^3A scrambing has allready been requested."); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "A scrambing has allready been requested."); } { this.ExecuteCommand("procon.protected.send", "admin.say", "A scrambing has allready been requested." , "player", strSpeaker); } } }else{ this.DebugInfoSkill("^3This command is deactivated at the moment. Activate in in PRoCon."); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "This command is not activated for your server in PRoCon."); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "This command is not activated for your server in PRoCon." , "player", strSpeaker); } } } } }
public virtual void OnRoundOverPlayers(List<CPlayerInfo> lstPlayers) { foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache){ if (this.dicPlayerCache[kvp.Key].playerWL != 1 && !dicPlayerCache[kvp.Key].IsCommander && !dicPlayerCache[kvp.Key].IsSpectator) { this.dicPlayerCache[kvp.Key].tobebalanced = true; } } int i = 1; this.dicPlayerScore.Clear(); this.dicSquadScore.Clear(); this.bestSquadTeamID = 0; foreach (CPlayerInfo cpiPlayer in lstPlayers){ double value = 0; string tag = ""; if (this.dicPlayerCache.ContainsKey(cpiPlayer.SoldierName)) { value = this.dicPlayerCache[cpiPlayer.SoldierName].playerValue; tag = this.dicPlayerCache[cpiPlayer.SoldierName].tag; } CPlayerScoreInf newEntry = new CPlayerScoreInf(cpiPlayer.SoldierName, cpiPlayer.TeamID, cpiPlayer.SquadID, value, false, false, tag); this.dicPlayerScore.Add(i, newEntry); i++; } bool Sortiert; do{ Sortiert = true; for (int j = 1; j < this.dicPlayerScore.Count; j++) { if (this.dicPlayerScore[j].playerValue < this.dicPlayerScore[j+1].playerValue){ CPlayerScoreInf temp = new CPlayerScoreInf(this.dicPlayerScore[j].playerName, this.dicPlayerScore[j].teamID, this.dicPlayerScore[j].playerSquad, this.dicPlayerScore[j].playerValue, false, false, this.dicPlayerScore[j].tag); this.dicPlayerScore[j] = this.dicPlayerScore[j+1]; this.dicPlayerScore[j+1] = temp; Sortiert = false; } } } while (!Sortiert); // bool Sortiert; // do{ // Sortiert = true; // for (int j = 1; j < this.dicPlayerScore.Count; j++) { // if (this.dicPlayerScore[j].playerScore < this.dicPlayerScore[j+1].playerScore){ // CPlayerScoreInf temp = new CPlayerScoreInf(this.dicPlayerScore[j].playerName, this.dicPlayerScore[j].teamID, this.dicPlayerScore[j].playerSquad, this.dicPlayerScore[j].playerScore, false, false); // this.dicPlayerScore[j] = this.dicPlayerScore[j+1]; // this.dicPlayerScore[j+1] = temp; // Sortiert = false; // } // } // } while (!Sortiert); }