Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1

    Insane Limits V0.8/R2: Chat Message Spambot

    Version V0.8/R2 (compiled and tested)

    This example rotates through a list of chat messages intended to be spammed to a server chat box. Every fixed interval of time, e.g., every 15 minutes, the next message in the list is sent. At the end of the list the spammer starts over from the start of the list.

    DUE TO A BUG IN INSANE LIMITS, THE INTERVAL MUST BE LESS THAN 120 SECONDS.

    Set limit to evaluate OnIntervalServer. Set the interval to the delay time between each message in seconds, e.g., 900 (15 minutes). Set action to None.

    Set first_check to this Code:

    Code:
    /* Version V0.8/R1 
    Send one message from the list every interval seconds.
    The interval is defined with the OnIntervalServer setting.
    The list of messages is defined below. To add more messages,
    just add more spam.Add("...") lines.
    */
    List<String> spam = new List<String>();
    spam.Add("*** Protected by PRoCon plugin: Insane Limits!");
    spam.Add("Second message to send <- CHANGE ME!");
    spam.Add("Third message to send <- CHANGE ME!");
    spam.Add("Fourth message to send <- CHANGE ME!");
    // add more messages here ...
    
    String kSpamIndex = "SPAM_index";
    
    int message = 0;
    if (server.Data.issetInt(kSpamIndex)) message = server.Data.getInt(kSpamIndex);
    
    // Start over at the beginning of the list if at the end
    message = (message % spam.Count);
    
    // Bookkeeping
    DateTime sanityCheck = DateTime.Now;
    String kSanityCheck = "SPAM_check";
    // Check to make sure minutes weren't confused with seconds in interval setting
    if (server.Data.issetObject(kSanityCheck)) {
    	sanityCheck = (DateTime)server.Data.getObject(kSanityCheck);
    	TimeSpan sane = DateTime.Now.Subtract(sanityCheck);
    	if (sane.TotalMinutes < 5) {
    		//plugin.ConsoleWarn("^b[Spambot]^n: Interval between messages must be at least 300 (5 minutes)!");
    		//return false; // Until 0.8p3 bug fixed
    	}
    }
    server.Data.setObject(kSanityCheck, DateTime.Now);
    server.Data.setInt(kSpamIndex, message+1);
    
    // Send message
    plugin.SendGlobalMessage(spam[message]);
    plugin.PRoConChat("ADMIN > " + spam[message]);
    
    return false;
    Leave second_check Disabled.

    If you want to send multiple lines of messages instead of just one line, use the \n newline escape in the quoted string to separate lines, for example:

    spam.Add("This one message has three lines.\nThis is the second line, indented.\nThis is the third line. Use sparingly!!");

    UPDATES

    R2 - commented out sanity check due to issue with 0.8p3 - Interval must be less than 120 seconds, as a work around
    R1 - original version
    Last edited by PapaCharlie9; 17-04-2012 at 17:36.

  2. #2
    Nice, thanks for making this :-) . One thing I don't like is that you are forcing user to have a minimum 5 minutes internal. It's not a big deal ... the user can just change the value. However, for people who simply copy+paste the code, they might be a bit confused.

    Since you are doing this kind of sanity check, for next version, I think I will expose in the limit object all the properties that can be set through the UI.

    So in this case you would just do:

    Code:
    int interval =  Int.Parse(limit.getField("evaluation_interval")) 
    if (interval < 300)
    {
      // warning about interval too small
      return false;
    }
    Last edited by micovery; 08-02-2012 at 00:32.

  3. #3
    Quote Originally Posted by micovery View Post
    Since you are doing this kind of sanity check, for next version, I think I will expose in the limit object all the properties that can be set through the UI.
    That would be totally awesome. Please add a limit.Id property too.

  4. #4
    for some reason my messages never go through. i set everything to default times but if i change it to if (sane.TotalMinutes < 0) { and set the interval from 30-120 it works. anything 180+ doesnt work.

  5. #5
    Quote Originally Posted by droopie View Post
    for some reason my messages never go through. i set everything to default times but if i change it to if (sane.TotalMinutes < 0) { and set the interval from 30-120 it works. anything 180+ doesnt work.
    I'll do a test and see if I can reproduce.

  6. #6
    For pharbehind:

    The easiest way to have one set of messages for 1-15 players and another for 16+ is to:

    * Follow the steps in the OP, but instead of making one limit, make two.

    * Instead of putting the code in first_check, put the code in second_check

    * In first_check for the first limit (1-15), add this Expression:

    Code:
    ( server.PlayerCount < 16 )
    * In first_check of the second limit (16+), add this Expression:

    Code:
    ( server.PlayerCount >= 16)
    * Then customize the messages in the second_check of both limits as needed.

  7. #7
    not really looking for specific messages based on the amount of players but i can see a great use for it. sometimes when we are playing with a low number of players agree to play like X gun only till more players load in.


    as for the messages, does it have a limit on how many characters it can handle per spam.Add? as i said in the main thread i would like the messages posted 3-5 times with the same message (not too long so i dont take up more then 1 line or else it goes to the 2nd line) but noticed if the sentence is too long the message doesnt get sent out.

  8. #8
    Quote Originally Posted by droopie View Post
    not really looking for specific messages based on the amount of players but i can see a great use for it. sometimes when we are playing with a low number of players agree to play like X gun only till more players load in.


    as for the messages, does it have a limit on how many characters it can handle per spam.Add? as i said in the main thread i would like the messages posted 3-5 times with the same message (not too long so i dont take up more then 1 line or else it goes to the 2nd line) but noticed if the sentence is too long the message doesnt get sent out.
    Messages have to be less than 128 characters. I don't enforce that in the Limit, you have to count them up yourself.

    If you know what message number you want the repeat message to be, you can make a simple change. Suppose you have this set of messages:

    Code:
    List<String> spam = new List<String>();
    spam.Add("*** Protected by PRoCon plugin: Insane Limits!"); // message 1
    spam.Add("Second message to send <- CHANGE ME!"); // message 2
    spam.Add("Third message to send <- CHANGE ME!"); // message 3
    spam.Add("Fourth message to send <- CHANGE ME!"); // message 4, etc.
    Let's say you want message 2 to be repeated 3 times. Find this line of code in the first_check

    Code:
    plugin.SendGlobalMessage(spam[message]);
    Change it to this:

    Code:
    if ((message+1) == 2) { // We want to repeat message 2 three times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else { // Just one time
        plugin.SendGlobalMessage(spam[message]);
    }
    If you also want to do message 4 six times, do this:

    Code:
    if ((message+1) == 2) { // We want to repeat message 2 three times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else if ((message+1) == 4) { // We want to repeat message 4 six times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else { // Just one time
        plugin.SendGlobalMessage(spam[message]);
    }
    And so on. Just add "if" or "else if" clauses for the message number and repeate the SendGlobalMessage line as many times as you want the message repeat.

  9. #9
    Quote Originally Posted by PapaCharlie9 View Post
    I'll do a test and see if I can reproduce.
    You are right. Using 0.0.0.8 patch 3, if the interval is greater than 120 seconds, it never sends anything. I'll send micovery a PM to let him know there is a problem.

    In the mean time, I've updated the code to R2 to remove the requirement for 300 seconds. You can set the interval to 110 seconds and it should be okay as a work around.

  10. #10
    Quote Originally Posted by PapaCharlie9 View Post
    Messages have to be less than 128 characters. I don't enforce that in the Limit, you have to count them up yourself.

    If you know what message number you want the repeat message to be, you can make a simple change. Suppose you have this set of messages:

    Code:
    List<String> spam = new List<String>();
    spam.Add("*** Protected by PRoCon plugin: Insane Limits!"); // message 1
    spam.Add("Second message to send <- CHANGE ME!"); // message 2
    spam.Add("Third message to send <- CHANGE ME!"); // message 3
    spam.Add("Fourth message to send <- CHANGE ME!"); // message 4, etc.
    Let's say you want message 2 to be repeated 3 times. Find this line of code in the first_check

    Code:
    plugin.SendGlobalMessage(spam[message]);
    Change it to this:

    Code:
    if ((message+1) == 2) { // We want to repeat message 2 three times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else { // Just one time
        plugin.SendGlobalMessage(spam[message]);
    }
    If you also want to do message 4 six times, do this:

    Code:
    if ((message+1) == 2) { // We want to repeat message 2 three times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else if ((message+1) == 4) { // We want to repeat message 4 six times
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
        plugin.SendGlobalMessage(spam[message]);
    } else { // Just one time
        plugin.SendGlobalMessage(spam[message]);
    }
    And so on. Just add "if" or "else if" clauses for the message number and repeate the SendGlobalMessage line as many times as you want the message repeat.
    i think this should help fix the limit of 128 per message when using \n to go to the next line so a message is sent more then 1 time. that was 1 of my problems. if in 1 message the first line is a max of 40 letters to fit in the first line and doesnt go to the 2nd line, and if i wanted the message to show 3 times, 40x3 120 in a single spam.add message. now its just the 40 per spam.add message. hope it helps.
    Last edited by droopie; 25-02-2012 at 21:02.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •