Bitcoin Forum
December 03, 2016, 09:58:58 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: BTCLotto, IRC-style!  (Read 741 times)
anthony_
Member
**
Offline Offline

Activity: 65


View Profile
June 16, 2011, 05:14:12 AM
 #1

Well, I threw a gambling part into my IRC bot, it works as follows:
You get a random number from 1-100 and where:
1-50 loses to the bank
51-89 wins 150% of the wager
90-99 wins 220% of the wager
100 wins the jackpot, you get 90% of it, the system gets 5% and 5% stays.

Every bid, jackpot gets 10% and system gets 5% of the wager.


Minimum bid is is 0.05, although in order to be eligible to win the jackpot, you have to wager 0.1 or more, otherwise if you roll 100 it will just do the standard 220%.


Anyways, if you wanted to give it a shot you can find him in #btcbot on irc.freenode.net.
It is host based, as long as your host doesn't change your balance will remain yours.
If you don't know how to use IRC, use this http://webchat.freenode.net/?channels=#btcbot

Code:
case "roll":
if(!$args[2]) {
$bot->message($chan, $who[0] . ", use !btclotto roll <wager>");
return 0;
}
if(!is_numeric($args[2])) {
$bot->message($chan, $who[0] . ", number values only!");
return 0;
}
$wager = floatval($args[2]);
if($bitcoin->getbalance($who[2], 1) < $wager || $wager < 0.05) {
$bot->message($chan, $who[0] . ", you cannot wager that amount!!! it must be lower than your balance and at least 0.05");
return 0;
}
$num = rand(1,100);
$amount_won = 0.0;
$jackpot = false;
$winner = false;
$system_fee = $wager * 0.05;
if($num > 50 && $num < 90) {
$amount_won = $wager * 1.5;
$winner = true;
} elseif($num >= 90 && $num < 100) {
$amount_won = $wager * 2.2;
$winner = true;
} elseif($num == 100) {
if($wager > 0.1) {
$amount_won = $pot_balance * 0.90;
$system_fee = $system_fee + ($pot_balance * 0.05);
$jackpot = true;
} else {
$amount_won = $wager * 2.2;
$winner = true;
}
}
if($amount_won > $balance && $jackpot == false) {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and won more than the bank can pay out, bet lower or have bool_ transfer some spare funds.");
return 0;
}
if($winner) {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and won, " . $amount_won . " BTC has been sent to your balance.");
$bitcoin->move("bank", $who[2], $amount_won, 0);
} elseif($jackpot) {
$bot->message($chan, $who[0] . ", You rolled a 100 and won the jackpot, " . $amount_won . " BTC has been sent to your balance.");
$bitcoin->move("pot", $who[2], $amount_won, 0);
} else {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and lost, " . $wager . " BTC has been sent to the bank.");
}
$bitcoin->move($who[2], "bank", $wager, 0);
$jackpot_fee = $wager * 0.1;
$bitcoin->move("bank", "donations", $system_fee, 0);
$bitcoin->move("bank", "pot", $jackpot_fee, 0);
break;
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
1480802338
Hero Member
*
Offline Offline

Posts: 1480802338

View Profile Personal Message (Offline)

Ignore
1480802338
Reply with quote  #2

1480802338
Report to moderator
anthony_
Member
**
Offline Offline

Activity: 65


View Profile
June 20, 2011, 04:36:48 AM
 #2

Oops, meant to edit code.
Bump anyways...
nhodges
Sr. Member
****
Offline Offline

Activity: 308


View Profile
June 20, 2011, 04:40:02 AM
 #3

So, is this just for fun? How do we fund our rolls?

anthony_
Member
**
Offline Offline

Activity: 65


View Profile
June 20, 2011, 04:43:04 AM
 #4

So, is this just for fun? How do we fund our rolls?

There is a !btclotto newaddress and then you send money to the generated address (which is then linked to your hostname).
Once there is one confirmation it will show up in !btclotto balance, then you can do !btclotto roll <wager>.

Once you are done playing you can do !btclotto withdraw <sendtoaddress> [amount], amount being optional, if left blank it will send all of your money to you.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!