ImportBot Posted July 13, 2014 Author Share Posted July 13, 2014 Originally Posted by EBassie*: Oh, wtf did I do? Looks like I edited your posted instead of replying. Sigh. Here is the new code second_check code again: OK, running this version now Server blazed due to a DDOS on my GSP... will take a while for me to report back the result. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 14, 2014 Author Share Posted July 14, 2014 Originally Posted by Blaze2014*: Hey papa here is the link:showthread....a-(07-02-2012)* Blaze * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 14, 2014 Author Share Posted July 14, 2014 Originally Posted by EBassie*: @PC9: version R7 seems to be stable and not crashing the layer any more. Thank you and well done * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 14, 2014 Author Share Posted July 14, 2014 Originally Posted by ixnorp*: will try it later when server is full. thanks! worked just fine! no crash on layer. thanks! PC9 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 15, 2014 Author Share Posted July 15, 2014 Originally Posted by trans-am*: Here is the new second_check code again: Code: /* VERSION 0.9.15/R7 BEARTRAP */ double percent = 25; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 16; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 50; // CUSTOMIZE: minimum ticket gap between winning and losing teams String kCamp = "votecamp"; String kOncePrefix = "votecamp_once_"; String kVoteTime = "votecamp_time"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); } catch (Exception e) {} String msg = "empty"; Action<String> ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match campMatch = Regex.Match(player.LastChat, @"^\s*!vote\s*nuke", RegexOptions.IgnoreCase); /* Bail out if not a proper vote */ if (!campMatch.Success) return false; /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) < minTicketPercent || server.RemainTicketsPercent(2) < minTicketPercent) { msg = "Round too close to ending to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); if (Math.Abs(t1 - t2) < minTicketGap) { msg = "Ticket counts too close to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if voter is not on the losing team */ int losing = (t1 < t2) _ 1 : 2; if (player.TeamId != losing) { msg = "You are not on the losing team!"; ChatPlayer(player.Name); return false; } /* Bail out if this team already completed a vote camp this round */ String key = kOncePrefix + losing; if (server.RoundData.issetBool(key)) { msg = "Your team already completed a votenuke this round!"; ChatPlayer(player.Name); return false; } /* Bail out if not enough players to enable vote */ if (server.PlayerCount < minPlayers) { msg = "Not enough players to hold a vote!"; ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kCamp)) player.RoundData.setBool(kCamp, true); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + player.FullName + " voted to stop camping"); msg = "You voted to stop the other team from camping your deployment"; ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; List<PlayerInfoInterface> losers = (losing == 1) _ team1.players : team2.players; /* Bail out if too much time has past */ if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 10); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote once per round */ server.RoundData.setBool(key, true); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kCamp)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n loser votes = " + votes + " of " + losers.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n needed = " + needed); String campers = (losing == 1) _ "RU" : "US"; // BF3 String voters = (losing == 1) _ "US" : "RU"; // BF3 if (server.GameVersion == "BF4") { String[] factionNames = new String[]{"US", "RU", "CN"}; int f1 = (team1.Faction == -1 || team1.Faction > 2) _ 0 : team1.Faction; int f2 = (team2.Faction == -1 || team2.Faction > 2) _ 1 : team2.Faction; campers = (losing == 1) _ factionNames[f2] : factionNames[f1]; voters = (losing == 1) _ factionNames[f1] : factionNames[f2]; } if (remain > 0) { msg = remain + " " + voters + " votes needed to NUKE " + campers + " team! " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left to vote!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 8); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + msg); return false; } /* Punish the campers */ String amsg = "Vote succeeded: " + campers + " team is being nuked for camping your deployment! Break out now!"; if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + amsg); msg = "Vote succeeded: {0} seconds to nuke of " + campers + " team!"; //plugin.SendTeamMessage(losing, msg); plugin.SendGlobalYell("Vote succeeded: 5 seconds to nuke of " + campers + " team!", 15); List<PlayerInfoInterface> bad = new List<PlayerInfoInterface>(); bad.AddRange((losing == 1) _ team2.players : team1.players); if (server.RoundData.issetBool("BEARTRAP")) { if (level >= 2) plugin.ConsoleWarn("There is a timer thread that is already active! Aborting ..."); return false; } Thread nuker = new Thread(new ThreadStart(delegate { try { server.RoundData.setBool("BEARTRAP", true); /* Losing team only gets to do this once */ server.RoundData.setBool(key, true); int rsecs = 5; while (rsecs > 0) { plugin.SendGlobalMessage(String.Format(msg, rsecs)); plugin.PRoConChat(String.Format(msg, rsecs)); --rsecs; Thread.Sleep(1*1000); } plugin.SendTeamMessage(losing, amsg); plugin.SendTeamYell(losing, amsg, 15); foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); Thread.Sleep(200); } } catch (Exception e) { plugin.ConsoleException(e.ToString()); } finally { if (server.RoundData.issetBool("BEARTRAP")) server.RoundData.unsetBool("BEARTRAP"); } })); nuker.Name = "Nuker"; nuker.Start(); return false; What should be change that losing team can use twice per round? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 15, 2014 Author Share Posted July 15, 2014 Originally Posted by PapaCharlie9*: What should be change that losing team can use twice per round?As I explained in post #185, changing the vote flag to a counter is complicated, adding a cool down even more so. I know you didn't ask for a cooldown, but it's pretty much a requirement also, right? Or else one team could nuke the other twice in succession to do more than break out of deployment, they could swing the game into a rout. I could remove the flag so that teams could do any number of nukes to each other, that's easy. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 19, 2014 Author Share Posted July 19, 2014 Originally Posted by Beastman*: hi PapaCharlie9 Im useing this code , But when the end of the countdown there are no any effect Code: /* VERSION 0.9.15/R6 */ double percent = 2; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 1; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 100; // CUSTOMIZE: minimum ticket gap between winning and losing teams String kCamp = "votecamp"; String kOncePrefix = "votecamp_once_"; String kVoteTime = "votecamp_time"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); } catch (Exception e) {} String msg = "empty"; Action<String> ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match campMatch = Regex.Match(player.LastChat, @"^\s*!vote\s*nuke", RegexOptions.IgnoreCase); /* Bail out if not a proper vote */ if (!campMatch.Success) return false; /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) < minTicketPercent || server.RemainTicketsPercent(2) < minTicketPercent) { msg = "Round too close to ending to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); if (Math.Abs(t1 - t2) < minTicketGap) { msg = "Ticket counts too close to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if voter is not on the losing team */ int losing = (t1 < t2) _ 1 : 2; if (player.TeamId != losing) { msg = "You are not on the losing team!"; ChatPlayer(player.Name); return false; } /* Bail out if this team already completed a vote camp this round */ String key = kOncePrefix + losing; if (server.RoundData.issetBool(key)) { msg = "Your team already completed a vote camp this round!"; ChatPlayer(player.Name); return false; } /* Bail out if not enough players to enable vote */ if (server.PlayerCount < minPlayers) { msg = "Not enough players to hold a vote!"; ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kCamp)) player.RoundData.setBool(kCamp, true); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + player.FullName + " voted to stop camping"); msg = "You voted to stop the other team from camping your deployment"; ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; List<PlayerInfoInterface> losers = (losing == 1) _ team1.players : team2.players; /* Bail out if too much time has past */ if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 10); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote once per round */ server.RoundData.setBool(key, true); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kCamp)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n loser votes = " + votes + " of " + losers.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n needed = " + needed); String campers = (losing == 1) _ "RU" : "US"; // BF3 String voters = (losing == 1) _ "US" : "RU"; // BF3 if (server.GameVersion == "BF4") { String[] factionNames = new String[]{"US", "RU", "CN"}; int f1 = (team1.Faction == -1 || team1.Faction > 2) _ 0 : team1.Faction; int f2 = (team2.Faction == -1 || team2.Faction > 2) _ 1 : team2.Faction; campers = (losing == 1) _ factionNames[f2] : factionNames[f1]; voters = (losing == 1) _ factionNames[f1] : factionNames[f2]; } if (remain > 0) { msg = remain + " " + voters + " votes needed to punish " + campers + " team! " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left to vote!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 8); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + msg); return false; } /* Punish the campers */ String amsg = "Vote succeeded: " + campers + " team is being nuked for camping your deployment! Break out now!"; if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + amsg); msg = "Vote succeeded: {0} seconds to nuke of " + campers + " team!"; //plugin.SendTeamMessage(losing, msg); plugin.SendGlobalYell("Vote succeeded: 10 seconds to nuke of " + campers + " team!", 15); List<PlayerInfoInterface> bad = (losing == 1) _ team2.players : team1.players; Thread nuker = new Thread(new ThreadStart(delegate { int rsecs = 10; while (rsecs > 0) { plugin.SendGlobalMessage(String.Format(msg, rsecs)); --rsecs; Thread.Sleep(1*1000); } plugin.SendTeamMessage(losing, amsg); plugin.SendTeamYell(losing, amsg, 15); foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name, 1); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); } /* Losing team only gets to do this once */ server.RoundData.setBool(key, true); })); nuker.Name = "Nuker"; nuker.Start(); 1.JPG2.jpg * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 19, 2014 Author Share Posted July 19, 2014 Originally Posted by PapaCharlie9*: hi PapaCharlie9 Im useing this code , But when the end of the countdown there are no any effect Code: /* VERSION 0.9.15/R6 */ double percent = 2; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 1; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 100; // CUSTOMIZE: minimum ticket gap between winning and losing teams String kCamp = "votecamp"; String kOncePrefix = "votecamp_once_"; String kVoteTime = "votecamp_time"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); } catch (Exception e) {} String msg = "empty"; Action<String> ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match campMatch = Regex.Match(player.LastChat, @"^\s*!vote\s*nuke", RegexOptions.IgnoreCase); /* Bail out if not a proper vote */ if (!campMatch.Success) return false; /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) < minTicketPercent || server.RemainTicketsPercent(2) < minTicketPercent) { msg = "Round too close to ending to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); if (Math.Abs(t1 - t2) < minTicketGap) { msg = "Ticket counts too close to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if voter is not on the losing team */ int losing = (t1 < t2) _ 1 : 2; if (player.TeamId != losing) { msg = "You are not on the losing team!"; ChatPlayer(player.Name); return false; } /* Bail out if this team already completed a vote camp this round */ String key = kOncePrefix + losing; if (server.RoundData.issetBool(key)) { msg = "Your team already completed a vote camp this round!"; ChatPlayer(player.Name); return false; } /* Bail out if not enough players to enable vote */ if (server.PlayerCount < minPlayers) { msg = "Not enough players to hold a vote!"; ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kCamp)) player.RoundData.setBool(kCamp, true); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + player.FullName + " voted to stop camping"); msg = "You voted to stop the other team from camping your deployment"; ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; List<PlayerInfoInterface> losers = (losing == 1) _ team1.players : team2.players; /* Bail out if too much time has past */ if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 10); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote once per round */ server.RoundData.setBool(key, true); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kCamp)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n loser votes = " + votes + " of " + losers.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n needed = " + needed); String campers = (losing == 1) _ "RU" : "US"; // BF3 String voters = (losing == 1) _ "US" : "RU"; // BF3 if (server.GameVersion == "BF4") { String[] factionNames = new String[]{"US", "RU", "CN"}; int f1 = (team1.Faction == -1 || team1.Faction > 2) _ 0 : team1.Faction; int f2 = (team2.Faction == -1 || team2.Faction > 2) _ 1 : team2.Faction; campers = (losing == 1) _ factionNames[f2] : factionNames[f1]; voters = (losing == 1) _ factionNames[f1] : factionNames[f2]; } if (remain > 0) { msg = remain + " " + voters + " votes needed to punish " + campers + " team! " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left to vote!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 8); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + msg); return false; } /* Punish the campers */ String amsg = "Vote succeeded: " + campers + " team is being nuked for camping your deployment! Break out now!"; if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + amsg); msg = "Vote succeeded: {0} seconds to nuke of " + campers + " team!"; //plugin.SendTeamMessage(losing, msg); plugin.SendGlobalYell("Vote succeeded: 10 seconds to nuke of " + campers + " team!", 15); List<PlayerInfoInterface> bad = (losing == 1) _ team2.players : team1.players; Thread nuker = new Thread(new ThreadStart(delegate { int rsecs = 10; while (rsecs > 0) { plugin.SendGlobalMessage(String.Format(msg, rsecs)); --rsecs; Thread.Sleep(1*1000); } plugin.SendTeamMessage(losing, amsg); plugin.SendTeamYell(losing, amsg, 15); foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name, 1); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); } /* Losing team only gets to do this once */ server.RoundData.setBool(key, true); })); nuker.Name = "Nuker"; nuker.Start(); 1.JPG2.jpg You should read more posts in this thread. There is a problem with that version. Find the version that is correct, it is posted in this thread. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 19, 2014 Author Share Posted July 19, 2014 Originally Posted by EBassie*: You should read more posts in this thread. There is a problem with that version. Find the version that is correct, it is posted in this thread.This one works:myrcon.net/...insane-limits-v09r6-vote-to-nuke-campingbase-raping-team-or-surrender#entry29037 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by Beastman*: You should read more posts in this thread. There is a problem with that version. Find the version that is correct, it is posted in this thread.Im useing insane-limits-0.9.16.0 , but the code VERSION 0.9.15/R6 , where can download insane-limits-0.9.15 ? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by EBassie*: Im useing insane-limits-0.9.16.0 , but the code VERSION 0.9.15/R6 , where can download insane-limits-0.9.15 ?Just use the code in this post:myrcon.net/...insane-limits-v09r6-vote-to-nuke-campingbase-raping-team-or-surrender#entry29037 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by Beastman*: Just use the code in this post: myrcon.net/...insane-limits-v09r6-vote-to-nuke-campingbase-raping-team-or-surrender#entry29037 I mean where can download plugin insane-limits-VERSION 0.9.15 , not code * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by EBassie*: I mean where can download plugin insane-limits-VERSION 0.9.15 , not codeYou are using the latest version, why would you downgrade? That's not needed. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by PapaCharlie9*: This one works: myrcon.net/...insane-limits-v09r6-vote-to-nuke-campingbase-raping-team-or-surrender#entry29037 Just because your servers haven't crashed or blazed doesn't mean you should be so helpful! * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by PapaCharlie9*: I mean where can download plugin insane-limits-VERSION 0.9.15 , not codeFor a limit, always use the same version OR HIGHER. OR GREATER. OR LARGER. (For Google Translation cases, its always good to be redundant. That increases the chance that one of the translations will be understandable -- I'm not kidding, this is simple information theory). So using Insane Limits 9.16 is good, will work, is the right version, if you have a limit for 9.15, or 9.12, or 8.0. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 20, 2014 Author Share Posted July 20, 2014 Originally Posted by EBassie*: Just because your servers haven't crashed or blazed doesn't mean you should be so helpful! LOL, sorry PC9 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 21, 2014 Author Share Posted July 21, 2014 Originally Posted by Beastman*: For a limit, always use the same version OR HIGHER. OR GREATER. OR LARGER. (For Google Translation cases, its always good to be redundant. That increases the chance that one of the translations will be understandable -- I'm not kidding, this is simple information theory). So using Insane Limits 9.16 is good, will work, is the right version, if you have a limit for 9.15, or 9.12, or 8.0. alright , thx * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted July 24, 2014 Author Share Posted July 24, 2014 Originally Posted by Beastman*: I want to delay attacker respawn time when !votenuke succeeded , how to set it ? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 7, 2014 Author Share Posted August 7, 2014 Originally Posted by w262035635*: Code: int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote1."losing team" Can Use 2 time VOTENUKE2.Team only need 5 people agree. The plugin will perform a NUKE I found a terrible mistake: When the losing team Start vote,If in the next time. There are ten people agree Because I set the countdown. I see when more than 10 people agree In a short period of time,Will be launched Nuke twice. This is a terrible result So, after each vote successfully can make a nuclear bomb Takes 10 minutes to cool. To use setup again Is this possible? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 11, 2014 Author Share Posted August 11, 2014 Originally Posted by Beastman*: Code: int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote1."losing team" Can Use 2 time VOTENUKE2.Team only need 5 people agree. The plugin will perform a NUKE I found a terrible mistake: When the losing team Start vote,If in the next time. There are ten people agree Because I set the countdown. I see when more than 10 people agree In a short period of time,Will be launched Nuke twice. This is a terrible result So, after each vote successfully can make a nuclear bomb Takes 10 minutes to cool. To use setup again Is this possible? how to set one votenuke success = two or three times nuke ? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 12, 2014 Author Share Posted August 12, 2014 Originally Posted by PapaCharlie9*: how to set one votenuke success = two or three times nuke ?I know the thread is long, but some of these requests have already been made and answered. Please do a thread search before asking. Here is the previous answer: myrcon.net/...insane-limits-v09r6-vote-to-nuke-campingbase-raping-team-or-surrender#entry28996 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 12, 2014 Author Share Posted August 12, 2014 Originally Posted by PapaCharlie9*: Code: int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote1."losing team" Can Use 2 time VOTENUKE2.Team only need 5 people agree. The plugin will perform a NUKE I found a terrible mistake: When the losing team Start vote,If in the next time. There are ten people agree Because I set the countdown. I see when more than 10 people agree In a short period of time,Will be launched Nuke twice. This is a terrible result So, after each vote successfully can make a nuclear bomb Takes 10 minutes to cool. To use setup again Is this possible? A simpler change is to set maxVotes to 1. Problem solved. A cooldown timer between votes would be possible (the previously discussed cooldown between 2 nukes after a single successful vote is a different story, that's much more difficult). I don't have time to write it now, but maybe this weekend. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 12, 2014 Author Share Posted August 12, 2014 Originally Posted by w262035635*: A simpler change is to set maxVotes to 1. Problem solved. A cooldown timer between votes would be possible (the previously discussed cooldown between 2 nukes after a single successful vote is a different story, that's much more difficult). I don't have time to write it now, but maybe this weekend. Okay. I will wait for.. Because of maxVotes = 1. Cannot completely solve the base rape. And thank you very much for your reply * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 22, 2014 Author Share Posted August 22, 2014 Originally Posted by Beastman*: It depends on what you mean. Do you mean kill each player twice immediately? Kill PapaCharlieNiner Kill PapaCharlieNiner (before he even gets a chance to spawn_) Or do you mean kill all players, wait a certain amount of time, then kill them all again? One of the problems is that the nuking is done one player at a time, and each kill takes time. So on a full server with 32 players on a team, by the time the last player is killed, the first one might have respawned. In that case, killing each player immediately, with no delay, is fine. The fewer the players, though, the more likely that the second kill will happen before the player has a chance to spawn, which is just a waste since it doesn't do anything useful. The easiest thing to do is to wait until the player tries to spawn again and then kill them again. That's what the code below does. In second_check of the code in post #1 or post #101, find this code: Code: List<PlayerInfoInterface> bad = (losing == 1) _ team2.players : team1.players; foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name, 1); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); }Change it to this: Code: List<PlayerInfoInterface> bad = (losing == 1) _ team2.players : team1.players; foreach (PlayerInfoInterface nuke in bad) { nuke.RoundData.setBool("NUKE TWICE", true); plugin.KillPlayer(nuke.Name, 1); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); }Now, create a new limit to evaluate OnSpawn, call it "Second Nuke". Set first_check to this Code: Code: int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); } catch (Exception e) {} if (player.RoundData.issetBool("NUKE TWICE")) { player.RoundData.unsetBool("NUKE TWICE"); plugin.SendPlayerMessage(player.Name, "You will be ADMIN KILLED one more time, then you can spawn again!"); plugin.KillPlayer(player.Name, 5); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n SECOND killing of " + player.FullName); } return false; Have to trouble you again , how to change this to thrice? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 25, 2014 Author Share Posted August 25, 2014 Originally Posted by avengedthedead*: Hello Papa, If i were to add together both !votenuke (with countdown series) and !votecancel commands. Are the codes below correct? Can you check for me? Thank you. /* VERSION 0.9.15/R7 BEARTRAP */ double percent = 20; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 16; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 20; // CUSTOMIZE: minimum ticket gap between winning and losing teams int maxAttempts = 2; // CUSTOMIZE: maximum number of attempts String kCamp = "votenuke"; String kOncePrefix = "votenuke_once_"; String kVoteTime = "votenuke_time"; String kAttemptsPrefix = "votenuke_attempts_"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_le vel")); } catch (Exception e) {} String msg = "empty"; Action ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match campMatch = Regex.Match(player.LastChat, @"^\s*!vote\s*nuke", RegexOptions.IgnoreCase); Match yesMatch = Regex.Match(player.LastChat, @"^\s*!yes", RegexOptions.IgnoreCase); Match cancelMatch = Regex.Match(player.LastChat, @"^\s*!cancelvote", RegexOptions.IgnoreCase); /* Check for admin cancel */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); int losing = (t1 List losers = (losing == 1) ? team1.players : team2.players; String keyAttempts = kAttemptsPrefix + losing; int attempts = 0; if (cancelMatch.Success) { bool canKill = false; bool canKick = false; bool canBan = false; bool canMove = false; bool canChangeLevel = false; if (plugin.CheckAccount(player.Name, out canKill, out canKick, out canBan, out canMove, out canChangeLevel)) { if (canKick) { plugin.SendGlobalMessage("votenuke has been cancelled!"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote maxAttempts */ attempts = 0; if (server.RoundData.issetInt(keyAttempts)) attempts = server.RoundData.getInt(keyAttempts); server.RoundData.setInt(keyAttempts, attempts + 1); } else { ChatPlayer("You are not authorized to use this command"); } } else { ChatPlayer("Nice try, but only admins can use that command"); } return false; } /* Bail out if not a proper vote */ if (!campMatch.Success && !yesMatch.Success) return false; /* Bail out if this player already voted */ if (player.RoundData.issetBool(kCamp)) { msg = "You already voted on this votenuke attempt!"; ChatPlayer(player.Name); return false; } /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) msg = "Round too close to ending to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ if (Math.Abs(t1 - t2) msg = "Ticket counts too close to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if voter is not on the losing team */ if (player.TeamId != losing) { msg = "You are not on the losing team!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if this team already completed a vote camp this round */ String key = kOncePrefix + losing; if (server.RoundData.issetBool(key)) { msg = "Your team already completed a nuke vote this round!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if maxAttempts made */ if (server.RoundData.issetInt(keyAttempts)) { attempts = server.RoundData.getInt(keyAttempts); if (attempts >= maxAttempts) { msg = "Your team already made " + maxAttempts + " attempts at nuking this round!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } } /* Bail out if not enough players to enable vote */ if (server.PlayerCount msg = "Not enough players to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kCamp)) player.RoundData.setBool(kCamp, true); if (level >= 2) plugin.ConsoleWrite("^b[VoteNuke]^n " + player.FullName + " voted to nuke baserapers"); msg = "You voted to nuke the other team camping your base"; if (!yesMatch.Success) ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; /* Start timer if a valid command */ if (!server.RoundData.issetObject(kVoteTime)) { if (yesMatch.Success) { return false; } server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteNuke]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); /* Bail out if too much time has past */ if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 10); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote maxAttempts */ attempts = 0; if (server.RoundData.issetInt(keyAttempts)) attempts = server.RoundData.getInt(keyAttempts); server.RoundData.setInt(keyAttempts, attempts + 1); return false; } /* Losing team only gets to try this vote once per round */ server.RoundData.setBool(key, true); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kCamp)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n loser votes = " + votes + " of " + losers.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n needed = " + needed); String campers = (losing == 1) ? "RU" : "US"; // BF3 String voters = (losing == 1) ? "US" : "RU"; // BF3 if (server.GameVersion == "BF4") { String[] factionNames = new String[]{"US", "RU", "CN"}; int f1 = (team1.Faction == -1 || team1.Faction > 2) ? 0 : team1.Faction; int f2 = (team2.Faction == -1 || team2.Faction > 2) ? 1 : team2.Faction; campers = (losing == 1) ? factionNames[f2] : factionNames[f1]; voters = (losing == 1) ? factionNames[f1] : factionNames[f2]; } if (remain > 0) { msg = remain + " " + voters + " votes needed to NUKE " + campers + " team! " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left to vote!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 8); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + msg); return false; } /* Punish the campers */ String amsg = "Vote succeeded: " + campers + " team is being nuked for camping your deployment! Break out now!"; if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + amsg); msg = "Vote succeeded: {0} seconds to nuke of " + campers + " team!"; //plugin.SendTeamMessage(losing, msg); plugin.SendGlobalYell("Vote succeeded: 5 seconds to nuke of " + campers + " team!", 15); List bad = new List(); bad.AddRange((losing == 1) ? team2.players : team1.players); if (server.RoundData.issetBool("BEARTRAP")) { if (level >= 2) plugin.ConsoleWarn("There is a timer thread that is already active! Aborting ..."); return false; } Thread nuker = new Thread(new ThreadStart(delegate { try { server.RoundData.setBool("BEARTRAP", true); /* Losing team only gets to do this once */ server.RoundData.setBool(key, true); int rsecs = 5; while (rsecs > 0) { plugin.SendGlobalMessage(String.Format(msg, rsecs)); plugin.PRoConChat(String.Format(msg, rsecs)); --rsecs; Thread.Sleep(1*1000); } plugin.SendTeamMessage(losing, amsg); plugin.SendTeamYell(losing, amsg, 15); foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); Thread.Sleep(200); } } catch (Exception e) { plugin.ConsoleException(e.ToString()); } finally { if (server.RoundData.issetBool("BEARTRAP")) server.RoundData.unsetBool("BEARTRAP"); } })); nuker.Name = "Nuker"; nuker.Start(); return false; * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 25, 2014 Author Share Posted August 25, 2014 Originally Posted by PapaCharlie9*: Too hard to read. Can you post again, but this time put the code in ... markup? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted August 26, 2014 Author Share Posted August 26, 2014 Originally Posted by avengedthedead*: Too hard to read. Can you post again, but this time put the code in ... markup?I'm really noob and its just opy and paste between two limits (!votenuke (with countdown series) and !votecancel commands)). Im so sure there's alot of mistakes and error. Gosh so embarrassing..... /* VERSION 0.9.15/R7 BEARTRAP */ double percent = 20; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 16; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 20; // CUSTOMIZE: minimum ticket gap between winning and losing teams int maxAttempts = 2; // CUSTOMIZE: maximum number of attempts String kCamp = "votenuke"; String kOncePrefix = "votenuke_once_"; String kVoteTime = "votenuke_time"; String kAttemptsPrefix = "votenuke_attempts_"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_le vel")); } catch (Exception e) {} String msg = "empty"; Action ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match campMatch = Regex.Match(player.LastChat, @"^\s*!vote\s*nuke", RegexOptions.IgnoreCase); Match yesMatch = Regex.Match(player.LastChat, @"^\s*!yes", RegexOptions.IgnoreCase); Match cancelMatch = Regex.Match(player.LastChat, @"^\s*!cancelvote", RegexOptions.IgnoreCase); /* Check for admin cancel */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); int losing = (t1 List losers = (losing == 1) ? team1.players : team2.players; String keyAttempts = kAttemptsPrefix + losing; int attempts = 0; if (cancelMatch.Success) { bool canKill = false; bool canKick = false; bool canBan = false; bool canMove = false; bool canChangeLevel = false; if (plugin.CheckAccount(player.Name, out canKill, out canKick, out canBan, out canMove, out canChangeLevel)) { if (canKick) { plugin.SendGlobalMessage("votenuke has been cancelled!"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote maxAttempts */ attempts = 0; if (server.RoundData.issetInt(keyAttempts)) attempts = server.RoundData.getInt(keyAttempts); server.RoundData.setInt(keyAttempts, attempts + 1); } else { ChatPlayer("You are not authorized to use this command"); } } else { ChatPlayer("Nice try, but only admins can use that command"); } return false; } /* Bail out if not a proper vote */ if (!campMatch.Success && !yesMatch.Success) return false; /* Bail out if this player already voted */ if (player.RoundData.issetBool(kCamp)) { msg = "You already voted on this votenuke attempt!"; ChatPlayer(player.Name); return false; } /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) msg = "Round too close to ending to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ if (Math.Abs(t1 - t2) msg = "Ticket counts too close to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if voter is not on the losing team */ if (player.TeamId != losing) { msg = "You are not on the losing team!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if this team already completed a vote camp this round */ String key = kOncePrefix + losing; if (server.RoundData.issetBool(key)) { msg = "Your team already completed a nuke vote this round!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Bail out if maxAttempts made */ if (server.RoundData.issetInt(keyAttempts)) { attempts = server.RoundData.getInt(keyAttempts); if (attempts >= maxAttempts) { msg = "Your team already made " + maxAttempts + " attempts at nuking this round!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } } /* Bail out if not enough players to enable vote */ if (server.PlayerCount msg = "Not enough players to hold a nuke vote!"; if (!yesMatch.Success) ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kCamp)) player.RoundData.setBool(kCamp, true); if (level >= 2) plugin.ConsoleWrite("^b[VoteNuke]^n " + player.FullName + " voted to nuke baserapers"); msg = "You voted to nuke the other team camping your base"; if (!yesMatch.Success) ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; /* Start timer if a valid command */ if (!server.RoundData.issetObject(kVoteTime)) { if (yesMatch.Success) { return false; } server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteNuke]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); /* Bail out if too much time has past */ if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timer started"); } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 10); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kCamp)) can.RoundData.unsetBool(kCamp); } server.RoundData.unsetObject(kVoteTime); /* Losing team only gets to try this vote maxAttempts */ attempts = 0; if (server.RoundData.issetInt(keyAttempts)) attempts = server.RoundData.getInt(keyAttempts); server.RoundData.setInt(keyAttempts, attempts + 1); return false; } /* Losing team only gets to try this vote once per round */ server.RoundData.setBool(key, true); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kCamp)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n loser votes = " + votes + " of " + losers.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n needed = " + needed); String campers = (losing == 1) ? "RU" : "US"; // BF3 String voters = (losing == 1) ? "US" : "RU"; // BF3 if (server.GameVersion == "BF4") { String[] factionNames = new String[]{"US", "RU", "CN"}; int f1 = (team1.Faction == -1 || team1.Faction > 2) ? 0 : team1.Faction; int f2 = (team2.Faction == -1 || team2.Faction > 2) ? 1 : team2.Faction; campers = (losing == 1) ? factionNames[f2] : factionNames[f1]; voters = (losing == 1) ? factionNames[f1] : factionNames[f2]; } if (remain > 0) { msg = remain + " " + voters + " votes needed to NUKE " + campers + " team! " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left to vote!"; plugin.SendGlobalMessage(msg); plugin.SendGlobalYell(msg, 8); if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + msg); return false; } /* Punish the campers */ String amsg = "Vote succeeded: " + campers + " team is being nuked for camping your deployment! Break out now!"; if (level >= 2) plugin.ConsoleWrite("^b[VoteCamp]^n " + amsg); msg = "Vote succeeded: {0} seconds to nuke of " + campers + " team!"; //plugin.SendTeamMessage(losing, msg); plugin.SendGlobalYell("Vote succeeded: 5 seconds to nuke of " + campers + " team!", 15); List bad = new List(); bad.AddRange((losing == 1) ? team2.players : team1.players); if (server.RoundData.issetBool("BEARTRAP")) { if (level >= 2) plugin.ConsoleWarn("There is a timer thread that is already active! Aborting ..."); return false; } Thread nuker = new Thread(new ThreadStart(delegate { try { server.RoundData.setBool("BEARTRAP", true); /* Losing team only gets to do this once */ server.RoundData.setBool(key, true); int rsecs = 5; while (rsecs > 0) { plugin.SendGlobalMessage(String.Format(msg, rsecs)); plugin.PRoConChat(String.Format(msg, rsecs)); --rsecs; Thread.Sleep(1*1000); } plugin.SendTeamMessage(losing, amsg); plugin.SendTeamYell(losing, amsg, 15); foreach (PlayerInfoInterface nuke in bad) { plugin.KillPlayer(nuke.Name); if (level >= 3) plugin.ConsoleWrite("^b[VoteCamp]^n killing " + nuke.FullName); Thread.Sleep(200); } } catch (Exception e) { plugin.ConsoleException(e.ToString()); } finally { if (server.RoundData.issetBool("BEARTRAP")) server.RoundData.unsetBool("BEARTRAP"); } })); nuker.Name = "Nuker"; nuker.Start(); return false; * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted October 28, 2014 Author Share Posted October 28, 2014 Originally Posted by xFaNtASyGiRLx*: hi, please help me edit my plugin since noobs are abusing !surrender when its 2800 vs 2400 - 3200 server. ty! i want them to at least make an effort! Code: /* VERSION 0.8/R7 - surrender */ if (server.PlayerCount < 50) return false; double percent = 20; // CUSTOMIZE: of losing team that has to vote double timeout = 5.0; // CUSTOMIZE: number of minutes before vote times out int minPlayers = 16; // CUSTOMIZE: minimum players to enable vote double minTicketPercent = 10; // CUSTOMIZE: minimum ticket percentage remaining in the round double minTicketGap = 50; // CUSTOMIZE: minimum ticket gap between winning and losing teams String kNext = "votenext"; String kVoteTime = "votenext_time"; String kNeeded = "votenext_needed"; int level = 2; try { level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); } catch (Exception e) {} String msg = "empty"; Action<String> ChatPlayer = delegate(String name) { // closure bound to String msg plugin.ServerCommand("admin.say", msg, "player", name); plugin.PRoConChat("ADMIN to " + name + " > *** " + msg); }; /* Parse the command */ Match nextMatch = Regex.Match(player.LastChat, @"^\s*[@!](_:surrender|vote\s*next)", RegexOptions.IgnoreCase); /* Bail out if not a proper vote */ if (!nextMatch.Success) return false; /* Bail out if round about to end */ if (server.RemainTicketsPercent(1) < minTicketPercent || server.RemainTicketsPercent(2) < minTicketPercent) { msg = "Round too close to ending to hold a vote!"; ChatPlayer(player.Name); return false; } /* Bail out if ticket ratio isn't large enough */ double t1 = server.RemainTickets(1); double t2 = server.RemainTickets(2); if (Math.Abs(t1 - t2) < minTicketGap) { msg = "Ticket counts too close to hold a vote!"; ChatPlayer(player.Name); return false; } /* Determine losing team by tickets */ int losing = (t1 < t2) _ 1 : 2; /* Bail out if not enough players to enable vote */ if (server.PlayerCount < minPlayers) { msg = "Not enough players to hold a vote!"; ChatPlayer(player.Name); return false; } /* Count the vote in the voter's dictionary */ /* Votes are kept with the voter */ /* If the voter leaves, his votes are not counted */ if (!player.RoundData.issetBool(kNext)) { player.RoundData.setBool(kNext, true); } else { msg = "You already voted!"; ChatPlayer(player.Name); return false; } if (level >= 2) plugin.ConsoleWrite("^b[VoteNext]^n " + player.FullName + " voted to end the round"); msg = "You voted to end this round and start the next round!"; ChatPlayer(player.Name); /* Tally the votes */ int votes = 0; List<PlayerInfoInterface> losers = (losing == 1) _ team1.players : team2.players; List<PlayerInfoInterface> winners = (losing == 1) _ team2.players : team1.players; /* Bail out if too much time has past */ bool firstTime = false; if (!server.RoundData.issetObject(kVoteTime)) { server.RoundData.setObject(kVoteTime, DateTime.Now); if (level >= 2) plugin.ConsoleWrite("^b[VoteNext]^n vote timer started"); firstTime = true; } DateTime started = (DateTime)server.RoundData.getObject(kVoteTime); TimeSpan since = DateTime.Now.Subtract(started); if (since.TotalMinutes > timeout) { msg = "The voting time has expired, the vote is cancelled!"; plugin.SendGlobalMessage(msg); plugin.ServerCommand("admin.yell", msg); if (level >= 2) plugin.ConsoleWrite("^b[VoteNext]^n vote timeout expired"); foreach (PlayerInfoInterface can in losers) { // Erase the vote if (can.RoundData.issetBool(kNext)) can.RoundData.unsetBool(kNext); } foreach (PlayerInfoInterface can in winners) { // Erase the vote if (can.RoundData.issetBool(kNext)) can.RoundData.unsetBool(kNext); } server.RoundData.unsetObject(kVoteTime); return false; } /* Otherwise tally */ foreach(PlayerInfoInterface p in losers) { if (p.RoundData.issetBool(kNext)) votes++; } if (level >= 3) plugin.ConsoleWrite("^b[VoteNext]^n loser votes = " + votes + " of " + losers.Count); /* Votes on the winning side are counted as long as they are less than the votes on the losing side */ int losingVotes = votes; int winningVotes = 0; foreach(PlayerInfoInterface p in winners) { if (p.RoundData.issetBool(kNext)) { winningVotes++; if (winningVotes > losingVotes) break; ++votes; } } if (level >= 3) plugin.ConsoleWrite("^b[VoteNext]^n winner votes = " + winningVotes + " of " + winners.Count); int needed = Convert.ToInt32(Math.Ceiling((double) losers.Count * (percent/100.0))); if (server.RoundData.issetInt(kNeeded)) needed = Math.Min(needed, server.RoundData.getInt(kNeeded)); server.RoundData.setInt(kNeeded, needed); int remain = needed - votes; if (level >= 3) plugin.ConsoleWrite("^b[VoteNext]^n needed votes = " + needed); String voters = (losing == 1) _ "US" : "RU"; String otherVoters = (losing == 1) _ "RU" : "US"; if (remain > 0) { if (firstTime) { msg = remain + " " + voters + " !surrender or " + otherVoters + " !votenext votes needed to end round with " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " minutes left!"; } else { msg = remain + " !surrender/!votenext needed to end round with " + Convert.ToInt32(Math.Ceiling(timeout - since.TotalMinutes)) + " mins left!"; } plugin.SendGlobalMessage(msg); plugin.ServerCommand("admin.yell", msg, "8"); if (level >= 2) plugin.ConsoleWrite("^b[VoteNext]^n " + msg); return false; } /* End the round */ String wteam = (losing == 1) _ "RU" : "US"; msg = "Vote succeeded: round ends now, " + wteam + " team wins!"; plugin.SendGlobalMessage(msg); plugin.ServerCommand("admin.yell", msg, "10"); if (level >= 2) plugin.ConsoleWrite("^b[VoteNext]^n " + msg); String wid = (losing == 1) _ "2" : "1"; ThreadStart roundEnder = delegate { Thread.Sleep(10*1000); plugin.ServerCommand("mapList.endRound", wid); }; Thread enderThread = new Thread(roundEnder); enderThread.Start(); Thread.Sleep(10); return false; * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted October 28, 2014 Author Share Posted October 28, 2014 Originally Posted by IAF-SDS*: Change double minTicketGap = 50 to double minTicketGap = 500 or instead of 500 use whatever amount of ticket difference you want them to have before they can surrender. If you set it to 500, that means they cannot surrender when the ticket difference is 2800 vs 2400 (or 400 ticket difference). So, for example, if you think they should not be able to surrender until the ticket difference is greater than 20% of 3200 or 640 ticket difference, then change the 50 to 640. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted October 28, 2014 Author Share Posted October 28, 2014 Originally Posted by PapaCharlie9*: Change double minTicketGap = 50 to double minTicketGap = 500 or instead of 500 use whatever amount of ticket difference you want them to have before they can surrender. If you set it to 500, that means they cannot surrender when the ticket difference is 2800 vs 2400 (or 400 ticket difference). So, for example, if you think they should not be able to surrender until the ticket difference is greater than 20% of 3200 or 640 ticket difference, then change the 50 to 640. That's a good suggestion, but we also have to add the requirement that all maps and all modes on that server must have high enough ticket counts for 500 (or whatever) to be reasonable. If she has one map with 3000 and another with 300, 500 is not going to work. * Restored post. It could be that the author is no longer active. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.