View difference between Paste ID: NbY5dVQ1 and dm2e6b1H
SHOW: | | - or go back to the newest paste.
1
var config = {
2
    baseBet:            { value: 10000, type: 'balance', label: 'Base Bet' },
3
    crashTarget:        { value: 5.37, type: 'multiplier', label: 'Cash Out' },
4
    multiOnloss:        { value: 1.25, type: 'multiplier', label: 'Increase Bet on Loss' },
5
    playafterXgames:    { value: 10, type: 'multiplier', label: 'Play after games under Xgames Multiplier' },
6
    underXgames:        { value: 5.37, type: 'multiplier', label: 'Xgames Multiplier' },
7
    stopLoss:           { value: 100000, type: 'balance', label: 'Stop if loss greater than'},
8
    stopProfit:         { value: 1000000, type: 'balance', label: 'Stop if profit greater than'},
9
};
10
 
11
log ( 'Script is running...' );
12
 
13
//Game Variables
14
var currentBet = 0;
15
var Xgames = 0;
16
 
17
//Log Variables
18
var sessionProfit = 0;
19
 
20
 
21
//Events to follow
22
engine.on('GAME_STARTING', ongamestart);
23
engine.on('GAME_ENDED', ongameend);
24
 
25
//Game Starting Event
26
function ongamestart() {
27
    engine.bet(roundBit(currentBet), config.crashTarget.value);
28
}
29
 
30
//Game Ending Event
31
function ongameend() {
32
    var lastGame = engine.history.first()
33
   
34
    // Xgames counter
35
    if (lastGame.bust > config.underXgames.value) {
36
        Xgames++;
37
    }else{
38
        Xgames = 0;
39
    }
40
   
41
    // Did we bet last round?
42
    if (lastGame.wager){
43
        //We Won
44
        if(lastGame.cashedAt){
45
            currentBet = 0;
46
            sessionProfit += (((lastGame.cashedAt * lastGame.wager)- lastGame.wager)/100);
47
            //Check Session Profit
48
            if ((sessionProfit * 100) > config.stopProfit.value){
49
            engine.off('GAME_STARTING', ongamestart);
50
            engine.off('GAME_ENDED', ongameend);
51
            log ( 'We won that round and session profit is', sessionProfit, 'Script Stopped');
52
            }else{
53
            log ( 'We won that round. Lets Restart the Sequence. Session Profit', sessionProfit );
54
            }
55
        }else{
56
        //We Lost
57
            // Check sessionProfit
58
            if((sessionProfit*100) < (config.stopLoss.value - (config.stopLoss.value * 2))){
59
            engine.off('GAME_STARTING', ongamestart);
60
            engine.off('GAME_ENDED', ongameend);
61
            log ( 'We lost that round and session profit is', sessionProfit, 'Script Stopped');
62
            }else{
63
            currentBet *= config.multiOnloss.value;
64
            sessionProfit -= (lastGame.wager/100);
65
            log ( 'We lost that round. Lets bet', roundBit(currentBet)/100, 'next round' );
66
            }                              
67
         }
68
    }else{
69
    //We Didn't Bet
70
        if( Xgames >= config.playafterXgames.value){
71
            currentBet = config.baseBet.value;
72
            log ( 'X Games target of', config.playafterXgames.value, 'has been met. Next round we will bet. Current session Profit', sessionProfit );
73
        }else{
74
            currentBet = 0;
75
            log ( 'X Games count', Xgames );
76
            }
77
        }
78
}
79
 
80
//Math Rounding Function
81
function roundBit(bet){
82
    return Math.round(bet / 100)*100;
83
}