// ==UserScript==
// @name Happyfor.win - By - RDC-agario
// @namespace [url]http://tampermonkey.net/[/url]
// @version 5.0
// @description hack ,Tricksplit , doblesplit , etc
// @author RDC y WERNER
// @match [url]http://agar.io/*[/url]
// @match [url]http://alis.io/*[/url]
// @grant none
// @run-at document-end
// ==/UserScript==
window.addEventListener('keydown', keydown);
window.addEventListener('keyup', keyup);
//Load macros
var canFeed = false;
function keydown(event) {
switch (event.keyCode) {
case 87: //Feeding Macro (w)
canFeed = true;
feed();
break;
case 82: //Doublesplit Macro (d)
split();
setTimeout(split, 137);
break;
}
}
//When a player lets go of Q or W, stop feeding
function keyup(event) {
if (event.keyCode == 87 || event.keyCode == 81) canFeed = false;
}
//Alias for W key
function feed() {
if (canFeed) {
window.onkeydown({keyCode: 87});
window.onkeyup({keyCode: 87});
setTimeout(feed, 0);
}
}
//Alias for space
function split() {
$("body").trigger($.Event("keydown", { keyCode: 32}));
$("body").trigger($.Event("keyup", { keyCode: 32}));
}
var SplitInterval;
var MacroInterval;
var SplitDebounce = false;
var MacroDebounce = false;
$(document).on('keydown', function(input) {
console.log("got keydown")
if (input.keyCode == 69) {
if (SplitDebounce) {
return;
}
SplitDebounce = true;
SplitInterval = setInterval(function() {
$("body").trigger($.Event("keydown", {
keyCode: 32
}));
$("body").trigger($.Event("keyup", {
keyCode: 32
}));
}, 0);
} else if (input.keyCode == 81) {
if (MacroDebounce) {
return;
}
MacroDebounce = true;
MacroInterval = setInterval(function() {
$("body").trigger($.Event("keydown", {
keyCode: 87
}));
$("body").trigger($.Event("keyup", {
keyCode: 87
}));
}, 0);
}
})
$(document).on('keyup', function(input) {
if (input.keyCode == 69) {
SplitDebounce = false;
clearInterval(SplitInterval);
return;
} else if (input.keyCode == 81) {
MacroDebounce = false;
clearInterval(MacroInterval);
return;
}
})