Script Crash User Follow BC GAME
let config = {
printMode: {
label: '', value: 'off', type: 'radio',
options: [
{ value: 'off', label: 'Bet Mode' },
{ value: 'on', label: 'Print Mode' }
]
},
followUser: {label: 'User to follow', value: '', type: 'text'},
followCoin: {label: "Coin to follow", value: '', type: 'text'},
maxBetTitle: {
label:
"Min Bet | Max Bet",
type: 'title'
},
minBet: {label: 'Min Bet ', value: currency.minAmount * 1.2, type: 'number'},
maxBet: {label: 'Max Bet ', value: currency.maxAmount, type: 'number'},
percentTitle: {label: 'Set The Percent Of Users Bet To Make ', type: 'title'},
percentBet: {label: 'Percent ', value: 100, type: 'number' },
maxPayout: {
label: 'Max payout',
value: 100,
type: 'number'
},
balanceBetTitle: {label: 'Stop Profit | Stop Loss ', type: 'title'},
autoAdjust: {
label: '', value: 'reset', type: 'radio',
options: [
{ value: 'reset', label: 'Dont Auto Adjust' },
{ value: 'increase', label: 'Auto Adjust Stop Loss' }
]
},
profitStop: {label: 'Balance Over ', value: parseFloat(currency.amount) * 2 , type: 'number'},
lossStop: {label: 'Balance Under ', value: 0, type: 'number'}
}
function main() {
const followUser = config.followUser.value.toLowerCase()
const maxPayout = config.maxPayout.value
const maxBet = config.maxBet.value
const minBet = config.minBet.value
const profitStop = config.profitStop.value
var lossStop = config.lossStop.value
const percentBet = config.percentBet.value / 100
const lossAmount = currency.amount - config.lossStop.value
let isPlaying = false
engine.on('GAME_STARTING', function() {
if (isPlaying) {
log.info(`Following ${config.followUser.value.toLowerCase()}`)
}
})
engine.on('GAME_ENDED', function() {
isPlaying = false
const lastGame = engine.getHistory()[0]
if (!lastGame.wager) {
return
}
if (lastGame.cashedAt) {
log.info(
`Cashed Out: ${lastGame.cashedAt/100}x , profit: ${
parseFloat((lastGame.wager * (lastGame.cashedAt/100)) - lastGame.wager).toFixed(8)
}`
)
} else {
log.info(`Lost: ${lastGame.wager}`)
}
log.info('\n')
if (config.autoAdjust.value === 'increase') {
if (currency.amount - lossStop >= lossAmount * 2) {
log.info('*--------------------------------------------------------------------------*')
log.info(" Adjusting Stop Loss")
while(currency.amount - lossStop >= lossAmount * 2) {
lossStop += lossAmount
}
log.info(" Stop Loss Changed: "+lossStop)
log.info('*--------------------------------------------------------------------------*')
}
}
})
engine.on('GAME_BET', function(player) {
if(config.printMode.value === 'on') {
if(player.name.toLowerCase().includes(config.followUser.value.toLowerCase())) {
log.info(player.name +" : "+player.userId+" : "+player.bet+" "+player.currencyName);
//console.log(player);
}
}
if (player.userId != config.followUser.value) {
return
}
if (player.currencyName.toLowerCase() != config.followCoin.value.toLowerCase()) {
log.error("Player Has Switched Coins: "+player.bet+" "+player.currencyName);
return;
}
let theBet = player.bet * percentBet
if (theBet < minBet) {
let theBet = minBet
}
if (maxBet < theBet) {
log.info('Damn Hit Max Bet')
return;
}
if (currency.amount - theBet < lossStop) {
log.error('Sorry You Hit Stop Loss')
engine.stop();
}
if (currency.amount > profitStop) {
log.info('Congrats You Hit Profit Stop!')
engine.stop();
}
isPlaying = true
engine.bet(parseFloat(theBet).toFixed(8), maxPayout)
})
engine.on('GAME_CASHED', function(player) {
if (player.userId == config.followUser.value) {
engine.cashOut()
}
})
}