Добавить функцию в Javascript
23 USDЕсть ресурс: https://t.ly/0Md8Q
По причине сбоев в сети скрипт останавливается и нужно добавить функцию что при остановки перезапуск и перезапуск с последних значений/ cкрипт постоянно увеличивает число выигрыша/
Скрипт:
var config = {
bet: { label: "bet", value: currency.minAmount, type: "number" },
basePayout: { label: "base payout", value: 2, type: "number" },
stop: { value: 20, type: "number", label: "stop if next payout >" },
onLoseTitle: { label: "On Lose", type: "title" },
onLoss: {
label: "",
value: "reset",
type: "radio",
options: [
{ value: "reset", label: "Return to base bet" },
{ value: "increase", label: "Increase payout by (loss payout)" },
],
},
lossAdd: { label: "loss payout +", value: 1, type: "number" },
onWinTitle: { label: "On Win", type: "title" },
onWin: {
label: "",
value: "reset",
type: "radio",
options: [
{ value: "reset", label: "Return to base bet" },
{ value: "increase", label: "Increase payout by (win payout)" },
],
},
winAdd: { label: "win payout +", value: 1, type: "number" },
};
function main() {
var currentPayout = config.basePayout.value;
game.onBet = function () {
game.bet(config.bet.value, currentPayout).then(function (payout) {
if (payout > 1) {
if (config.onWin.value === "reset") {
currentPayout = config.basePayout.value;
} else {
currentPayout += config.winAdd.value;
}
log.success("We won, so next payout will be " + currentPayout + " x");
} else {
if (config.onLoss.value === "reset") {
currentPayout = config.basePayout.value;
} else {
currentPayout += config.lossAdd.value;
}
log.error("We lost, so next payout will be " + currentPayout + " x");
}
if (currentPayout > config.stop.value) {
log.error(
"Was about to bet with payout " +
currentPayout +
" which triggers the stop"
);
game.stop();
}
});
};
}
-
3571 86 1 1 var config = {
bet: { label: "ставка", value: currency.minAmount, type: "number" },
basePayout: { label: "базовий виграш", value: 2, type: "number" },
stop: { value: 20, type: "number", label: "зупинити, якщо наступний виграш >" },
onLoseTitle: { label: "При програші", type: "title" },
onLoss: {
label: "",
value: "скинути",
type: "radio",
… options: [
{ value: "reset", label: "Повернутися до базової ставки" },
{ value: "increase", label: "Збільшити виграш на (виграш при програші)" },
],
},
lossAdd: { label: "виграш при програші +", value: 1, type: "number" },
onWinTitle: { label: "При виграші", type: "title" },
onWin: {
label: "",
value: "скинути",
type: "radio",
options: [
{ value: "reset", label: "Повернутися до базової ставки" },
{ value: "increase", label: "Збільшити виграш на (виграш при виграші)" },
],
},
winAdd: { label: "виграш при виграші +", value: 1, type: "number" },
};
var currentPayout = config.basePayout.value;
var lastBet = config.bet.value;
function saveState() {
// Зберігаємо поточні значення ставки та виграшу
localStorage.setItem('lastBet', lastBet);
localStorage.setItem('currentPayout', currentPayout);
}
function loadState() {
// Завантажуємо збережені значення
lastBet = localStorage.getItem('lastBet') || config.bet.value;
currentPayout = localStorage.getItem('currentPayout') || config.basePayout.value;
}
function main() {
// Завантажуємо стан при запуску
loadState();
game.onBet = function () {
game.bet(lastBet, currentPayout).then(function (payout) {
if (payout > 1) {
if (config.onWin.value === "reset") {
currentPayout = config.basePayout.value;
} else {
currentPayout += config.winAdd.value;
}
log.success("Ми виграли, тому наступний виграш буде " + currentPayout + " x");
} else {
if (config.onLoss.value === "reset") {
currentPayout = config.basePayout.value;
} else {
currentPayout += config.lossAdd.value;
}
log.error("Ми програли, тому наступний виграш буде " + currentPayout + " x");
}
if (currentPayout > config.stop.value) {
log.error(
"Ми збиралися зробити ставку з виграшем " +
currentPayout +
" що викликає зупинку"
);
saveState(); // Зберігаємо стан при зупинці
game.stop();
}
});
};
}
Current freelance projects in the category Javascript and Typescript
Full-stack development — Amazon PPC Dashboard (Stage 1)Need a full-stack developer with experience working with Amazon API to implement Stage 1 of the internal PPC dashboard. The project is real, the data is live, everything is ready to start. Frontend prototype (5 pages, React + TypeScript): WHAT IS ALREADY READY — Frontend… Javascript and Typescript, Web Programming ∙ 1 day 10 hours back ∙ 26 proposals |
Development of a photo book and photo frame constructor websiteProject Goal A modern website needs to be developed for ordering photo books, photo frames, and other personalized photo products. The main task of the project is to provide the client with the ability to independently create a ready-made layout of the product directly on the… Javascript and Typescript, Web Programming ∙ 3 days 2 hours back ∙ 96 proposals |
Team for a custom marketplace of funeral services.We are looking for a team to launch and develop a custom national marketplace for funeral services. Right away: we are not looking for solo freelancers, juniors, or "website builders." We need a strong product team at the middle+/senior level with real cases in… Javascript and Typescript, Web Programming ∙ 3 days 21 hours back ∙ 26 proposals |
Improvement of the existing Next.js/Supabase project: offers, CRM, analytics, AI chatThere is an active project WatchGenius — a luxury watch analytics platform with a catalog of models, price analytics, external offers, application forms, and an AI chat. The project has already been partially developed. We need not a website from scratch, but an experienced… Javascript and Typescript, Web Programming ∙ 5 days 22 hours back ∙ 55 proposals |
I am looking for a Senior Full-Stack Developer (Payload CMS) — migration of 2 websites for a hotel chain.The resort hotel network is transitioning from Webflow to its own headless stack. Two corporate websites (~140 pages in total), multi-tenant architecture — one code serves multiple hotels on different domains. The project has already started: the infrastructure is deployed,… Content Management Systems, Javascript and Typescript ∙ 9 days 20 hours back ∙ 19 proposals |