Guest User

Untitled

a guest
Jul 23rd, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Anti-AFK Wait for 2v2
  3. // @version 0
  4. // @description Words cannot describe.
  5. // @include http://*.koalabeast.com:*
  6. // @include http://*.jukejuice.com:*
  7. // @include http://*.newcompte.fr:*
  8. // @author Zagd
  9. // ==/UserScript==
  10.  
  11. // README:
  12. /*
  13. This script will prevent you from being AFK kicked from games
  14. with less than 4 players. If a game reaches 4+ players, the "Go!"
  15. sound will play, followed by an alert sound. When there are 4+
  16. players, the anti-AFK functionality will cease, meaning you can
  17. be AFK kicked.
  18.  
  19. With this script, you can leave a browser tab open to a game that
  20. has less than 4 players, and not worry about being kicked, and you
  21. will be notified when the game has 4 or more players.
  22. */
  23.  
  24. tagpro.ready(function() {
  25. tagpro.socket.on('map', function(map) {
  26. function wait() {
  27. function antiAFK(){
  28. playerCount = getPlayerCount();
  29. if (playerCount >= 4) {
  30. var alertlongSound = new Audio("http://tagpro-diameter.koalabeast.com/sounds/alertlong.mp3");
  31. alertlongSound.play();
  32. var goSound = new Audio("http://tagpro-diameter.koalabeast.com/sounds/go.mp3");
  33. goSound.play();
  34. return;
  35. }
  36. if (tagpro.state == 1) {
  37. tagpro.socket.emit('keydown', {k: 'space'});
  38. tagpro.socket.emit('keyup', {k: 'space'});
  39. }
  40. setTimeout(antiAFK, 5000);
  41. }
  42. function getPlayerCount() {
  43. var playerCount = 0;
  44. for (var playerId in tagpro.players) {
  45. if (tagpro.players.hasOwnProperty(playerId)) {
  46. playerCount++;
  47. }
  48. }
  49. return playerCount;
  50. }
  51. antiAFK();
  52. }
  53. tagpro.socket.on("chat", function(data) {
  54. if (data.from == tagpro.playerId && /^!wait$/.test(data.message)) {
  55. wait();
  56. }
  57. });
  58. });
  59. });
Add Comment
Please, Sign In to add comment