Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TagPro Anti-AFK Wait for 2v2
- // @version 0
- // @description Words cannot describe.
- // @include http://*.koalabeast.com:*
- // @include http://*.jukejuice.com:*
- // @include http://*.newcompte.fr:*
- // @author Zagd
- // ==/UserScript==
- // README:
- /*
- This script will prevent you from being AFK kicked from games
- with less than 4 players. If a game reaches 4+ players, the "Go!"
- sound will play, followed by an alert sound. When there are 4+
- players, the anti-AFK functionality will cease, meaning you can
- be AFK kicked.
- With this script, you can leave a browser tab open to a game that
- has less than 4 players, and not worry about being kicked, and you
- will be notified when the game has 4 or more players.
- */
- tagpro.ready(function() {
- tagpro.socket.on('map', function(map) {
- function wait() {
- function antiAFK(){
- playerCount = getPlayerCount();
- if (playerCount >= 4) {
- var alertlongSound = new Audio("http://tagpro-diameter.koalabeast.com/sounds/alertlong.mp3");
- alertlongSound.play();
- var goSound = new Audio("http://tagpro-diameter.koalabeast.com/sounds/go.mp3");
- goSound.play();
- return;
- }
- if (tagpro.state == 1) {
- tagpro.socket.emit('keydown', {k: 'space'});
- tagpro.socket.emit('keyup', {k: 'space'});
- }
- setTimeout(antiAFK, 5000);
- }
- function getPlayerCount() {
- var playerCount = 0;
- for (var playerId in tagpro.players) {
- if (tagpro.players.hasOwnProperty(playerId)) {
- playerCount++;
- }
- }
- return playerCount;
- }
- antiAFK();
- }
- tagpro.socket.on("chat", function(data) {
- if (data.from == tagpro.playerId && /^!wait$/.test(data.message)) {
- wait();
- }
- });
- });
- });
Add Comment
Please, Sign In to add comment