Author Topic: Betting/Voting Item  (Read 4126 times)

Offline Voldsom

Betting/Voting Item
« on: May 13, 2007, 02:44:37 am »
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 ;D

Save this as Bet.php.
Code: [Select]
<?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.";

         }
  }

?>
« Last Edit: May 13, 2007, 02:50:51 am by Voldsom »

Offline Lady Ambrosia

Re: Betting/Voting Item
« Reply #1 on: May 16, 2007, 01:30:22 pm »
My only question is....how does this work exactly?  As I'm a bit confused, I mean, I understand it's for betting, but how does it work?
Ambrosia's Castle - My Personal Site
The Dark Castle - My Forum
Avatar by:  Me

TexasBartender

  • Guest
Re: Betting/Voting Item
« Reply #2 on: May 16, 2007, 02:54:29 pm »
Yea me to don't know what to do with it lol

Offline Voldsom

Re: Betting/Voting Item
« Reply #3 on: May 17, 2007, 04:25:19 am »
Well it sends a certain member a name of a vote, the item when used shows whatever amount of votes you edit it for and the user selects one. That's all I can really say, it works in my mind, sorry.