So, I have a project, its a "cookie clicker" by definition, and I wish to work out how I can protect the game from users being able to edit <button id="cooker" onclick="cookieClick(1)"></button>
and setting (1)
to like (123129)
.
I tried a few things first:
JQuery:
I tried using an old on() function with a dom searching function, and then to run an alert saying "Dumb Hacker! Im corrupting your save data" and then of course it would run Function clearDat()
then function corrupt()
which clears the localstorage data and sets it to an invalid value (usually wounds up as NaN) which prevents them from Playing.
Unfortunately the cookieclicker was editing the program so hastily, that it was "changing" the button above, and I wound up getting a million alerts (And because I was using a windows based HTML editor, I was getting WINDOW alerts, which i had to spam esc and try to delete the alert function and rerun the whole game, it was a pain)
I also tried a similar method using an old JS function, but it wound up not working.
I think you may see where im getting at, I'm really stuck in a pickle.
Heres the current code: https://hatebin.com/tgsdqzhzlc
cookieClick(1500100900)
it would be a little bit more interesting if you would hide your game under private scoped variables but with your current code there is no need for such solution as you try to do there \$\endgroup\$