Advertisement
Nixsy

Follow player wins losses profit

Oct 20th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var wins = 0;
  2. var losses = 0;
  3. var profit = 0;
  4. var uid = 98066;
  5.  
  6. socket.on("result", function (data) {
  7.     if (data.uid == uid) {
  8.         if (data.win) {
  9.             wins++;
  10.             workit(parseFloat(data.chance), parseFloat(data.bet).toFixed(8));
  11.             console.log("Wins:" + wins + " Losses:" + losses + " PROFIT;", profit);
  12.  
  13.  
  14.         } else {
  15.             losses++;
  16.             profit = profit - parseFloat(data.bet).toFixed(8);
  17.             console.log("Wins:" + wins + " Losses:" + losses + " PROFIT;", profit);
  18.  
  19.         }
  20.     }
  21. });
  22.  
  23. function workit(chance, bet){
  24.     var payoutMult = 99 / chance;
  25.     var thisbet = bet * payoutMult;
  26.     profit = profit + thisbet;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement