Jump to content

Script


FunnDonn
 Share

Recommended Posts

Posted (edited)

"Hi All,
I hoped to modify a code to play the Crash game using Code Injector to avoid errors and disturbances caused by the internet or other factors. Could someone please help me with this?
Thank you in advance for your time and consideration.

 

// Ensure these global variables are defined at the top of your script
var totalWagers = 0;
var totalWins = 0;
var totalLosses = 0;
var netProfitLoss = 0;
var highestProfit = 0;
var highestProfitTime = null;
var highestLoss = 0;
var highestLossTime = null;
var currentWinStreak = 0;
var longestWinStreak = 0;
var currentLoseStreak = 0;
var longestLoseStreak = 0;
var hadConsecutiveLosses = false;

var config = {
  baseBet: { label: "base bet", value: currency.minAmount, type: "number" },
  payout: { label: "payout", value: 2, type: "number" },
  reset: { label: "reset if next bet >", value: 20, type: "number" }, // Changed "stop" to "reset"
  onLoseTitle: { label: "On Lose", type: "title" },
  onLoss: {
    label: "",
    value: "increase",
    type: "radio",
    options: [
      { value: "reset", label: "Return to base bet" },
      { value: "increase", label: "Increase bet by (loss multiplier)" },
    ],
  },
  lossMultiplier: { label: "loss multiplier", value: 1, type: "number" },
  onWinTitle: { label: "On Win", type: "title" },
  onWin: {
    label: "",
    value: "increase",
    type: "radio",
    options: [
      { value: "reset", label: "Return to base bet" },
      { value: "increase", label: "Increase bet by (win multiplier)" },
    ],
  },
  winMultiplier: { label: "win multiplier", value: 1, type: "number" },
};

function main() {
  var currentBet = config.baseBet.value;
  var baseBet = config.baseBet.value; // Store the base bet for reset
 
  game.onBet = function () {
    totalWagers++;
    
    if (currentBet < currency.minAmount) {
      log.error("Bet minimum amount " + currency.minAmount + ".");
      currentBet = currency.minAmount;
    }
    
    game.bet(currentBet, config.payout.value).then(function (payout) {
      var profitLoss = (payout - 1) * currentBet;
      netProfitLoss += profitLoss;
      
      // Update highest profit or highest loss
      if (netProfitLoss > highestProfit) {
        highestProfit = netProfitLoss;
        highestProfitTime = new Date();
      }
      if (netProfitLoss < highestLoss) {
        highestLoss = netProfitLoss;
        highestLossTime = new Date();
      }

      if (payout > 1) {
        totalWins++;
        currentWinStreak++;
        if (currentWinStreak > longestWinStreak) longestWinStreak = currentWinStreak;
        currentLoseStreak = 0;
        
        if (config.onWin.value === "increase") {
          currentBet += config.winMultiplier.value;
        } // Otherwise, keep the bet the same
        
        log.success("We won🎉, so next bet will be " + currentBet + " " + currency.currencyName);
        
        if (hadConsecutiveLosses) {
          logStats();
          hadConsecutiveLosses = false;
        }
      } else {
        totalLosses++;
        currentLoseStreak++;
        if (currentLoseStreak > 1) hadConsecutiveLosses = true;
        currentWinStreak = 0;
        
        if (config.onLoss.value === "increase" && config.lossMultiplier.value !== 0) {
          currentBet -= config.lossMultiplier.value;
        } // Otherwise, keep the bet the same
        
        log.error("We lost👎, so next bet will be " + currentBet + " " + currency.currencyName);
      }

      if (currentBet > config.reset.value) {
        log.error("Was about to bet " + currentBet + " which triggers the reset");
        currentBet = baseBet; // Reset the bet amount to base value
        config.payout.value = 2; // Reset the payout to base value
      }
    });
  };
}

function logStats() {
  log.info(`Stats: Wagers: ${totalWagers}, Wins 🏆: ${totalWins}, Losses 👎: ${totalLosses}, Net💰: ${netProfitLoss.toFixed(2)}`);
  log.info(`Profit: Highest💹: ${highestProfit.toFixed(2)} (Time: ${highestProfitTime ? highestProfitTime.toLocaleString() : "N/A"})`);
  log.info(`Loss: Lowest❌: ${highestLoss.toFixed(2)} (Time: ${highestLossTime ? highestLossTime.toLocaleString() : "N/A"})`);
  log.info(`Win Streak: Current: ${currentWinStreak}, Longest: ${longestWinStreak}`);
  log.info(`Lose Streak: Current: ${currentLoseStreak}, Longest: ${longestLoseStreak}`);
}

// Ensure you have defined currency, log, and game objects before running the main function.
main();

 

Edited by FunnDonn
Link to comment
Share on other sites

@Skele

I tried to reach out to you yesterday through Telegram for this specific reason. Unfortunately, there seemed to be a misunderstanding.
Please assist me if possible."

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...