SHARE
TWEET

Everybody Edits - Anti left/join spam

capasha Sep 17th, 2018 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Change the delay or join times like you want.
  2.  
  3. int joinDelay = 840;
  4. int joinTimes = 3;
  5.  
  6. private Dictionary<string, data> playerChecker = new Dictionary<string, data>();
  7. case "add":
  8. if (!playerChecker.ContainsKey(m.GetString(2)))
  9.     {
  10.         playerChecker.Add(m.GetString(2), new data() { id = m.GetInt(0), leftTime = DateTime.Now });
  11.     }
  12.     else
  13.     {
  14.         playerChecker[m.GetString(2)].id = m.GetInt(0);
  15.         if (playerChecker[m.GetString(2)].leftTime.Millisecond >= joinDelay)
  16.         {
  17.             Console.WriteLine("Joined perfect");
  18.         }
  19.         else
  20.         {
  21.             Console.WriteLine("Tried to join too fast " + joinDelay + " " + playerChecker[m.GetString(2)].joins + " " +     joinTimes);
  22.             playerChecker[m.GetString(2)].joins += 1;
  23.             if (playerChecker[m.GetString(2)].joins >= joinTimes)
  24.             {
  25.                 con.Send("say", "/kick " + m.GetString(1) + " Stop Spamming.");
  26.                 playerChecker.Remove(m.GetString(2));
  27.             }
  28.         }
  29.     }
  30. break;
  31. case "left":
  32.     var value = playerChecker.Where(a => a.Value.id == m.GetInt(0)).Select(a => a.Key).SingleOrDefault();
  33.     if (value != null) playerChecker[value].leftTime = DateTime.Now;
  34. break;
  35. public class data
  36. {
  37.     public string userid;
  38.     public int id;
  39.     public DateTime leftTime;
  40.     public int joins;
  41.  
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top