Created
April 19, 2015 15:56
-
-
Save chrahunt/2584caa0db6c3b2c1bcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Don't Kick Me, tagpro! | |
// @description Prevent getting kicked due to being AFK (or busy) on | |
// map test server. | |
// @include http://tangent.jukejuice.com:* | |
// @author snaps | |
// @license MIT | |
// @version 0.1.0 | |
// ==/UserScript== | |
/* | |
* Don't get kicked due to being AFK on the testing server. | |
*/ | |
// Wait until the tagpro object exists, and add the function to tagpro.ready | |
function addToTagproReady(fn) { | |
// Make sure the tagpro object exists. | |
if (typeof tagpro !== "undefined") { | |
tagpro.ready(fn); | |
} else { | |
// If not ready, try again after a short delay. | |
setTimeout(function() { | |
addToTagproReady(fn); | |
}, 0); | |
} | |
} | |
addToTagproReady(function() { | |
// Interval for space keypress. | |
var denyAfk = setInterval(function() { | |
tagpro.sendKeyPress("space", false); | |
setTimeout(function() { | |
tagpro.sendKeyPress("space", true); | |
}, 150); | |
}, 10e3); | |
// Remove interval if spectating. | |
tagpro.socket.on("spectator", function() { | |
clearInterval(denyAfk); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment