Jump to content

Insane Limits V0.9/R6: Vote to nuke camping/base raping team, or !surrender (CQ/Rush)


ImportBot

Recommended Posts

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 :ohmy:

 

 

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
  • Replies 306
  • Created
  • Last Reply

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

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. :smile:

* Restored post. It could be that the author is no longer active.
Link to comment

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.JPG

2.jpg

* Restored post. It could be that the author is no longer active.
Link to comment

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.JPG

2.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

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

Originally Posted by EBassie*:

 

I mean where can download plugin insane-limits-VERSION 0.9.15 , not code

You 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

Originally Posted by PapaCharlie9*:

 

I mean where can download plugin insane-limits-VERSION 0.9.15 , not code

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.

* Restored post. It could be that the author is no longer active.
Link to comment

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
  • 2 weeks later...

Originally Posted by w262035635*:

 

Code:

int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote
1."losing team" Can Use 2 time VOTENUKE

2.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

Originally Posted by Beastman*:

 

Code:

int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote
1."losing team" Can Use 2 time VOTENUKE

2.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

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

Originally Posted by PapaCharlie9*:

 

Code:

int maxVotes = 2; // CUSTOMIZE: maximum number of times a losing team may vote
1."losing team" Can Use 2 time VOTENUKE

2.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

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
  • 2 weeks later...

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

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

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
  • 2 months later...

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

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

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

Archived

This topic is now archived and is closed to further replies.




  • Our picks

    • Game Server Hosting:

      We're happy to announce that EZRCON will branch out into the game server provider scene. This is a big step for us so please having patience if something doesn't go right in this area. Now, what makes us different compared to other providers? Well, we're going with the idea of having a scaleable server hosting and providing more control in how you set up your server. For example, in Minecraft, you have the ability to control how many CPU cores you wish your server to have access to, how much RAM you want to use, how much disk space you want to use. This type of control can't be offered in a single service package so you're able to configure a custom package the way you want it.

      You can see all the available games here. Currently, we have the following games available.

      Valheim (From $1.50 USD)


      Rust (From $3.20 USD)


      Minecraft (Basic) (From $4.00 USD)


      Call of Duty 4X (From $7.00 USD)


      OpenTTD (From $4.00 USD)


      Squad (From $9.00 USD)


      Insurgency: Sandstorm (From $6.40 USD)


      Changes to US-East:

      Starting in January 2022, we will be moving to a different provider that has better support, better infrastructure, and better connectivity. We've noticed that the connection/routes to this location are not ideal and it's been hard getting support to correct this. Our contract for our two servers ends in March/April respectively. If you currently have servers in this location you will be migrated over to the new provider. We'll have more details when the time comes closer to January. The new location for this change will be based out of Atlanta, GA. If you have any questions/concerns please open a ticket and we'll do our best to answer them.
      • 5 replies
    • Hello All,

      I wanted to give an update to how EZRCON is doing. As of today we have 56 active customers using the services offered. I'm glad its doing so well and it hasn't been 1 year yet. To those that have services with EZRCON, I hope the service is doing well and if not please let us know so that we can improve it where possible. We've done quite a few changes behind the scenes to improve the performance hopefully. 

      We'll be launching a new location for hosting procon layers in either Los Angeles, USA or Chicago, IL. Still being decided on where the placement should be but these two locations are not set in stone yet. We would like to get feedback on where we should have a new location for hosting the Procon Layers, which you can do by replying to this topic. A poll will be created where people can vote on which location they would like to see.

      We're also looking for some suggestions on what else you would like to see for hosting provider options. So please let us know your thoughts on this matter.
      • 4 replies
    • Added ability to disable the new API check for player country info


      Updated GeoIP database file


      Removed usage sending stats


      Added EZRCON ad banner



      If you are upgrading then you may need to add these two lines to your existing installation in the file procon.cfg. To enable these options just change False to True.

      procon.private.options.UseGeoIpFileOnly False
      procon.private.options.BlockRssFeedNews False



       
      • 2 replies
    • I wanted I let you know that I am starting to build out the foundation for the hosting services that I talked about here. The pricing model I was originally going for wasn't going to be suitable for how I want to build it. So instead I decided to offer each service as it's own product instead of a package deal. In the future, hopefully, I will be able to do this and offer discounts to those that choose it.

      Here is how the pricing is laid out for each service as well as information about each. This is as of 7/12/2020.

      Single MySQL database (up to 30 GB) is $10 USD per month.



      If you go over the 30 GB usage for the database then each additional gigabyte is charged at $0.10 USD each billing cycle. If you're under 30GB you don't need to worry about this.


      Databases are replicated across 3 zones (regions) for redundancy. One (1) on the east coast of the USA, One (1) in Frankfurt, and One (1) in Singapore. Depending on the demand, this would grow to more regions.


      Databases will also be backed up daily and retained for 7 days.




      Procon Layer will be $2 USD per month.


      Each layer will only allow one (1) game server connection. The reason behind this is for performance.


      Each layer will also come with all available plugins installed by default. This is to help facilitate faster deployments and get you up and running quickly.


      Each layer will automatically restart if Procon crashes. 


      Each layer will also automatically restart daily at midnight to make sure it stays in tip-top shape.


      Custom plugins can be installed by submitting a support ticket.




      Battlefield Admin Control Panel (BFACP) will be $5 USD per month


      As I am still working on building version 3 of the software, I will be installing the last version I did. Once I complete version 3 it will automatically be upgraded for you.





      All these services will be managed by me so you don't have to worry about the technical side of things to get up and going.

      If you would like to see how much it would cost for the services, I made a calculator that you can use. It can be found here https://ezrcon.com/calculator.html

       
      • 11 replies
    • I have pushed out a new minor release which updates the geodata pull (flags in the playerlisting). This should be way more accurate now. As always, please let me know if any problems show up.

       
      • 9 replies
×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.