Skip to content

Instantly share code, notes, and snippets.

@Blaumaus
Created September 4, 2020 19:03
Show Gist options
  • Save Blaumaus/cc8054fb153329c9d66f94e210b199b6 to your computer and use it in GitHub Desktop.
Save Blaumaus/cc8054fb153329c9d66f94e210b199b6 to your computer and use it in GitHub Desktop.
haxball.com avatar hax
// 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