Well my members have been looking for a betting script like vBookie, but of course I stuck with SMF and made my own Betting and Voting Item for SMFShop. To start with this isn't a full betting script it jsut simply allows someone to recieve a members ID and what they have selected, I do the betting myself by hand, but I'm hoping someone can do something to actually make this a betting scipt.
Also this is my first script ever
Save this as Bet.php.
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
| (c) 2006 DanSoft Australia |
| http://www.dansoftaustralia.net/ |
\**********************************************/
//File: Bet.php
// VERSION: 3.0
// $Date: 2007-05-12 13:34:18 +1000 (Sat, 12 Nov 2007) $
// $Id: Bet.php 24 2007-05-12 03:34:18Z Mh $
global $sourcedir;
require_once($sourcedir . '/Subs-Post.php');
class item_Bet extends itemTemplate {
function getItemDetails() {
$this->authorName = "AxS Voldsom";
$this->authorWeb = "http://www.abyss-studios.com";
$this->authorEmail = "axsvoldsom@abyss-studios.com";
$this->name = "Bet";
$this->desc = "Bet";
// The item's price
$this->price = 50;
$this->require_input = true;
$this->can_use_item = true;
}
function getAddInput() {
global $item_info;
if ($item_info[1] == 0) $item_info[1] = '';
if ($item_info[2] == 0) $item_info[2] = '';
return '
Options (you may use BBCode here):
<textarea name="info1" rows="1" style="width: 100%">' . $item_info[1] . '</textarea>
<textarea name="info2" rows="1" style="width: 100%">' . $item_info[2] . '</textarea>';
}
function getUseInput() {
global $context, $settings, $txt, $item_info;
return "$item_info[1]: <input type='radio' name='bet' value='Red'>
$item_info[2]: <input type='radio' name='bet' value='Blue'>";
}
function onUse() {
global $db_prefix, $ID_MEMBER, $user, $item_info;
$pmfrom = array(
'id' => 21,
'name' => 'The Shop',
'username' => 'The Shop'
);
$pmto = array(
'to' => array(21),
'bcc' => array()
);
sendpm($pmto, 'Bet!', "[b]{$ID_MEMBER}[/b] has betted on [b]{$_POST['bet']}[/b]", 0, $pmfrom); ;
return "Your bet has been collected, winners will be notified and given their share of the winnings shortly after the event is over.";
}
}
?>