Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active November 17, 2021 22:37
Show Gist options
  • Save dsetzer/28278e7b98a576191a879c96c259f98f to your computer and use it in GitHub Desktop.
Save dsetzer/28278e7b98a576191a879c96c259f98f to your computer and use it in GitHub Desktop.
//------ settings ---------
const target = ''; // User to follow. Bet amount and target is adjusted/taken from this players bets.
const baseBet = 100; // Initial bet to place when target player places a bet.
const betMulti = 2; // Multiplies bet by this after each loss.
const autoCashout = 20;// Automatically cashout here if target player has cashed yet.
const maxBet = 1e8; // Clamps the bet size maximum at this amount (doesn't stop the script, limits bet size only)
const minBalance = 0 // Prevents betting if next bet will drop balance below this amount.
const betDelay = 4;
//-------------------------
let locked = false;
let lossCount = 0;
engine.on('game_starting', () => {
locked = false;
setTimeout((engine)=> {
let betSize = getBet();
if (engine.getBalance() - betSize < minBalance) {
console.log('You have a balance is too low, you can not bet');
return;
}
engine.placeBet(betSize, autoCashout); // aim at same payout as target..
console.log(`Placed bet ${betSize/100} bits`);
}, betDelay, engine);
});
engine.on('player_bet', (data) => {
if (data.username == target) {
locked = true;
}
});
engine.on('cashed_out', (cashOut) => {
if (cashOut.username === target) {
if (engine.getCurrentPayout()) {
engine.cashOut();
console.log(`Spotted ${cashOut.username} cashing out at ${cashOut.stopped_at/100}x`);
}
}
});
engine.on('game_crash', () => {
if(engine.lastGamePlay() == "LOST"){
lossCount++;
}else if(engine.lastGamePlay() == "WON"){
lossCount = 0;
}
});
function getBet(){
return Math.round((baseBet * (betMulti ** lossCount)) / 100) * 100;
}
var config = {
target: { value: '', type: 'text', label: 'User to follow' },
maxBet: { value: 1e8, type: 'balance', label: 'Max Bet' },
betMulti: { value: 0.5, type: 'number', label: 'Bet Adjustment' },
payMod: { value: 0, type: 'number', label: 'Payout (+/-)' },
minTarget: { value: 5, type: 'multiplier', label: 'Payout Minimum' }
};
log('Script is running..');
engine.on('BET_PLACED', (bet) => {
if (bet.uname == config.target.value) {
if (bet.payout < config.minTarget.value){
log('Ignored bet with low target payout');
return;
}
let paySize = (bet.payout + config.payMod.value);
let betSize = roundBit(Math.min(config.maxBet.value, (bet.wager * config.betMulti.value)));
if (userInfo.balance < betSize) {
log('You have a balance is too low, you can not bet');
return;
}
engine.bet(betSize, paySize); // aim at same payout as target..
log(`Placed bet ${betSize/100} bits @ ${paySize}x`);
}
});
engine.on('CASHED_OUT', (cashOut) => {
if (cashOut.uname === config.target.value) {
if (engine.currentlyPlaying()) {
engine.cashOut();
log(`Spotted ${cashOut.uname} cashing out at ${cashOut.cashedAt}x`);
}
}
});
function roundBit(bet){
return Math.round(bet / 100) * 100;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment