Jump to content

Insane Limits: Programmable chat & yell spambot with pauses


ImportBot

Recommended Posts

Originally Posted by PapaCharlie9*:

 

By popular demand, this limit is an extremely flexible spambot. You define a sequence of say, yell, or pause commands and the limit executes them in order, repeating the sequence if you set Repeat to true. Each command is quoted text (a String) that starts with the command word and is followed by space-separated options, just like an RCON command.

 

The supported commands are:

 

"say your message code"

Sends a chat message to all players

"yell seconds your message code"

Sends a yell message with the specified duration in seconds to all players

"pause seconds"

Pauses for the specified number of seconds. NOTE: seconds must be greater than or equal to 10 and must be a multiple of 10, e.g., 10, 20, 30, 60, 120, 300, etc. Any value that is not a multiple of 10 will be rounded up to the nearest 10, e.g., 15 will be rounded up to 20. This is a limitation imposed by OnIntervalServer, whose minimum timer interval is 10 seconds.

For your message code, you may use any legal Insane Limits code. You can use plugin.R() replacements (although most of the player, killer, victim replacements are not available), or you can use plus sign + composition of code, such as + plugin.FriendlyMapName(server.NextMapFileName) to show the next map in the map rotation.

 

The commands are added by editing the Code. At the top is a series of MessageCommand.Add() lines. Change, delete, or add lines following the pattern in the example code.

 

NOTE: Due to limitations of the OnIntervalServer evaluation, your pauses may take a second or two longer than you specified, for example, if you use "pause 20", the next message command might not occur until 21 seconds later.

 

Create a new limit OnIntervalServer, call it "Programmable Spambot", set interval to 10 seconds, leave Action set to None.

 

Set first_check to this Code:

 

 

Code:

/* Version 0.9.15/R1 */
List<String> MessageCommands = new List<String>();
// If you want the message commands to repeat after the last command is executed, set Repeat to true:
bool Repeat = true;
// This is your list of message commands. Change this list as needed:
MessageCommands.Add(@"say This is your first say message!");
MessageCommands.Add(@"pause 60");
MessageCommands.Add(@"say This is your second message!");
MessageCommands.Add(@"pause 60");
MessageCommands.Add(@"yell 10 This is your third message, yelled.");
MessageCommands.Add(@"pause 120");
MessageCommands.Add(plugin.R(@"say This message uses replacements: Today's date is %date%"));
MessageCommands.Add(@"pause 600");
MessageCommands.Add(@"yell 15 This message uses code: The next map will be " + plugin.FriendlyMapName(server.NextMapFileName));
MessageCommands.Add(@"pause 30");
// Add more MessageCommand.Add(); lines here ...


// CODE
String kLast = "LastMessageTime";
String kPause = "LastPause";
String kIndex = "LastMessageIndex";

// Check if we are pausing
DateTime last = DateTime.Now;
if (plugin.Data.issetObject(kLast)) last = (DateTime)plugin.Data.getObject(kLast);
double elapsed = DateTime.Now.Subtract(last).TotalSeconds;

double pause = 0;
if (plugin.Data.issetDouble(kPause)) pause = plugin.Data.getDouble(kPause);

if (pause > 0 && elapsed < pause) return false; // Too soon, still pausing

// Otherwise reset pause
pause = 0;
plugin.Data.setDouble(kPause, pause);

// Handle commands
Match mPause = null;
int i = 0;
String cmd = String.Empty;
do {
    if (plugin.Data.issetInt(kIndex)) i = plugin.Data.getInt(kIndex);

    // Check if no more commands
    if (i >= MessageCommands.Count || i < 0) {
        if (Repeat) {
            i = 0;
            plugin.Data.setInt(kIndex, i);
            plugin.ConsoleWrite("Will repeat " + MessageCommands.Count + " commands");
            plugin.PRoConChat("Commands will repeat");
        }
        return false;
    }

    // Parse command
    cmd = MessageCommands[i];

    mPause = Regex.Match(cmd, @"^pause\s+(.+)$", RegexOptions.IgnoreCase);
    Match mSay = Regex.Match(cmd, @"^say\s+(.+)$", RegexOptions.IgnoreCase);
    Match mYell = Regex.Match(cmd, @"^yell\s+([0-9]+)\s+(.+)$", RegexOptions.IgnoreCase);

    // Evaluate command
    if (mPause.Success) {
        break;
    } else if (mSay.Success) {
        String msg = mSay.Groups[1].Value.Replace('{','(').Replace('}',')').Trim();
        if (String.IsNullOrEmpty(msg)) {
            plugin.ConsoleWarn("Invalid say message, for MessageCommand.Add(\"" + cmd + "\"), skipping!");
            i = i + 1;
            plugin.Data.setInt(kIndex, i);
            continue;
        }
        plugin.SendGlobalMessage(msg);
        plugin.PRoConChat("Say command > " + msg);
        plugin.ConsoleWrite("Command: say " + msg);
        i = i + 1;
        plugin.Data.setInt(kIndex, i);
        continue;
    } else if (mYell.Success) {
        String ysecs = mYell.Groups[1].Value;
        String msg = mYell.Groups[2].Value.Replace('{','(').Replace('}',')').Trim();
        int ydelay = 0;
        if (!Int32.TryParse(ysecs, out ydelay) || ydelay <= 0 || ydelay > 60) {
            plugin.ConsoleWarn("Invalid yell delay, for MessageCommand.Add(\"" + cmd + "\"), skipping!");
            i = i + 1;
            plugin.Data.setInt(kIndex, i);
            continue;
        }
        if (String.IsNullOrEmpty(msg)) {
            plugin.ConsoleWarn("Invalid yell message, for MessageCommand.Add(\"" + cmd + "\"), skipping!");
            i = i + 1;
            plugin.Data.setInt(kIndex, i);
            continue;
        }
        plugin.SendGlobalYell(msg, ydelay);
        plugin.PRoConChat("Yell command " + ydelay + " > " + msg);
        plugin.ConsoleWrite("Command: yell " + ydelay + " " + msg);
        i = i + 1;
        plugin.Data.setInt(kIndex, i);
        continue;
    } else {
        plugin.ConsoleWarn("Invalid MessageCommand.Add(\"" + cmd + "\"), skipping!");
        i = i + 1;
        plugin.Data.setInt(kIndex, i);
    }
} while (!mPause.Success);

if (mPause.Success) {
    String secs = mPause.Groups[1].Value;
    double delay = 0;
    if (Double.TryParse(secs, out delay) && delay >= 10) {
        int d = Convert.ToInt32(delay);
        if ((d % 10) > 0) {
            int rd = ((d / 10) + 1) * 10;
            plugin.ConsoleWrite("Pause of " + secs + " rounded up to " + rd);
            delay = rd;
        }
        plugin.Data.setObject(kLast, (Object)DateTime.Now);
        plugin.Data.setDouble(kPause, delay);
        plugin.PRoConChat("Pause command " + delay.ToString("F0") + " seconds");
        plugin.ConsoleWrite("Command: pause " + delay.ToString("F0") + " seconds");
        i = i + 1;
        plugin.Data.setInt(kIndex, i);
        return false;
    } else {
        plugin.ConsoleWarn("Invalid pause value [" + secs + "], for MessageCommand.Add(\"" + cmd + "\"), skipping!");
        i = i + 1;
        plugin.Data.setInt(kIndex, i);
        return false;
    }
}
return false;
YOU MUST CHANGE THE EXAMPLE MessageCommand.Add LINES! Change, add, or delete lines following the pattern in the example code above. Each command is text you type inside of the @"..." quotation marks. The @ sign is recommended.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 8 months later...

Originally Posted by PapaCharlie9*:

 

great how to make this limit to adaptive player count

Example :

 

>10 Players Preset 1

 

thank you

Create two limits.

 

In the first one, make first_check this Expression:

 

Code:

(server.PlayerCount >= 10)
Then use the code from post #1 as second_check Code. Change the messages to be your Preset 1.

 

In the second limit, make first_check this Expression:

 

Code:

(server.PlayerCount < 10)
Then use the code from post #1 as second_check Code. Change the messages to be your Preset 2.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 3 weeks later...

Originally Posted by SeMpaFiMaRiNe*:

 

Hello Guys,

 

Im not sure how to perform a rule when i want to yell something, when a player, in my case, tells other players not to kill because its a " Dogtag searching server". In this case when a triggerword/string like " dogtagserver" is written in the chat, the rule should fire and yell " shut up and piss off or i ban u..."

 

Thx Sempa

 

Attention this is also posted in: [bF3] ProconRulz - ADAPTIVE SPAMBOT in Plugin Enhancements

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

Originally Posted by LjMjollnir*:

 

Hello Guys,

 

Im not sure how to perform a rule when i want to yell something, when a player, in my case, tells other players not to kill because its a " Dogtag searching server". In this case when a triggerword/string like " dogtagserver" is written in the chat, the rule should fire and yell " shut up and piss off or i ban u..."

 

Thx Sempa

 

Attention this is also posted in: [bF3] ProconRulz - ADAPTIVE SPAMBOT in Plugin Enhancements

Id recommend AGAINST doing that... Fairfight has been kicking players for mentioning Dogtag search and No Kill.. its happend to me once already.. one of my guys even mentioned that a Dice DEV said servers will be blacklisted for doing it aswell.. i dont know how true that is or not.. but probably not worth the trouble :ohmy:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by SeMpaFiMaRiNe*:

 

Id recommend AGAINST doing that... Fairfight has been kicking players for mentioning Dogtag search and No Kill.. its happend to me once already.. one of my guys even mentioned that a Dice DEV said servers will be blacklisted for doing it aswell.. i dont know how true that is or not.. but probably not worth the trouble :ohmy:

Yeah pls read!!!!!!!!!!!!!
* Restored post. It could be that the author is no longer active.
Link to comment
  • 1 month later...

Originally Posted by v3rs0*:

 

Hello and thank you for this code, working perfectly.

I have a question regarding this:

 

MessageCommands.Add(@"yell 15 This message uses code: The next map will be " + plugin.FriendlyMapName(server.NextMapFileName));

What to do if i want to display this when 100 ticket left ?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Hello and thank you for this code, working perfectly.

I have a question regarding this:

 

 

 

What to do if i want to display this when 100 ticket left ?

Use a separate limit for that.

 

Create a limit OnKill, call it Final Yell.

 

Set first_check to this Expression:

 

Code:

(server.RemainTickets(1) <= 100 || server.RemainTickets(2) <= 100)
Set second_check to this Code:

 

Code:

if (limit.Activations() > 1)
    return false;
plugin.SendGlobalYell("Your message here", 15); // CHANGE
return false;
* Restored post. It could be that the author is no longer active.
Link to comment
  • 1 year later...

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.