Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var TICK_DELAY = 1;
- var LOCK_DELAY = 60;
- var MAX_LINES = 50;
- var MAX_CHARS = 1024;
- var LINES_PER_TICK = 10;
- var CHARS_PER_TICK = 512;
- var lineCount = 0;
- var charCount = 0;
- var timeLocked = null;
- function resetText()
- {
- lineCount -= LINES_PER_TICK;
- if (lineCount < 0)
- {
- lineCount = 0;
- }
- charCount -= CHARS_PER_TICK;
- if (charCount < 0)
- {
- charCount = 0;
- }
- if (timeLocked != null)
- {
- if (new Date() - timeLocked > LOCK_DELAY)
- {
- irc.raw('SILENCE -*');
- timeLocked = null;
- }
- }
- }
- context.CreateTimer("resetText", null, TICK_DELAY);
- function processText()
- {
- if (timeLocked != null)
- {
- return;
- }
- lineCount++;
- charCount += text.length;
- if (lineCount > MAX_LINES || charCount > MAX_CHARS)
- {
- irc.raw('SILENCE +*!~*@*');
- timeLocked = new Date();
- }
- }
- onprivtext = processText;
- onprivnotice = processText;
- onprivaction = processText;
- onprivctcp = processText;
- onctcpreply = processText;
Add Comment
Please, Sign In to add comment