Created
September 4, 2020 19:03
-
-
Save Blaumaus/cc8054fb153329c9d66f94e210b199b6 to your computer and use it in GitHub Desktop.
haxball.com avatar hax
This file contains 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
// Script changes player's avatar every 0.07 seconds | |
// Pressing '|' activates/deactivates it | |
async function avatar_hax() { | |
for (let i = 65; i <= 122; ++i) { | |
if (!avatar_do) break | |
if (i == 122) i = 65 | |
document.querySelector('.chatbox-view > .input > input').value = '/avatar ' + String.fromCharCode(i) | |
document.querySelector('.input > button').click() | |
document.querySelector('.chatbox-view > .log').removeChild(document.querySelector('.chatbox-view > .log').lastChild) | |
await new Promise(r => setTimeout(r, 70)) | |
} | |
} | |
function waitFor(condition, callback) { | |
if (!condition()) { | |
window.setTimeout(waitFor.bind(null, condition, callback), 100) | |
} else callback() | |
} | |
window.addEventListener('keydown', k => { | |
if (k.key == '|') { | |
window.avatar_do = !window.avatar_do | |
if (!window.avatar_do) waitFor(() => window.avatar_do, avatar_hax) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment