i need help regarding a javascript

Job ID: 35504288

Budget: €8 – €30 EUR

Hello
It's about a script I use on a website called BC.game. By itself the script runs fine, however the script stops due to for example network errors...and does not restart from new. So the script needs a restart function when it comes to network crashes, and a function to continue its last used numbers and logic.
That means for example :


The script starts with a payout of 10x and adds 1.02x to the payout after each loss. After each series of losses of 500, the payout is divided by 2 and the bet amount is multiplied by 2.

However, if 1.02x is added after each loss and the script already gets a network error after 120 loss streaks (i.e. at a payout multiplier of about 122.4), the script should save its last multiplier (122.4) and not go back to the 10 multiplier, instead continue its logic and rejoin in the next round as usual, otherwise when the script starts again at 10 there will be losses.