Author

Topic: BTCLotto, IRC-style! (Read 958 times)

member
Activity: 65
Merit: 10
June 20, 2011, 12: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 .

Once you are done playing you can do !btclotto withdraw [amount], amount being optional, if left blank it will send all of your money to you.
sr. member
Activity: 322
Merit: 251
June 20, 2011, 12:40:02 AM
#3
So, is this just for fun? How do we fund our rolls?
member
Activity: 65
Merit: 10
June 20, 2011, 12:36:48 AM
#2
Oops, meant to edit code.
Bump anyways...
member
Activity: 65
Merit: 10
June 16, 2011, 01: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 ");
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;
Jump to: