22lblevins

Coolmath - Awesome Tanks 2 Script

May 8th, 2022 (edited)
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var key = "AWESOME-TANKS-2";
  2.  
  3. function getLS() {
  4.     if (localStorage.gameState) {
  5.         return JSON.parse(localStorage.getItem(key));
  6.     } else {
  7.         return false;
  8.     }
  9. }
  10.  
  11. function setLS(input) {
  12.     try {
  13.         localStorage.setItem(key, JSON.stringify(input));
  14.         refreshGame();
  15.     } catch {
  16.         console.warn("Unable to set localStorage!");
  17.     }
  18. }
  19.  
  20. function clearLS() {
  21.     try {
  22.         localStorage.removeItem(key);
  23.         refreshGame();
  24.         return true;
  25.     } catch {
  26.         return false;
  27.     }
  28. }
  29.  
  30. function refreshGame() {
  31.     cmg_remove_padg();
  32. }
  33.  
  34. //
  35.  
  36. function setMoney(val) {
  37.     var t = getLS();
  38.     t.game.money = val;
  39.     setLS(t);
  40. }
  41.  
  42.  
Add Comment
Please, Sign In to add comment